Java Code Examples for org.eclipse.jface.action.IMenuManager#find()
The following examples show how to use
org.eclipse.jface.action.IMenuManager#find() .
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: WorkingSetFilterActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Adds the filter actions to the menu * * @param mm the menu manager */ public void fillViewMenu(IMenuManager mm) { if (mm.find(IWorkingSetActionGroup.ACTION_GROUP) == null) { mm.add(new Separator(IWorkingSetActionGroup.ACTION_GROUP)); } add(mm, fSelectWorkingSetAction); add(mm, fClearWorkingSetAction); add(mm, fEditWorkingSetAction); add(mm, new Separator()); add(mm, new Separator(LRU_GROUP)); fMenuManager= mm; fMenuListener= new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { removePreviousLRUWorkingSetActions(manager); addLRUWorkingSetActions(manager); } }; fMenuManager.addMenuListener(fMenuListener); }
Example 2
Source File: N4JSEditor.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override protected void editorContextMenuAboutToShow(final IMenuManager menu) { super.editorContextMenuAboutToShow(menu); final IContributionItem[] items = menu.getItems(); for (int i = 0; i < items.length; i++) { if (items[i] instanceof IMenuManager) { final IMenuManager subMenu = (IMenuManager) items[i]; final IContributionItem testShowIn = subMenu.find(ContributionItemFactory.VIEWS_SHOW_IN.getId()); if (null != testShowIn) { menu.remove(subMenu); } } } }
Example 3
Source File: ProjectExplorerActionProvider.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public void fillActionBars(IActionBars actionBars) { IMenuManager viewMenu = actionBars.getMenuManager(); ICommonActionExtensionSite site = getActionSite(); IContributionItem contributionItem = viewMenu.find(ShowResourcesContribution.ID); if (contributionItem != null) { viewMenu.remove(contributionItem); } if (ProjectUtils.isWorkspaceContainsXdsProjects()) { viewMenu.add(new ShowResourcesContribution(site.getStructuredViewer(), site.getExtensionStateModel())); } }
Example 4
Source File: SDView.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Enables or disables the Pages... menu item, depending on the number of pages * * @param bar the bar containing the action */ protected void updatePagesMenuItem(IActionBars bar) { if (fSdPagingProvider instanceof ISDAdvancedPagingProvider) { IMenuManager menuManager = bar.getMenuManager(); ActionContributionItem contributionItem = (ActionContributionItem) menuManager.find(OpenSDPagesDialog.ID); IAction openSDPagesDialog = null; if (contributionItem != null) { openSDPagesDialog = contributionItem.getAction(); } if (openSDPagesDialog instanceof OpenSDPagesDialog) { openSDPagesDialog.setEnabled(((ISDAdvancedPagingProvider) fSdPagingProvider).pagesCount() > 1); } } }
Example 5
Source File: MemberFilterActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Adds the filter actions to the given menu manager. * * @param menu the menu manager to which the actions are added * @since 2.1 */ public void contributeToViewMenu(IMenuManager menu) { if (!fInViewMenu) return; final String filters= "filters"; //$NON-NLS-1$ if (menu.find(filters) != null) { for (int i= 0; i < fFilterActions.length; i++) { menu.prependToGroup(filters, fFilterActions[i]); } } else { for (int i= 0; i < fFilterActions.length; i++) { menu.add(fFilterActions[i]); } } }
Example 6
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); }