Java Code Examples for org.eclipse.ui.menus.CommandContributionItem#STYLE_PUSH
The following examples show how to use
org.eclipse.ui.menus.CommandContributionItem#STYLE_PUSH .
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: OpenFileManagerContributionItem.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
@Override protected IContributionItem[] getContributionItems() { CommandContributionItemParameter ccip = new CommandContributionItemParameter(PlatformUI.getWorkbench() .getActiveWorkbenchWindow(), null, "com.aptana.ui.command.ShowInFileManager", //$NON-NLS-1$ CommandContributionItem.STYLE_PUSH); if (Platform.getOS().equals(Platform.OS_MACOSX)) { ccip.label = Messages.OpenFileManagerContributionItem_FinderLabel; ccip.icon = UIPlugin.getImageDescriptor("icons/finder.png"); //$NON-NLS-1$ } else if (Platform.getOS().equals(Platform.OS_WIN32)) { ccip.label = Messages.OpenFileManagerContributionItem_WindowsExplorerLabel; ccip.icon = UIPlugin.getImageDescriptor("icons/windows_explorer.png"); //$NON-NLS-1$ } else { ccip.label = Messages.OpenFileManagerContributionItem_FileBrowserLabel; } return new IContributionItem[] { new CommandContributionItem(ccip) }; }
Example 2
Source File: ModelContributionItem.java From tlaplus with MIT License | 5 votes |
/** * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems() */ protected IContributionItem[] getContributionItems() { final Vector<CommandContributionItem> modelContributions = new Vector<CommandContributionItem>(); Spec currentSpec = ToolboxHandle.getCurrentSpec(); if (currentSpec == null) { return new IContributionItem[0]; } // First, search for all models for the given spec. final Set<String> modelNames = currentSpec.getAdapter(TLCSpec.class).getModels().keySet(); for (String modelName : modelNames) { Map<String, String> parameters = new HashMap<String, String>(); // fill the model name for the handler parameters.put(OpenModelHandler.PARAM_MODEL_NAME, modelName); // create the contribution item CommandContributionItemParameter param = new CommandContributionItemParameter(UIHelper .getActiveWindow(), "toolbox.command.model.open." + modelName, OpenModelHandler.COMMAND_ID, parameters, modelIcon, null, null, modelName, null, "Opens " + modelName, CommandContributionItem.STYLE_PUSH, null, true); // add contribution item to the list modelContributions.add(new CommandContributionItem(param)); } return modelContributions.toArray(new IContributionItem[modelContributions.size()]); }
Example 3
Source File: SelectElementTypeContributionItem.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void addContributionItem(List<IContributionItem> list, String traceTypeId, String label, boolean selected, MenuManager subMenu) { Map<String, String> params = new HashMap<>(); params.put(TYPE_PARAMETER, traceTypeId); ImageDescriptor icon = null; if (selected) { icon = SELECTED_ICON; } CommandContributionItemParameter param = new CommandContributionItemParameter( PlatformUI.getWorkbench().getActiveWorkbenchWindow(), // serviceLocator "my.parameterid", // id //$NON-NLS-1$ getContributionItemCommandId(), // commandId CommandContributionItem.STYLE_PUSH // style ); param.parameters = params; param.icon = icon; param.disabledIcon = icon; param.hoverIcon = icon; param.label = label; param.visibleEnabled = true; if (subMenu != null) { CommandContributionItem item = new CommandContributionItem(param); int i = Collections.binarySearch(Arrays.asList(subMenu.getItems()), item, ITEM_COMPARATOR); i = (i >= 0) ? i : -i - 1; subMenu.insert(i, item); } else { list.add(new CommandContributionItem(param)); } }
Example 4
Source File: WizardMenuContributions.java From depan with Apache License 2.0 | 5 votes |
private IContributionItem buildWizardItem( IServiceLocator srvcLocator, String planId, LayoutPlanDocument<? extends LayoutPlan> planDoc) { String name = planDoc.getName(); String id = MessageFormat.format("{0}.{1}", MENU_ROOT, name); int style = CommandContributionItem.STYLE_PUSH; Map<String, String> parameters = LayoutNodesHandler.buildParameters(planId); IContributionItem result = new CommandContributionItem( new CommandContributionItemParameter(srvcLocator, id, LayoutNodesHandler.LAYOUT_COMMAND, parameters, null, null, null, name, null, null, style, null, false)); return result; }
Example 5
Source File: GamaActionBarAdvisor.java From gama with GNU General Public License v3.0 | 5 votes |
private IContributionItem getItem(final String actionId, final String commandId, final String image, final String disabledImage, final String label, final String tooltip, final String helpContextId) { final IActionCommandMappingService acms = getWindow().getService(IActionCommandMappingService.class); acms.map(actionId, commandId); final CommandContributionItemParameter commandParm = new CommandContributionItemParameter(getWindow(), actionId, commandId, null, image != null ? icons.desc(image) : null, null, null, label, null, tooltip, CommandContributionItem.STYLE_PUSH, null, false); return new CommandContributionItem(commandParm); }
Example 6
Source File: CommandsHelper.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public static CommandContributionItemParameter contribItemParameter(IServiceLocator svLocator, String commandId) { return new CommandContributionItemParameter(svLocator, commandId, commandId, CommandContributionItem.STYLE_PUSH ); }
Example 7
Source File: CommandsHelper.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public static CommandContributionItemParameter contribItemParameter2(IServiceLocator svLocator, String commandId, ImageDescriptor icon) { CommandContributionItemParameter cip = new CommandContributionItemParameter(svLocator, commandId, commandId, CommandContributionItem.STYLE_PUSH ); cip.icon = icon; return cip; }
Example 8
Source File: CommandsHelper.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public static CommandContributionItemParameter contribItemParameter(IServiceLocator svLocator, String commandId, String contribId) { return new CommandContributionItemParameter(svLocator, contribId, commandId, CommandContributionItem.STYLE_PUSH ); }
Example 9
Source File: ListSubprocessContributionItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected IContributionItem[] getContributionItems() { final List<IContributionItem> res = new ArrayList<IContributionItem>(); IRepository repository = RepositoryManager.getInstance().getCurrentRepository() ; diagramSotre = (DiagramRepositoryStore) repository.getRepositoryStore(DiagramRepositoryStore.class) ; try { for(AbstractProcess process : diagramSotre.getAllProcesses()){ if (process.getName().equals(subprocessName)) { Map<String, String> params = new HashMap<String, String>(); params.put(OpenSpecificProcessCommand.PARAMETER_PROCESS_NAME, process.getName()); params.put(OpenSpecificProcessCommand.PARAMETER_PROCESS_VERSION, process.getVersion()); CommandContributionItemParameter param = new CommandContributionItemParameter(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), null, OpenSpecificProcessCommand.ID, CommandContributionItem.STYLE_PUSH); param.parameters = params; param.label = process.getVersion(); param.visibleEnabled = true; param.commandId = OpenSpecificProcessCommand.ID; CommandContributionItem commandContributionItem = new CommandContributionItem(param); commandContributionItem.setVisible(true); res.add(commandContributionItem); } } } catch (Exception ex) { BonitaStudioLog.error(ex); } return res.toArray(new IContributionItem[res.size()]); }