List of usage examples for org.eclipse.jface.action GroupMarker getGroupName
public String getGroupName()
From source file:org.kalypso.metadoc.ui.ExportActionContributor.java
License:Open Source License
/** * Fills the export actions into the given target-editor * * @param mode/*from w w w .j a v a 2s . c om*/ * the mode (in the sense of the org.kalypso.metadoc.exportTarget) which denotes which kind of perspective * should be supported by the extension. Optional, can be null, which means take all targets. */ public static ExportAction[] contributeActions(final IEditorPart targetEditor, final String menuPath, final String toolbarGroup, final String mode) { try { final IActionBars actionBars = targetEditor.getEditorSite().getActionBars(); final ExportAction[] actions = createActions(targetEditor, mode); final IMenuManager menuManager = actionBars.getMenuManager(); final IContributionItem menuItem = menuManager.findUsingPath(menuPath); final IToolBarManager toolBarManager = actionBars.getToolBarManager(); for (final ExportAction action : actions) { if (menuItem != null) { if (menuItem instanceof GroupMarker) { final GroupMarker marker = (GroupMarker) menuItem; final IContributionManager parent = marker.getParent(); parent.appendToGroup(marker.getGroupName(), action); } else if (menuItem instanceof IMenuManager) { final IMenuManager mm = (IMenuManager) menuItem; mm.add(action); } } if (toolBarManager != null) toolBarManager.appendToGroup(toolbarGroup, action); } return actions; } catch (final CoreException e) { e.printStackTrace(); ErrorDialog.openError(targetEditor.getSite().getShell(), "Export Targets laden", "Fehler beim Laden der Export Targets", e.getStatus()); return null; } }
From source file:org.openmaji.implementation.tool.eclipse.browser.relationship.space.SpaceBrowserView.java
License:Open Source License
protected void removeMergedMenuItems() { IMenuManager menuMgr = ((WorkbenchWindow) MajiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()) .getMenuBarManager();//w w w . ja v a 2 s .co m menuMgr = menuMgr.findMenuUsingPath("InterMajik"); boolean startRemoving = false; IContributionItem[] items = menuMgr.getItems(); for (int i = 0; i < items.length; i++) { IContributionItem item = items[i]; //if(item.getId() == null) continue; if (item instanceof GroupMarker) { GroupMarker marker = (GroupMarker) item; if (marker.getGroupName().equals(MajiPlugin.GROUP_START)) { startRemoving = true; } else if (marker.getGroupName().equals(MajiPlugin.GROUP_END)) { break; } } else if (startRemoving) { menuMgr.remove(item); } } }