@Override public Object execute(ExecutionEvent event) throws ExecutionException { IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event); IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows(); try { view = (N4IDEXpectView) windows[0].getActivePage().showView( N4IDEXpectView.ID); } catch (PartInitException e) { N4IDEXpectUIPlugin.logError("cannot refresh test view window", e); } Description desc = (Description) selection.getFirstElement(); if (desc.isTest() && view.testsExecutionStatus.hasFailed(desc)) { Throwable failureException = view.testsExecutionStatus.getFailure(desc).getException(); if (failureException instanceof ComparisonFailure) { ComparisonFailure cf = (ComparisonFailure) failureException; // display comparison view displayComparisonView(cf, desc); } } return null; }
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); final ISourceProviderService service = activeWorkbenchWindow.getService(ISourceProviderService.class); final AnalysisSourceProvider sourceProvider = (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE); final Thread thread = new Thread(new Runnable() { @Override public void run() { if (sourceProvider.getEvaluationState() == EvaluationState.OPEN) { Visualization.evaluatorOpen = false; sourceProvider.setEvaluationState(EvaluationState.CLOSE); } else if (sourceProvider.getEvaluationState() == EvaluationState.CLOSE) { Visualization.evaluatorOpen = true; sourceProvider.setEvaluationState(EvaluationState.OPEN); } Visualization.showViz(); } }); thread.start(); return true; }
/** * Receives a command that is about to execute. * @param commandId the identifier of the command that is about to execute * @param event the event that will be passed to the <code>execute</code> method */ @Override public void preExecute(String commandId, ExecutionEvent event) { long time = Time.getCurrentTime(); String path = recorder.getActiveInputFilePath(); ExecutionMacro macro = new ExecutionMacro(time, "Exec", path, commandId); recorder.recordExecutionMacro(macro); try { String id = event.getCommand().getCategory().getId(); if (id.endsWith("category.refactoring")) { recorder.setParentMacro(macro); TriggerMacro trigger = new TriggerMacro(time, "Refactoring", path, TriggerMacro.Kind.BEGIN); recorder.recordTriggerMacro(trigger); } } catch (NotDefinedException e) { e.printStackTrace(); } }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection sel = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow() .getSelectionService().getSelection(); if (sel instanceof ITreeSelection) { ITreeSelection treeSel = (ITreeSelection) sel; if (treeSel.getFirstElement() instanceof IFile) { IFile file = (IFile) treeSel.getFirstElement(); List<IMarker> markers = MarkerFactory.findMarkers(file); MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Marker Count", null, markers.size() + " marker(s)", MessageDialog.INFORMATION, new String[] {"OK"}, 0); dialog.open(); } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = MarkerFactory.getSelection(); if (selection instanceof ITreeSelection) { ITreeSelection treeSelection = (ITreeSelection) selection; if (treeSelection.getFirstElement() instanceof IOpenable || treeSelection.getFirstElement() instanceof IFile) { IResource resource = ((IAdaptable) treeSelection.getFirstElement()).getAdapter(IResource.class); List<IMarker> markers = MarkerFactory.findMarkers(resource); MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Marker Count", null, markers.size() + " marker(s)", MessageDialog.INFORMATION, new String[] {"OK"}, 0); dialog.open(); } } return null; }
@Override public Object executeForSelectedLanguage(ExecutionEvent event, IProject updatedGemocLanguageProject, Language language) throws ExecutionException { CreateDomainModelWizardContextAction action = new CreateDomainModelWizardContextAction( updatedGemocLanguageProject); action.actionToExecute = CreateDomainModelAction.CREATE_NEW_EMF_PROJECT; action.execute(); if(action.getCreatedEcoreUri() != null){ waitForAutoBuild(); updateMelange(event,language,action.getCreatedEcoreUri()); } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { OpenDialogFactory.openDialog(new OpenDialogTemplate() { @Override public String getNature() { return "KSP declaration"; } @Override public Object[] getElements() { /* Charge les KSP du cache du KspManager. */ return KspManager.getInstance().getWorkspace().getKspDeclarations().toArray(); } }); return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench==null){ return null; } IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); if (activeWorkbenchWindow==null){ return null; } IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); if (activePage==null){ return null; } IEditorPart editor = activePage.getActiveEditor(); if (editor instanceof BatchEditor){ executeOnBatchEditor((BatchEditor) editor); } return null; }
public Object execute ( final ExecutionEvent event ) throws ExecutionException { final String data = event.getParameter ( "org.eclipse.scada.ae.ui.testing.loadMore.count" ); final int count; if ( data == null ) { count = 1000; } else { count = Integer.parseInt ( data ); } for ( final QueryBean query : getQueryList () ) { query.getQuery ().loadMore ( count ); } return null; }
@Override public Object execute ( final ExecutionEvent event ) throws ExecutionException { for ( final Item item : getItems () ) { try { openItem ( item ); } catch ( final PartInitException e ) { throw new ExecutionException ( "Failed to run", e ); //$NON-NLS-1$ } } return null; }
@Override public Object execute ( final ExecutionEvent event ) throws ExecutionException { try { // the following cast might look a bit weird. But first an adapter is requested and it only adapts to "core" connection services. final ConnectionService connectionService = (ConnectionService)SelectionHelper.first ( getSelection (), org.eclipse.scada.core.connection.provider.ConnectionService.class ); final IViewPart view = getActivePage ().showView ( SummaryExplorerViewPart.VIEW_ID, "" + this.counter++, IWorkbenchPage.VIEW_ACTIVATE ); ( (SummaryExplorerViewPart)view ).setConnectionService ( connectionService ); } catch ( final PartInitException e ) { throw new ExecutionException ( "Failed to open view", e ); } return null; }
@Override public Object execute ( final ExecutionEvent event ) throws ExecutionException { final MultiStatus ms = new MultiStatus ( HivesPlugin.PLUGIN_ID, 0, getLabel (), null ); for ( final ServerLifecycle server : SelectionHelper.iterable ( getSelection (), ServerLifecycle.class ) ) { try { process ( server ); } catch ( final CoreException e ) { ms.add ( e.getStatus () ); } } if ( !ms.isOK () ) { StatusManager.getManager ().handle ( ms, StatusManager.SHOW ); } return null; }
@Override public Object execute ( final ExecutionEvent event ) throws ExecutionException { final IEditorPart editor = getActivePage ().getActiveEditor (); byte b = (byte)1; for ( final Attribute attribute : SelectionHelper.iterable ( getSelection (), Attribute.class ) ) { EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( attribute ); if ( domain == null && editor instanceof IEditingDomainProvider ) { domain = ( (IEditingDomainProvider)editor ).getEditingDomain (); } SetCommand.create ( domain, attribute, ProtocolPackage.Literals.ATTRIBUTE__FIELD_NUMBER, b ).execute (); b++; } return null; }
@Override public Object execute ( final ExecutionEvent event ) throws ExecutionException { final MasterSelectionDialog dlg; try { dlg = selectMaster (); } catch ( final CoreException e ) { throw new ExecutionException ( "Failed to select driver", e ); } if ( dlg != null ) { setMaster ( dlg.getMaster (), dlg.getMode () ); } return null; }
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { AlloyOtherSolutionReasoning.getInstance().finish(); if (AlloyUtilities.isExists()) { candidateToTypeChanging = new ArrayList<IMarker>(); file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() .getEditorInput().getAdapter(IFile.class); selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); marker = getMarkerFromEditor(); deleteMarker(); refresh(); } else { final MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(), "System Information", null, "You dont have any registered alloy file to system.", MessageDialog.INFORMATION, new String[] {"OK"}, 0); infoDialog.open(); } return null; }
@Override public Object execute ( final ExecutionEvent event ) throws ExecutionException { final Component component = SelectionHelper.first ( getSelection (), Component.class ); if ( component == null ) { return null; } try { final IObservableSet input = Helper.createObversableInput ( DisplayRealm.getRealm ( getShell ().getDisplay () ), component ); new ComponentOutputDialog ( getShell (), input ).open (); } catch ( final Exception e ) { StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, "Failed to generate component output", e ), StatusManager.BLOCK ); throw new ExecutionException ( "Failed to generate component output", e ); } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench==null){ return null; } IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); if (activeWorkbenchWindow==null){ return null; } IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); if (activePage==null){ return null; } IEditorPart editor = activePage.getActiveEditor(); if (editor instanceof BashEditor){ executeOnBashEditor((BashEditor) editor); } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IFile file = getSelectedFile(); if (file==null){ return null; } IWorkbenchPage page = EclipseUtil.getActivePage(); if (page==null){ return null; } try { page.openEditor(new FileEditorInput(file), BashEditor.EDITOR_ID); } catch (PartInitException e) { throw new ExecutionException("Was not able to open bash editor for file:"+file.getName(),e); } return null; }
@Override public Object execute(ExecutionEvent event) { IWorkbenchPart part = HandlerUtil.getActiveEditor(event); if (part instanceof SQLEditor){ SQLEditor sqlEditor = (SQLEditor) part; if (sqlEditor.getCurrentDb() != null) { sqlEditor.updateDdl(); } else { MessageBox mb = new MessageBox(HandlerUtil.getActiveShell(event), SWT.ICON_INFORMATION); mb.setText(Messages.UpdateDdl_select_source); mb.setMessage(Messages.UpdateDdl_select_source_msg); mb.open(); } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID); if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID); } if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID); } try { if (descriptor != null) { IWizard wizard = descriptor.createWizard(); WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } } catch (CoreException e) { e.printStackTrace(); } return null; }
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final MessageDialog warningdialog = new MessageDialog(MarkerActivator.getShell(), "Mark Information", null, "If new alloy file will be parsed , your all marker type will be lost !", MessageDialog.WARNING, new String[] {"OK", "Cancel"}, 0); if (warningdialog.open() != 0) { return null; } final String filePath = getFilePath(); if (filePath == null) { return null; } AlloyParseUtil.parse(filePath); try { TraceManager.get().loadSpec(filePath); } catch (final TraceException e) { e.printStackTrace(); } return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection sel = HandlerUtil.getCurrentSelection(event); if (sel.isEmpty()) return null; if (!(sel instanceof IStructuredSelection)) return null; Object obj = ((IStructuredSelection) sel).getFirstElement(); if (!(obj instanceof IFile)) return null; try { ConvertToFileCreationWizard wizard = new ConvertToFileCreationWizard( ); wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection)sel); Shell activeShell = HandlerUtil.getActiveShell(event); if (activeShell==null) return null; WizardDialog dialog = new WizardDialog(activeShell,wizard); dialog.open(); } catch (Exception e) { ResourceManager.logException(e); } return null; }
static PgDbProject getProject(ExecutionEvent event){ try{ ISelection sel = HandlerUtil.getActiveMenuSelection(event); IStructuredSelection selection = (IStructuredSelection) sel; if (selection == null){ return null; } Object firstElement = selection.getFirstElement(); if (firstElement instanceof IProject) { IProject proj = (IProject)firstElement; if (proj.getNature(NATURE.ID) != null) { return new PgDbProject(proj); } } } catch (CoreException ce){ Log.log(Log.LOG_ERROR, ce.getMessage()); } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { OpenDialogFactory.openDialog(new OpenDialogTemplate() { @Override public String getNature() { return "service method"; } @Override public Object[] getElements() { /* Charge les services du cache du ServiceManager. */ return ServiceManager.getInstance().getWorkspace().getServiceImplementations().toArray(); } }); return null; }
@Override public Object execute(ExecutionEvent event) { IWorkbenchPart part = HandlerUtil.getActiveEditor(event); if (part instanceof ProjectEditorDiffer){ ProjectEditorDiffer differ = (ProjectEditorDiffer) part; try { differ.commit(); } catch (PgCodekeeperException ex) { ExceptionNotifier.notifyDefault(Messages.error_creating_dependency_graph, ex); } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Command cmd = event.getCommand(); boolean currentState = HandlerUtil.toggleCommandState(cmd); N4JSReferenceQueryExecutor.considerOverridenMethods = !currentState; return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveShell(event); PreferenceDialog dialog = createPreferenceDialogOn(shell, ExternalLibraryPreferencePage.ID, FILTER_IDS, null); if (null != dialog) { dialog.open(); } return null; }
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final ISelection selection = getCurrentSelection(event); if (null == selection) { return null; } if (selection.isEmpty()) { return null; } final AtomicReference<IFile> fileRef = new AtomicReference<>(); if (selection instanceof IStructuredSelection) { final Object element = ((IStructuredSelection) selection).getFirstElement(); if (element instanceof IFile) { fileRef.set((IFile) element); } } else if (selection instanceof ITextSelection) { final IEditorPart editorPart = getActiveEditor(event); if (null != editorPart) { final IEditorInput input = editorPart.getEditorInput(); if (input instanceof IFileEditorInput) { fileRef.set(((IFileEditorInput) input).getFile()); } } } if (null != fileRef.get()) { final Optional<IFile> generatedSource = fileLocator.tryGetGeneratedSourceForN4jsFile(fileRef.get()); if (generatedSource.isPresent()) { tryOpenFileInEditor(fileRef.get(), generatedSource.get()); } } return null; }
/** * Returns the active tree resource selection if there is one. * * Examines the active workspace selection and if it is a resource inside of a tree returns it. * * @param event * The execution event * @returns The resource or {@code null} on failure. * */ private static IResource getActiveTreeResourceSelection(ExecutionEvent event) { ISelection activeSelection = HandlerUtil.getCurrentSelection(event); if (activeSelection instanceof TreeSelection) { Object firstElement = ((TreeSelection) activeSelection).getFirstElement(); if (firstElement instanceof IResource) { return (IResource) firstElement; } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPart part = HandlerUtil.getActivePart(event); if(part instanceof CommonNavigator){ CopyToClipboardAction action=new CopyToClipboardAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite()); action.run(); } else if(part instanceof ELTGraphicalEditor){ IEditorPart editor = HandlerUtil.getActiveEditor(event); ((ELTGraphicalEditor)editor).copySelection(); } return null; }
@Override /** * the command has been executed, so extract extract the needed information * from the application context. */ public Object execute(ExecutionEvent event) throws ExecutionException { Supplier<OmniscientGenericSequentialModelDebugger> debuggerSupplier = Activator.getDefault().getDebuggerSupplier(); if (debuggerSupplier != null) { OmniscientGenericSequentialModelDebugger debugger = debuggerSupplier.get(); debugger.stepBackInto(); } return null; }
@Override /** * the command has been executed, so extract extract the needed information * from the application context. */ public Object execute(ExecutionEvent event) throws ExecutionException { Supplier<OmniscientGenericSequentialModelDebugger> debuggerSupplier = Activator.getDefault().getDebuggerSupplier(); if (debuggerSupplier != null) { OmniscientGenericSequentialModelDebugger debugger = debuggerSupplier.get(); debugger.stepBackOut(); } return null; }
@Override public Object execute(ExecutionEvent event) { SQLEditor editor = (SQLEditor) HandlerUtil.getActiveEditor(event); DbInfo dbInfo = editor.getCurrentDb(); if (dbInfo == null){ ExceptionNotifier.notifyDefault(Messages.sqlScriptDialog_script_select_storage, null); return null; } String text = editor.getEditorText(); if (text.trim().isEmpty()) { ExceptionNotifier.notifyDefault(Messages.QuickUpdate_empty_script, null); return null; } IFile file = ResourceUtil.getFile(editor.getEditorInput()); editor.doSave(new NullProgressMonitor()); byte[] textSnapshot; try { textSnapshot = text.getBytes(file.getCharset()); } catch (UnsupportedEncodingException | CoreException e) { ExceptionNotifier.notifyDefault(Messages.QuickUpdate_error_charset, e); return null; } QuickUpdateJob quickUpdateJob = new QuickUpdateJob(file, dbInfo, textSnapshot, editor); quickUpdateJob.setUser(true); quickUpdateJob.schedule(); editor.saveLastDb(dbInfo); return null; }
@Override protected Object execute(AvroSchemaEditorDebugView debugView, ExecutionEvent event) { TreeViewer treeViewer = debugView.getViewer(); UIUtils.expandAll(treeViewer, CMD_ID); return null; }
@Override public Object executeForSelectedLanguage(ExecutionEvent event, IProject updatedGemocLanguageProject, Language language) throws ExecutionException { CreateAnimatorProjectWizardContextAction action = new CreateAnimatorProjectWizardContextAction( updatedGemocLanguageProject, language); action.actionToExecute = CreateAnimatorProjectAction.CREATE_NEW_SIRIUS_PROJECT; action.execute(); return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart editor = HandlerUtil.getActiveEditor(event); if(editor instanceof ELTGraphicalEditor)((ELTGraphicalEditor)editor).redoSelection(); return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { Supplier<IExecutionEngine> engineSupplier = org.eclipse.gemoc.executionframework.debugger.Activator.getDefault().getEngineSupplier(); Supplier<String> bundleSupplier = org.eclipse.gemoc.executionframework.debugger.Activator.getDefault().getBundleSymbolicNameSupplier(); if (engineSupplier != null) { this.engine = engineSupplier.get(); } if (bundleSupplier != null) { this.bundleSymbolicName = bundleSupplier.get(); } TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event); locateAndOpenSource(selection); return null; }