@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); /*MessageDialog.openInformation( window.getShell(), "Plugin", "Hello, Eclipse world");*/ // Pfad vom Projekt if (window != null) { IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection(); Object firstElement = selection.getFirstElement(); if (firstElement instanceof IAdaptable) { IProject project = (IProject)((IAdaptable)firstElement).getAdapter(IProject.class); IPath path = project.getFullPath(); System.out.println("Projekt: "+path); StartEGL.start(""+path); } } return null; }
@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 final Object execute ( final ExecutionEvent event ) throws ExecutionException { final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked ( event ); final Object value = event.getParameter ( PARAMETER_NAME_VIEW_ID ); try { final String[] viewIds = ( (String)value ).split ( ":" ); if ( viewIds.length == 1 ) { openView ( viewIds[0], null, window ); } else if ( viewIds.length == 2 ) { openView ( viewIds[0], viewIds[1], window ); } } catch ( final PartInitException e ) { throw new ExecutionException ( "Part could not be initialized", e ); //$NON-NLS-1$ } 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) { 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; }
/** * the command has been executed, so extract extract the needed information * from the application context. */ public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil .getActiveWorkbenchWindowChecked(event); final Display display = Display.getDefault(); final Shell shell = window.getShell(); Locale.setDefault(Locale.ENGLISH); final TipDayEx tipDayEx = new TipDayEx(); for (String tipMessage : new String[] { "This is the first tip", "This is the second tip", "This is the third tip", "This is the forth tip", "This is the fifth tip" }) { tipDayEx.addTip(String.format( "<h4>%s</h4>" + "<b>%s</b> " + "<u>%s</u> " + "<i>%s</i> " + "%s " + "%s<br/>" + "<p color=\"#A00000\">%s</p>", tipMessage, tipMessage, tipMessage, tipMessage, tipMessage, tipMessage, tipMessage)); } tipDayEx.open(shell, display); 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); sourceProvider.setPassive(); final Thread thread = new Thread(new Runnable() { @Override public void run() { AlloyValidator.isCanceled = true; AlloyOtherSolutionReasoning.getInstance().finish(); AlloyOtherSolutionDiscovering.getInstance().finish(); AlloyOtherSolutionReasoningForAtom.getInstance().finish(); Visualization.showViz(); } }); thread.start(); return true; }
@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; }
@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); sourceProvider.setActive(ReasoningType.DISCOVER_RELATION); final Thread thread = new Thread(new Runnable() { @Override public void run() { final AlloyReasoning alloyReasoning = new AlloyReasoning(); final boolean reasoning = alloyReasoning.reasoning(); if (!reasoning) { sourceProvider.setPassive(); } Visualization.showViz(); } }); thread.start(); return true; }
@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); sourceProvider.setActive(ReasoningType.DISCOVER_ATOM); final Thread thread = new Thread(new Runnable() { @Override public void run() { final AlloyDiscovering alloyDiscovering = new AlloyDiscovering(); final boolean discovering = alloyDiscovering.discovering(); if (!discovering) { Visualization.sourceProvider.setPassive(); } Visualization.showViz(); } }); thread.start(); return true; }
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final IEditorPart editorPart = HandlerUtil.getActiveEditor(event); final ICompilationUnit icu = JavaUI.getWorkingCopyManager().getWorkingCopy(editorPart.getEditorInput()); try { final IType type = icu.getTypes()[0]; final List<Field> fields = new ArrayList<>(); for (final IField field : type.getFields()) { final String fieldName = field.getElementName(); final String fieldType = Signature.getSignatureSimpleName(field.getTypeSignature()); fields.add(new Field(fieldName, fieldType)); } new WizardDialog(HandlerUtil.getActiveShell(event), new BuilderGeneratorWizard(icu, fields)).open(); } catch (final JavaModelException e) { e.printStackTrace(); } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { TreeSelection selection = (TreeSelection) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); Object firstElement = selection.getFirstElement(); if (firstElement instanceof IAdaptable) { IFile file = (IFile)((IAdaptable)firstElement).getAdapter(IFile.class); IPath path = file.getLocation(); try { //TODO fix SurveyGenerator.generateAll(path.toOSString(), path.toOSString()); MessageDialog.openInformation(shell, "Success", "Code was generated successfully"); } catch (Exception e) { //MessageDialog.openError(shell, "Error", e.getMessage()); e.printStackTrace(); } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { final IPath containerPath = new Path(Initializer.APGAS_CONTAINER_ID); try { final IJavaProject javaProject = JavaCore .create(((IAdaptable) ((IStructuredSelection) HandlerUtil .getCurrentSelection(event)).getFirstElement()) .getAdapter(IProject.class)); final IClasspathEntry[] entries = javaProject.getRawClasspath(); for (int i = 0; i < entries.length; i++) { if (entries[i].getEntryKind() == IClasspathEntry.CPE_CONTAINER && entries[i].getPath().equals(containerPath)) { return null; } } final IClasspathEntry[] cp = new IClasspathEntry[entries.length + 1]; System.arraycopy(entries, 0, cp, 0, entries.length); cp[entries.length] = JavaCore.newContainerEntry(containerPath); javaProject.setRawClasspath(cp, new NullProgressMonitor()); } catch (final Exception e) { throw new ExecutionException(e.toString(), e); } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { markSpec = getMark(); IEditorPart edPart = HandlerUtil.getActiveEditor(event); if (edPart instanceof FluentMkEditor) { editor = (FluentMkEditor) edPart; doc = editor.getDocument(); if (doc != null) { ISelection sel = HandlerUtil.getCurrentSelection(event); if (sel instanceof TextSelection) { TextSelection tsel = (TextSelection) sel; int beg = tsel.getOffset(); int len = tsel.getLength(); cpos = editor.getCursorOffset(); if (len == 0) beg = cpos; try { if (samePartition(beg, len)) { toggle(beg, len); } } catch (BadLocationException e) {} } } } return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); if (selection instanceof IStructuredSelection) { for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it .hasNext();) { Object element = it.next(); IProject project = null; if (element instanceof IProject) { project = (IProject) element; } else if (element instanceof IAdaptable) { project = (IProject) ((IAdaptable) element) .getAdapter(IProject.class); } if (project != null) { try { toggleNature(project); } catch (CoreException e) { throw new ExecutionException("Failed to toggle nature", e); } } } } return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbenchSite site = HandlerUtil.getActiveSite(event); final ICommandService cs = (ICommandService) site .getService(ICommandService.class); final IHandlerService hs = (IHandlerService) site .getService(IHandlerService.class); final Command command = cs .getCommand(IWorkbenchCommandConstants.FILE_IMPORT); try { hs.executeCommand(ParameterizedCommand.generateCommand(command, Collections.singletonMap( IWorkbenchCommandConstants.FILE_IMPORT_PARM_WIZARDID, SessionImportWizard.ID)), null); } catch (CommandException e) { EclEmmaUIPlugin.log(e); } return null; }
private ICoverageLaunch openDialog(ExecutionEvent event, List<ICoverageLaunch> launches) { final ListDialog dialog = new ListDialog(HandlerUtil.getActiveShell(event)) { @Override protected void configureShell(Shell shell) { super.configureShell(shell); ContextHelp.setHelp(shell, ContextHelp.DUMP_EXECUTION_DATA); } }; dialog.setTitle(UIMessages.DumpExecutionDataDialog_title); dialog.setMessage(UIMessages.DumpExecutionDataDialog_message); dialog.setContentProvider(ArrayContentProvider.getInstance()); dialog.setLabelProvider(new LaunchLabelProvider()); dialog.setInput(launches); if (dialog.open() == Dialog.OK && dialog.getResult().length == 1) { return (ICoverageLaunch) dialog.getResult()[0]; } return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbenchSite site = HandlerUtil.getActiveSite(event); final ICommandService cs = (ICommandService) site .getService(ICommandService.class); final IHandlerService hs = (IHandlerService) site .getService(IHandlerService.class); final Command command = cs .getCommand(IWorkbenchCommandConstants.FILE_EXPORT); try { hs.executeCommand(ParameterizedCommand.generateCommand(command, Collections.singletonMap( IWorkbenchCommandConstants.FILE_EXPORT_PARM_WIZARDID, SessionExportWizard.ID)), null); } catch (CommandException e) { EclEmmaUIPlugin.log(e); } return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { /* * Try to get the spec from active navigator if any */ final ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection != null && selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) { Object selected = ((IStructuredSelection) selection).getFirstElement(); if (selected instanceof ModelContentProvider.Group) { // Convert the group to its corresponding spec selected = ((Group) selected).getSpec(); } if (selected instanceof Spec) { final Map<String, String> parameters = new HashMap<String, String>(); // fill the spec name for the handler parameters.put(NewModelHandler.PARAM_SPEC_NAME, ((Spec) selected).getName()); // delegate the call to the new model handler UIHelper.runCommand(NewModelHandler.COMMAND_ID, parameters); } } return null; }
/** * Returns an OSGi service from {@link ExecutionEvent}. It looks up a service in the following * locations (if exist) in the given order: * * {@code HandlerUtil.getActiveSite(event)} * {@code HandlerUtil.getActiveEditor(event).getEditorSite()} * {@code HandlerUtil.getActiveEditor(event).getSite()} * {@code HandlerUtil.getActiveWorkbenchWindow(event)} * {@code PlatformUI.getWorkbench()} */ public static <T> T getService(ExecutionEvent event, Class<T> api) { IWorkbenchSite activeSite = HandlerUtil.getActiveSite(event); if (activeSite != null) { return activeSite.getService(api); } IEditorPart activeEditor = HandlerUtil.getActiveEditor(event); if (activeEditor != null) { IEditorSite editorSite = activeEditor.getEditorSite(); if (editorSite != null) { return editorSite.getService(api); } IWorkbenchPartSite site = activeEditor.getSite(); if (site != null) { return site.getService(api); } } IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); if (workbenchWindow != null) { return workbenchWindow.getService(api); } return PlatformUI.getWorkbench().getService(api); }
@SuppressWarnings("unchecked") @Override public Object execute(final ExecutionEvent event) throws ExecutionException { LoggerConfigurator.setUpLogger(); final ISelection selection = HandlerUtil.getActiveMenuSelection(event); final IStructuredSelection structuredSelection = (IStructuredSelection) selection; final Object firstElement = structuredSelection.getFirstElement(); final UserInteracting dialog = new UserInteractor(); this.keepOldModel = dialog.selectFromMessage(UserInteractionType.MODAL, "Keep old model?", "No", "Yes"); if (this.type.isInstance(firstElement)) { this.handleSelectedElement((T) firstElement); } else { throw new IllegalArgumentException("Selected entry must be a file or project"); } // only for testing, so we don't need to manually delete it every time this.cleanUpIntegration(); return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { // TODO Auto-generated method stub ISelection selection = HandlerUtil.getCurrentSelection(event); // if (selection instanceof IStructuredSelection) { for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it .hasNext();) { Object element = it.next(); IProject project = null; if (element instanceof IProject) { project = (IProject) element; } else if (element instanceof IAdaptable) { project = (IProject) ((IAdaptable) element) .getAdapter(IProject.class); } if (project != null) { toggleNature(project); } } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { project = getSelectedExtension(HandlerUtil.getCurrentSelection(event)); Job job = new Job("[y] Build") { @Override protected IStatus run(IProgressMonitor monitor) { try { if (FixProjectsUtils.isAHybrisExtension(project)) { BuildUtils.refreshAndBuild(monitor, CFG_NAME, project); monitor.done(); return Status.OK_STATUS; } else { return Status.CANCEL_STATUS; } } catch (Exception e) { Activator.logError("Failed to build project", e); throw new IllegalStateException("Failed to build project", e); } } }; job.setUser(true); job.schedule(); return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { project = getSelectedExtension(HandlerUtil.getCurrentSelection(event)); Job job = new Job("[y] Build") { @Override protected IStatus run(IProgressMonitor monitor) { try { if (FixProjectsUtils.isAHybrisExtension(project)) { BuildUtils.refreshAndBuild(monitor, CFG_NAME, project); monitor.done(); return Status.OK_STATUS; } else { return Status.CANCEL_STATUS; } } catch (Exception e) { Activator.logError("Failed to build project", e); throw new IllegalStateException("Failed to build project, see workspace logs for details", e); } } }; job.setUser(true); job.schedule(); return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { /* * Try to get the spec from active navigator if any */ ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection != null && selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) { Object selected = ((IStructuredSelection) selection).getFirstElement(); if (selected instanceof Model) { Map<String, String> parameters = new HashMap<String, String>(); // fill the model name for the handler parameters.put(OpenModelHandler.PARAM_MODEL_NAME, ((Model) selected).getName()); // delegate the call to the open model handler UIHelper.runCommand(OpenModelHandler.COMMAND_ID, parameters); } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPart activePart = HandlerUtil.getActivePart(event); ImageView imageView = (ImageView) activePart; SWTImageCanvas imageCanvas = imageView.imageCanvas; if (imageCanvas == null) { return null; } Shell shell = HandlerUtil.getActiveShell(event); FileDialog dialog = new FileDialog(shell, SWT.SAVE); dialog.setFilterExtensions(new String[] { "*.png", "*.*" }); dialog.setFilterNames(new String[] { "PNG Files", "All Files" }); String fileSelected = dialog.open(); if (fileSelected != null) { ImageLoader imageLoader = new ImageLoader(); imageLoader.data = new ImageData[] { imageCanvas.getImageData() }; System.out.println("Selected file: " + fileSelected); imageLoader.save(fileSelected, SWT.IMAGE_PNG); } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { BookmarkPartOperationContext operationContext = getOperationContext(event); if (operationContext == null) { return null; } IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); if (page == null) { return null; } BookmarkId bookmarkId = getSelectedBookmarkId(page); if (bookmarkId == null) { return null; } updateBookmark(bookmarkId, operationContext); return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // get workbench window IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); // set structured selection IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection(); // check if it is an IFile if (selection.getFirstElement() instanceof IFile) { try { IFile file = (IFile) selection.getFirstElement(); if (TurnusExtensions.ARCHITECTURE.equals(file.getFileExtension())) { IFile diagFile = ArchitectureUtils.getDiagramFile(file); if (diagFile.exists()) { diagFile.delete(true, new NullProgressMonitor()); EclipseUtils.refreshWorkspace(new NullProgressMonitor()); } } } catch (Exception e) { e.printStackTrace(); } } return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); if (selection instanceof IStructuredSelection && !((IStructuredSelection) selection).isEmpty()) { IStructuredSelection structSelection = ((IStructuredSelection) selection); Iterator modelIterator = structSelection.iterator(); while (modelIterator.hasNext()) { Object element = modelIterator.next(); if (element instanceof Model) { Model model = (Model) element; if (model.isStale()) { model.recover(); } } } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart edPart = HandlerUtil.getActiveEditor(event); if (edPart instanceof FluentMkEditor) { FluentMkEditor editor = (FluentMkEditor) edPart; IDocument doc = editor.getDocument(); if (doc != null) { ISelection sel = HandlerUtil.getCurrentSelection(event); if (sel instanceof TextSelection) { TextSelection tsel = (TextSelection) sel; int beg = tsel.getOffset(); int len = tsel.getLength(); switch (checkPartition(doc, beg, len)) { case NONE: addComment(doc, beg, len); break; case SAME: removeComment(doc, beg); break; } } } } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); if (selection.isEmpty()) { return null; } List<Bookmark> bookmarks = new ArrayList<>( getBookmarksToDelete(bookmarkDatabase.getBookmarksTree(), selection)); ConfirmDeleteDialog dialog = new ConfirmDeleteDialog(HandlerUtil.getActiveShell(event), bookmarks); if (dialog.open() != Window.OK) { return null; } try { bookmarksService.deleteBookmarks(getAsBookmarkIds(selection), true); } catch (BookmarksException e) { throw new ExecutionException("Could not delete bookmark", e); } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Command cmd = event.getCommand(); boolean currentState = HandlerUtil.toggleCommandState(cmd); N4JSReferenceQueryExecutor.ignoreNamedImportSpecifier = !currentState; 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; }
/** * 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 { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow == null) { return null; } IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); if (activePage == null) { return null; } IEditorPart editor = activePage.getActiveEditor(); if (editor == null) { return null; } IEditorInput input = editor.getEditorInput(); if (input == null || ! (input instanceof FileEditorInput)) { return null; } IFile file = ((FileEditorInput) input).getFile(); if (file != null && file.getType() == IResource.FILE && file.getFileExtension().equals("java")) { utils = new ProjectUtils(file.getProject()); if (utils.isGluonMobileProject()) { ISelection selection = HandlerUtil.getCurrentSelection(event); Display.getDefault().asyncExec(() -> new JCode(utils, selection, (JavaEditor) editor)); } } return null; }
/** * {@inheritDoc} * * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ public Object execute(ExecutionEvent event) throws ExecutionException { final ISelection selection = HandlerUtil .getCurrentSelectionChecked(event); try { breakpointUtils.toggleBreakpoints(selection); } catch (CoreException e) { throw new ExecutionException("Error while toggling breakpoint.", e); } return null; }
/** * {@inheritDoc} * * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ public Object execute(ExecutionEvent event) throws ExecutionException { final ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); try { breakpointUtils.toggleBreakpoints(selection); } catch (CoreException e) { throw new ExecutionException("Error while toggling breakpoint.", e); } 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; }