Java Code Examples for org.eclipse.jface.action.MenuManager#setActionDefinitionId()
The following examples show how to use
org.eclipse.jface.action.MenuManager#setActionDefinitionId() .
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: RefactorActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void addRefactorSubmenu(IMenuManager menu) { MenuManager refactorSubmenu= new MenuManager(ActionMessages.RefactorMenu_label, MENU_ID); refactorSubmenu.setActionDefinitionId(QUICK_MENU_ID); if (fEditor != null) { final ITypeRoot element= getEditorInput(); if (element != null && ActionUtil.isOnBuildPath(element)) { refactorSubmenu.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { refactorMenuShown(manager); } }); refactorSubmenu.add(fNoActionAvailable); menu.appendToGroup(fGroupName, refactorSubmenu); } } else { ISelection selection= fSelectionProvider.getSelection(); for (Iterator<SelectionDispatchAction> iter= fActions.iterator(); iter.hasNext(); ) { iter.next().update(selection); } if (fillRefactorMenu(refactorSubmenu) > 0) menu.appendToGroup(fGroupName, refactorSubmenu); } }
Example 2
Source File: GenerateActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); MenuManager subMenu= new MenuManager(ActionMessages.SourceMenu_label, MENU_ID); subMenu.setActionDefinitionId(QUICK_MENU_ID); int added= 0; if (isEditorOwner()) { added= fillEditorSubMenu(subMenu); } else { added= fillViewSubMenu(subMenu); } if (added > 0) menu.appendToGroup(fGroupName, subMenu); }
Example 3
Source File: SurroundWithActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * The Menu to show when right click on the editor * {@inheritDoc} */ @Override public void fillContextMenu(IMenuManager menu) { ISelectionProvider selectionProvider= fEditor.getSelectionProvider(); if (selectionProvider == null) return; ISelection selection= selectionProvider.getSelection(); if (!(selection instanceof ITextSelection)) return; ITextSelection textSelection= (ITextSelection)selection; if (textSelection.getLength() == 0) return; String menuText= ActionMessages.SurroundWithTemplateMenuAction_SurroundWithTemplateSubMenuName; MenuManager subMenu = new MenuManager(menuText, SurroundWithTemplateMenuAction.SURROUND_WITH_QUICK_MENU_ACTION_ID); subMenu.setActionDefinitionId(SurroundWithTemplateMenuAction.SURROUND_WITH_QUICK_MENU_ACTION_ID); menu.appendToGroup(fGroup, subMenu); subMenu.add(new Action() {}); subMenu.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { manager.removeAll(); SurroundWithTemplateMenuAction.fillMenu(manager, fEditor, fSurroundWithTryCatchAction, fSurroundWithTryMultiCatchAction); } }); }
Example 4
Source File: GamaActionBarAdvisor.java From gama with GNU General Public License v3.0 | 4 votes |
/** * Creates and returns the File menu. */ private MenuManager createFileMenu() { final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); { // create the New submenu, using the same id for it as the New action final String newText = IDEWorkbenchMessages.Workbench_new; final String newId = ActionFactory.NEW.getId(); final MenuManager newMenu = new MenuManager(newText, newId); newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$ newMenu.setImageDescriptor(icons.desc("navigator/navigator.new2")); newMenu.add(new Separator(newId)); this.newWizardMenu = new BaseNewWizardMenu(getWindow(), null) { @Override protected void addItems(final List list) { addShortcuts(list); } }; newMenu.add(this.newWizardMenu); newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(newMenu); } menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(new Separator()); menu.add(closeAction); menu.add(closeAllAction); menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); menu.add(new Separator()); menu.add(saveAction); menu.add(saveAsAction); menu.add(saveAllAction); // menu.add(getRevertItem()); menu.add(new Separator()); menu.add(getMoveItem()); menu.add(getRenameItem()); menu.add(getRefreshItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT)); menu.add(new Separator()); menu.add(getPrintItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT)); menu.add(new Separator()); menu.add(openWorkspaceAction); menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator()); menu.add(getPropertiesItem()); menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow())); menu.add(new GroupMarker(IWorkbenchActionConstants.MRU)); menu.add(new Separator()); // If we're on OS X we shouldn't show this command in the File menu. It // should be invisible to the user. However, we should not remove it - // the carbon UI code will do a search through our menu structure // looking for it when Cmd-Q is invoked (or Quit is chosen from the // application menu. final ActionContributionItem quitItem = new ActionContributionItem(quitAction); quitItem.setVisible(!Util.isMac()); menu.add(quitItem); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }