Java Code Examples for org.eclipse.jface.action.IMenuManager#appendToGroup()
The following examples show how to use
org.eclipse.jface.action.IMenuManager#appendToGroup() .
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: 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 2
Source File: PortingActionProvider.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private void addImportMenu(IMenuManager aMenu) { importWizardActionGroup.setContext(getContext()); if (importWizardActionGroup.getWizardActionIds().length == 0) { aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction); return; } IMenuManager submenu = new MenuManager( WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label, COMMON_NAVIGATOR_IMPORT_MENU); importWizardActionGroup.fillContextMenu(submenu); submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS)); submenu.add(new Separator()); submenu.add(importAction); aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu); }
Example 3
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 4
Source File: MenuProvider.java From olca-app with Mozilla Public License 2.0 | 6 votes |
/** Undo, Redo, and Delete */ private void addEditActions(final IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); IAction undoAction = registry.getAction(ActionFactory.UNDO.getId()); undoAction.setImageDescriptor(Icon.UNDO.descriptor()); undoAction.setDisabledImageDescriptor(Icon.UNDO_DISABLED.descriptor()); IAction redoAction = registry.getAction(ActionFactory.REDO.getId()); redoAction.setImageDescriptor(Icon.REDO.descriptor()); redoAction.setDisabledImageDescriptor(Icon.REDO_DISABLED.descriptor()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, undoAction); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, redoAction); IAction deleteAction = registry.getAction(ActionFactory.DELETE.getId()); deleteAction.setText(M.Delete); deleteAction.setImageDescriptor(Icon.DELETE.descriptor()); deleteAction.setDisabledImageDescriptor(Icon.DELETE_DISABLED.descriptor()); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, deleteAction); }
Example 5
Source File: OpenEditorActionGroup.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
private void addOpenWithMenu(IMenuManager menu) { ISelection selection= getContext().getSelection(); if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) return; IStructuredSelection ss= (IStructuredSelection)selection; if (ss.size() != 1) return; Object o= ss.getFirstElement(); if (!(o instanceof IAdaptable)) return; IAdaptable element= (IAdaptable)o; Object resource= element.getAdapter(IResource.class); if (!(resource instanceof IFile)) return; // Create a menu. IMenuManager submenu= new MenuManager("Open With"); submenu.add(new OpenWithMenu(fSite.getPage(), (IFile) resource)); // Add the submenu. menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu); }
Example 6
Source File: EditActionGroup.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public void fillContextMenu(IMenuManager menu) { IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); boolean anyResourceSelected = !selection.isEmpty() && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER | IResource.FILE); copyAction.selectionChanged(selection); // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyAction); pasteAction.selectionChanged(selection); // menu.insertAfter(copyAction.getId(), pasteAction); // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, pasteAction); if (anyResourceSelected) { deleteAction.selectionChanged(selection); // menu.insertAfter(pasteAction.getId(), deleteAction); menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, deleteAction); } }
Example 7
Source File: PortingActionProvider.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private void addExportMenu(IMenuManager aMenu) { exportWizardActionGroup.setContext(getContext()); if (exportWizardActionGroup.getWizardActionIds().length == 0) { aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, exportAction); return; } IMenuManager submenu = new MenuManager( WorkbenchNavigatorMessages.PortingActionProvider_ExportResourcesMenu_label, COMMON_NAVIGATOR_EXPORT_MENU); exportWizardActionGroup.fillContextMenu(submenu); submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS)); submenu.add(new Separator()); submenu.add(exportAction); aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu); }
Example 8
Source File: GenerateBuildPathActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); if (!canOperateOnSelection()) return; String menuText= ActionMessages.BuildPath_label; IMenuManager subMenu= new MenuManager(menuText, MENU_ID); subMenu.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { fillViewSubMenu(manager); } }); subMenu.setRemoveAllWhenShown(true); subMenu.add(new ConfigureBuildPathAction(fSite)); menu.appendToGroup(fGroupName, subMenu); }
Example 9
Source File: EditorRulerContextMenuProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
public void buildContextMenu( IMenuManager menu ) { GEFActionConstants.addStandardActionGroups( menu ); IChoiceSet choiceSet = null; choiceSet = ChoiceSetFactory.getElementChoiceSet( ReportDesignConstants.REPORT_DESIGN_ELEMENT, ReportDesignHandle.UNITS_PROP ); if (choiceSet == null ) { return ; } int len = choiceSet.getChoices().length; for (int i=0; i<len; i++) { IChoice ch = choiceSet.getChoices()[i]; ChangeRulerUnitAction action = new ChangeRulerUnitAction(ch.getName(), ch.getDisplayName()); menu.appendToGroup( GEFActionConstants.GROUP_ADD, action ); } }
Example 10
Source File: AnnotationEditor.java From uima-uimaj with Apache License 2.0 | 5 votes |
@Override protected void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); // Add Annotate action menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator()); menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(SmartAnnotateAction.ID)); menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(QuickAnnotateAction.ID)); menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(IWorkbenchActionDefinitionIds.DELETE)); TypeSystem typeSystem = getDocument().getCAS().getTypeSystem(); // mode menu MenuManager modeMenuManager = new MenuManager("Mode"); menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, modeMenuManager); ModeMenu modeMenu = new ModeMenu(typeSystem, this); modeMenu.addListener(new IModeMenuListener(){ @Override public void modeChanged(Type newMode) { IAction actionToExecute = new ChangeModeAction(newMode, newMode.getShortName(), AnnotationEditor.this); actionToExecute.run(); }}); modeMenuManager.add(modeMenu); // annotation menu MenuManager showAnnotationMenu = new MenuManager("Show Annotations"); menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, showAnnotationMenu); showAnnotationMenu.add(mShowAnnotationsMenu); // view menu MenuManager casViewMenuManager = new MenuManager("CAS Views"); menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, casViewMenuManager); CasViewMenu casViewMenu = new CasViewMenu(this); casViewMenuManager.add(casViewMenu); }
Example 11
Source File: LangEditorActionContributor.java From goclipse with Eclipse Public License 1.0 | 5 votes |
protected void prepareEditMenu(IMenuManager menu) { IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); if(editMenu != null) { editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, pushItem( ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, ITextEditorActionConstants.CONTENT_ASSIST)); editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, pushItem( ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION, ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION)); } }
Example 12
Source File: JavaSearchResultPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void addSortActions(IMenuManager mgr) { if (getLayout() != FLAG_LAYOUT_FLAT) return; MenuManager sortMenu= new MenuManager(SearchMessages.JavaSearchResultPage_sortBylabel); sortMenu.add(fSortByNameAction); sortMenu.add(fSortByPathAction); sortMenu.add(fSortByParentName); fSortByNameAction.setChecked(fCurrentSortOrder == fSortByNameAction.getSortOrder()); fSortByPathAction.setChecked(fCurrentSortOrder == fSortByPathAction.getSortOrder()); fSortByParentName.setChecked(fCurrentSortOrder == fSortByParentName.getSortOrder()); mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu); }
Example 13
Source File: GamlActionProvider.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void fillContextMenu(final IMenuManager menu) { super.fillContextMenu(menu); if (selection == null) return; menu.add(new Separator()); if (selection instanceof WrappedExperimentContent) { menu.appendToGroup("group.copy", runAction); } menu.appendToGroup("group.copy", revealAction); }
Example 14
Source File: LocalHistoryActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); IMenuManager localMenu= new MenuManager(CompareMessages.LocalHistoryActionGroup_menu_local_history); int added= 0; added+= addAction(localMenu, fCompareWith); added+= addAction(localMenu, fReplaceWithPrevious); added+= addAction(localMenu, fReplaceWith); added+= addAction(localMenu, fAddFrom); if (added > 0) menu.appendToGroup(fGroupName, localMenu); }
Example 15
Source File: JSActionContributor.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
@Override public void contributeToMenu(IMenuManager menu) { super.contributeToMenu(menu); IMenuManager navigateMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE); if (navigateMenu != null) { navigateMenu.appendToGroup(IWorkbenchActionConstants.OPEN_EXT, fOpenDeclaration); } }
Example 16
Source File: OpenActionProvider.java From gama with GNU General Public License v3.0 | 5 votes |
private void addOpenWithMenu(final IMenuManager aMenu) { final IStructuredSelection ss = (IStructuredSelection) getContext().getSelection(); if (ss == null || ss.size() != 1) { return; } final Object o = ss.getFirstElement(); // first try IResource IAdaptable openable = CloseResourceAction.getAdapter(o, IResource.class); // otherwise try ResourceMapping if (openable == null) { openable = CloseResourceAction.getAdapter(o, ResourceMapping.class); } else if (((IResource) openable).getType() != IResource.FILE) { openable = null; } if (openable != null) { // Create a menu flyout. final IMenuManager submenu = new MenuManager(WorkbenchNavigatorMessages.OpenActionProvider_OpenWithMenu_label, ICommonMenuConstants.GROUP_OPEN_WITH); submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_TOP)); submenu.add(new OpenWithMenu(viewSite.getPage(), openable)); submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_ADDITIONS)); // Add the submenu. if (submenu.getItems().length > 2 && submenu.isEnabled()) { aMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN_WITH, submenu); } } }
Example 17
Source File: PythonRefactorActionProvider.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void fillContextMenu(IMenuManager menu) { if (renameResourceAction.isEnabled()) { menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, renameResourceAction); } }
Example 18
Source File: FileSearchPage.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void init(IPageSite site) { super.init(site); IMenuManager menuManager = site.getActionBars().getMenuManager(); menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new OpenSearchPreferencesAction()); }
Example 19
Source File: WorkingSetShowActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void addAction(IMenuManager menuManager, Action action) { IContributionItem item= new ActionContributionItem(action); menuManager.appendToGroup(ACTION_GROUP, item); fContributions.add(item); }
Example 20
Source File: JavaEditorBreadcrumbActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void fillContextMenu(IMenuManager menu) { if (fAssignWorkingSetAction.isEnabled()) menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, fAssignWorkingSetAction); }