org.eclipse.ui.actions.ActionContext Java Examples
The following examples show how to use
org.eclipse.ui.actions.ActionContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: N4JSNavigatorActionProvider.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public void setContext(final ActionContext context) { super.setContext(context); projectGroup.setContext(context); // context is null if disposal of the provider is triggered if (null != context) { StructuredSelection selection = (StructuredSelection) context.getSelection(); List<Object> selectedElements = Arrays.asList(selection.toArray()); selectionContainsWorkingSet = selectedElements.stream() .anyMatch(element -> element instanceof WorkingSet); // try to minimize number of context updates for working set action provider if (selectionContainsWorkingSet) { workingSetActionProvider.setContext(context); } assignWorkingSetsAction.selectionChanged(selection); } }
Example #2
Source File: NavigationActionProvider.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override public void fillContextMenu(IMenuManager menu) { ActionContext con = getContext(); var selection = (IStructuredSelection) con.getSelection(); List<INavigationElement<?>> elements = Viewers.getAll(selection); if (showDbCreate(elements)) { menu.add(new DbCreateAction()); menu.add(new DbImportAction()); if (App.runsInDevMode() && Database.get() == null) { menu.add(new XNexusEcoinventIndexExportAction()); } } if (elements.size() == 1) { registerSingleActions(elements.get(0), menu, actions); } else if (elements.size() > 1) { registerMultiActions(elements, menu, actions); } addCloudMenu(elements, menu); }
Example #3
Source File: FileSearchPage.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override protected void fillContextMenu(IMenuManager mgr) { super.fillContextMenu(mgr); addSortActions(mgr); fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroup.fillContextMenu(mgr); AbstractPythonSearchQuery query = (AbstractPythonSearchQuery) getInput().getQuery(); if (query.getSearchString().length() > 0) { IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection(); if (!selection.isEmpty()) { ReplaceAction replaceSelection = new ReplaceAction(getSite().getShell(), getInput(), selection.toArray(), true); replaceSelection.setText(SearchMessages.ReplaceAction_label_selected); mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelection); } ReplaceAction replaceAll = new ReplaceAction(getSite().getShell(), getInput(), null, true); replaceAll.setText(SearchMessages.ReplaceAction_label_all); mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll); } }
Example #4
Source File: JavaEditorBreadcrumb.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected BreadcrumbViewer createViewer(Composite composite) { fViewer= new ProblemBreadcrumbViewer(composite, SWT.HORIZONTAL); fViewer.setLabelProvider(createLabelProvider()); fViewer.setToolTipLabelProvider(createToolTipLabelProvider()); fViewer.setContentProvider(createContentProvider()); fViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { fBreadcrumbActionGroup.setContext(new ActionContext(fViewer.getSelection())); } }); fBreadcrumbActionGroup= new JavaEditorBreadcrumbActionGroup(getJavaEditor(), fViewer); fElementChangeListener= new ElementChangeListener(); JavaCore.addElementChangedListener(fElementChangeListener); JavaUIHelp.setHelp(fViewer, IJavaHelpContextIds.JAVA_EDITOR_BREADCRUMB); return fViewer; }
Example #5
Source File: CallHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected void fillCallHierarchyViewerContextMenu(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fRefreshSingleElementAction); menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS)); if (fFocusOnSelectionAction.canActionBeAdded()) { menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction); } if (fExpandWithConstructorsAction.canActionBeAdded()) { menu.appendToGroup(GROUP_FOCUS, fExpandWithConstructorsAction); } if (fRemoveFromViewAction.canActionBeAdded()){ menu.appendToGroup(GROUP_FOCUS, fRemoveFromViewAction); } fActionGroups.setContext(new ActionContext(getSelection())); fActionGroups.fillContextMenu(menu); fActionGroups.setContext(null); if (fCopyAction.canActionBeAdded()) { menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, fCopyAction); } }
Example #6
Source File: TypeScriptEditor.java From typescript.java with MIT License | 6 votes |
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW)); ActionContext context = new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); // Quick views IAction action = getAction(ITypeScriptEditorActionDefinitionIds.SHOW_OUTLINE); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); action = getAction(ITypeScriptEditorActionDefinitionIds.OPEN_IMPLEMENTATION); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); }
Example #7
Source File: JavaNavigatorActionProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void setContext(ActionContext context) { super.setContext(context); if (fInViewPart) { fOpenViewGroup.setContext(context); fCCPGroup.setContext(context); fGenerateGroup.setContext(context); fSearchGroup.setContext(context); fBuildPathGroup.setContext(context); } }
Example #8
Source File: N4JSOpenActions.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void setContext(final ActionContext context) { super.setContext(context); selection = null == context ? null : context.getSelection(); if (inViewPart) { openGroup.setContext(context); } }
Example #9
Source File: N4JSWorkingSetActionProvider.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void setContext(final ActionContext context) { super.setContext(context); if (inViewPart) { manageGroup.setContext(context); editGroup.setContext(context); newWizardsGroup.setContext(context); importExportGroup.setContext(context); } }
Example #10
Source File: AbstractSearchIndexResultPage.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override protected void fillContextMenu(IMenuManager mgr) { super.fillContextMenu(mgr); fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroup.fillContextMenu(mgr); AbstractSearchIndexQuery query = (AbstractSearchIndexQuery) getInput().getQuery(); if (query.getSearchString().length() > 0) { IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection(); if (!selection.isEmpty()) { ReplaceAction replaceSelection = new ReplaceAction(getSite().getShell(), getInput(), selection.toArray(), true); replaceSelection.setText(SearchMessages.ReplaceAction_label_selected); mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelection); } ICallback<Boolean, Match> skipMatch = new ICallback<Boolean, Match>() { @Override public Boolean call(Match match) { StructuredViewer viewer = getViewer(); ViewerFilter[] filters = viewer.getFilters(); if (filters == null || filters.length == 0) { return false; } for (ViewerFilter viewerFilter : filters) { if (viewerFilter instanceof AbstractSearchResultsViewerFilter) { AbstractSearchResultsViewerFilter searchResultsViewerFilter = (AbstractSearchResultsViewerFilter) viewerFilter; if (searchResultsViewerFilter.isLeafMatch(viewer, match)) { return false; } } } return true; } }; ReplaceAction replaceAll = new ReplaceAction(getSite().getShell(), getInput(), null, true, skipMatch); replaceAll.setText(SearchMessages.ReplaceAction_label_all); mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll); } }
Example #11
Source File: WorkManagementActionProvider.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void setContext(ActionContext context) { super.setContext(context); if (context != null && context.getSelection() instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) context.getSelection(); addBookmarkAction.selectionChanged(sSel); addTaskAction.selectionChanged(sSel); } else { addBookmarkAction.selectionChanged(StructuredSelection.EMPTY); addTaskAction.selectionChanged(StructuredSelection.EMPTY); } }
Example #12
Source File: WorkManagementActionProvider.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void setContext(ActionContext context) { super.setContext(context); if (context != null && context.getSelection() instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) context.getSelection(); addBookmarkAction.selectionChanged(sSel); addTaskAction.selectionChanged(sSel); } else { addBookmarkAction.selectionChanged(StructuredSelection.EMPTY); addTaskAction.selectionChanged(StructuredSelection.EMPTY); } }
Example #13
Source File: JavaBrowsingPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void menuAboutToShow(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); IStructuredSelection selection= (IStructuredSelection) fViewer.getSelection(); int size= selection.size(); Object element= selection.getFirstElement(); if (size == 1) addOpenNewWindowAction(menu, element); fActionGroups.setContext(new ActionContext(selection)); fActionGroups.fillContextMenu(menu); fActionGroups.setContext(null); }
Example #14
Source File: CompositeActionGroup.java From typescript.java with MIT License | 5 votes |
public void setContext(ActionContext context) { super.setContext(context); if (fGroups == null) return; for (int i= 0; i < fGroups.length; i++) { fGroups[i].setContext(context); } }
Example #15
Source File: PackageExplorerOpenActionProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void setContext(ActionContext context) { super.setContext(context); if (fInViewPart) { fOpenGroup.setContext(context); } }
Example #16
Source File: TypeHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void fillMethodsViewerContextMenu(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); // viewer entries fMethodsViewer.contributeToContextMenu(menu); fActionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroups.fillContextMenu(menu); fActionGroups.setContext(null); }
Example #17
Source File: TypeHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void fillTypesViewerContextMenu(TypeHierarchyViewer viewer, IMenuManager menu) { JavaPlugin.createStandardGroups(menu); menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS)); // viewer entries viewer.contributeToContextMenu(menu); if (fFocusOnSelectionAction.canActionBeAdded()) menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction); menu.appendToGroup(GROUP_FOCUS, fFocusOnTypeAction); fActionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroups.fillContextMenu(menu); fActionGroups.setContext(null); }
Example #18
Source File: CompositeActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void setContext(ActionContext context) { super.setContext(context); if (fGroups == null) return; for (int i= 0; i < fGroups.length; i++) { fGroups[i].setContext(context); } }
Example #19
Source File: ClassFileEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); }
Example #20
Source File: TypeScriptSearchActionGroup.java From typescript.java with MIT License | 5 votes |
public void setContext(ActionContext context) { fReferencesGroup.setContext(context); // fDeclarationsGroup.setContext(context); //// fImplementorsGroup.setContext(context); // fReadAccessGroup.setContext(context); // fWriteAccessGroup.setContext(context); // fOccurrencesGroup.setContext(context); }
Example #21
Source File: JavaSearchActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void setContext(ActionContext context) { fReferencesGroup.setContext(context); fDeclarationsGroup.setContext(context); fImplementorsGroup.setContext(context); fReadAccessGroup.setContext(context); fWriteAccessGroup.setContext(context); fOccurrencesGroup.setContext(context); }
Example #22
Source File: PackageExplorerPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void menuAboutToShow(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); fActionSet.setContext(new ActionContext(getSelection())); fActionSet.fillContextMenu(menu); fActionSet.setContext(null); }
Example #23
Source File: ProjectExplorerOpenActionProvider.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public void setContext(ActionContext context) { super.setContext(context); if (fInViewPart) { fOpenGroup.setContext(context); } }
Example #24
Source File: JavaSearchResultPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected void fillContextMenu(IMenuManager mgr) { super.fillContextMenu(mgr); addSortActions(mgr); mgr.appendToGroup(IContextMenuConstants.GROUP_EDIT, getCopyQualifiedNameAction()); fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroup.fillContextMenu(mgr); }
Example #25
Source File: CompilationUnitEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); }
Example #26
Source File: JavaEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW)); ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); //Breadcrumb IAction action= getAction(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); // Quick views action= getAction(IJavaEditorActionDefinitionIds.SHOW_OUTLINE); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); action= getAction(IJavaEditorActionDefinitionIds.OPEN_HIERARCHY); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); // Copy qualified name action= getAction(IJavaEditorActionConstants.COPY_QUALIFIED_NAME); if (menu.find(ITextEditorActionConstants.COPY) != null) menu.insertAfter(ITextEditorActionConstants.COPY, action); else addAction(menu, ITextEditorActionConstants.GROUP_COPY, IJavaEditorActionConstants.COPY_QUALIFIED_NAME); }
Example #27
Source File: AppEngineActionProvider.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** Provides opportunity for actions to update based on current selection. */ @Override public void setContext(ActionContext context) { if (context != null && context.getSelection() instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) context.getSelection(); openFileAction.selectionChanged(selection); } }
Example #28
Source File: JavaOutlinePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected void contextMenuAboutToShow(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); IStructuredSelection selection= (IStructuredSelection)getSelection(); fActionGroups.setContext(new ActionContext(selection)); fActionGroups.fillContextMenu(menu); }
Example #29
Source File: UndoRedoActionProvider.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
public void setContext(ActionContext context) { undoRedoGroup.setContext(context); }
Example #30
Source File: RefactorActionProvider.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
public void setContext(ActionContext context) { refactorGroup.setContext(context); }