org.eclipse.ui.menus.IContributionRoot Java Examples
The following examples show how to use
org.eclipse.ui.menus.IContributionRoot.
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: ReviewMarkerContributionFactory.java From git-appraise-eclipse with Eclipse Public License 1.0 | 6 votes |
@Override public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { ITextEditor editor = (ITextEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); IVerticalRulerInfo rulerInfo = editor.getAdapter(IVerticalRulerInfo.class); try { List<IMarker> markers = getMarkers(editor, rulerInfo); additions.addContributionItem(new ReviewMarkerMenuContribution(editor, markers), null); if (!markers.isEmpty()) { additions.addContributionItem(new Separator(), null); } } catch (CoreException e) { AppraiseUiPlugin.logError("Error creating marker context menus", e); } }
Example #2
Source File: DefineCommands.java From EasyShell with Eclipse Public License 2.0 | 6 votes |
@Override public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { MenuDataList items = MenuDataStore.instance().getEnabledCommandMenuDataList(); for (MenuData item : items) { ResourceType resTypeWanted = getWantedResourceType(); ResourceType resTypeSupported; try { resTypeSupported = item.getCommandData().getResourceType(); if ((resTypeSupported == ResourceType.resourceTypeFileOrDirectory) || (resTypeSupported == resTypeWanted)) { addItem(serviceLocator, additions, item.getNameExpanded(), "de.anbos.eclipse.easyshell.plugin.commands.execute", Utils.getParameterMapFromMenuData(item), item.getImageId(), true); } } catch (UnknownCommandID e) { e.logInternalError(); } } }
Example #3
Source File: TextEditorContextContributionFactory.java From git-appraise-eclipse with Eclipse Public License 1.0 | 5 votes |
@Override public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { ITextEditor editor = (ITextEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); additions.addContributionItem(new TextEditorContextMenuContribution(editor), null); }
Example #4
Source File: DefineCommands.java From EasyShell with Eclipse Public License 2.0 | 5 votes |
private void addItem(IServiceLocator serviceLocator, IContributionRoot additions, String commandLabel, String commandId, Map<String, Object> commandParamametersMap, String commandImageId, boolean visible) { CommandContributionItemParameter param = new CommandContributionItemParameter(serviceLocator, "", commandId, SWT.PUSH); param.label = commandLabel; param.icon = Activator.getImageDescriptor(commandImageId); param.parameters = commandParamametersMap; CommandContributionItem item = new CommandContributionItem(param); item.setVisible(visible); additions.addContributionItem(item, null); }
Example #5
Source File: ICEExtensionContributionFactory.java From ice with Eclipse Public License 1.0 | 4 votes |
@Override public void createContributionItems(IServiceLocator serviceLoc, IContributionRoot additions) { // Local Declarations HashMap<String, MenuManager> categoryMenus = new HashMap<String, MenuManager>(); String codeName = "", category = ""; MenuManager codeMenu = null; // Set the ServiceLocator serviceLocator = serviceLoc; // Create the Developer Menu Item developerMenu = new MenuManager("&Developer", "iceDev"); // Get the registry and the extensions registry = Platform.getExtensionRegistry(); // Create the category sub-menus for (CodeCategory c : CodeCategory.values()) { MenuManager manager = new MenuManager(c.name(), c.name() + "ID"); manager.setVisible(true); categoryMenus.put(c.name(), manager); developerMenu.add(manager); } // Get the Extension Points IExtensionPoint extensionPoint = registry.getExtensionPoint("org.eclipse.ice.developer.code"); IExtension[] codeExtensions = extensionPoint.getExtensions(); // Loop over the rest of the Extensions and create // their sub-menus. for (IExtension code : codeExtensions) { // Get the name of the bundle this extension comes from // so we can instantiate its AbstractHandlers String contributingPlugin = code.getContributor().getName(); // Get the elements of this extension IConfigurationElement[] elements = code.getConfigurationElements(); for (IConfigurationElement e : elements) { // Get the Code Name codeName = e.getAttribute("codeName"); // Get whether this is the ICE declaration boolean isICE = "ICE".equals(codeName); // Get the Code Category - Framework, Physics, etc... category = isICE ? codeName : e.getAttribute("codeCategory"); // Create a sub menu for the code in the // correct category, if this is not ICE ( we've already done it for ICE) codeMenu = isICE ? categoryMenus.get(codeName) : new MenuManager(codeName, codeName + "ID"); // Generate the IParameters for the Command generateParameters(e); // Create a menu item for each extra command they provided for (IConfigurationElement command : e.getChildren("command")) { generateParameters(command); createCommand(contributingPlugin, command.getAttribute("implementation"), codeMenu); } // Add it to the correct category menu if (!"ICE".equals(codeName)) { categoryMenus.get(category).add(codeMenu); } } parameters.clear(); } // Add the newly constructed developer menu additions.addContributionItem(developerMenu, null); return; }