private static void changeIcon(final IMenuManager menu, final IContributionItem item, final ImageDescriptor image) { if (item instanceof ActionContributionItem) { ((ActionContributionItem) item).getAction().setImageDescriptor(image); } else if (item instanceof CommandContributionItem) { final CommandContributionItemParameter data = ((CommandContributionItem) item).getData(); data.commandId = ((CommandContributionItem) item).getCommand().getId(); data.icon = image; final CommandContributionItem newItem = new CommandContributionItem(data); newItem.setId(item.getId()); menu.insertAfter(item.getId(), newItem); menu.remove(item); item.dispose(); } else if (item instanceof ActionSetContributionItem) { changeIcon(menu, ((ActionSetContributionItem) item).getInnerItem(), image); } else if (item instanceof MenuManager) { ((MenuManager) item).setImageDescriptor(image); } }
/** * Create the context menu for the text widget. * * @since 3.4 */ private void createTextMenu() { final MenuManager textManager = new MenuManager(); textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, IWorkbenchCommandConstants.EDIT_COPY, CommandContributionItem.STYLE_PUSH))); textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, IWorkbenchCommandConstants.EDIT_SELECT_ALL, CommandContributionItem.STYLE_PUSH))); text.setMenu(textManager.createContextMenu(text)); text.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { textManager.dispose(); } }); }
@Override public IContributionItem[] getContributionItems() { List<IContributionItem> items = new ArrayList<>(); ProcessorInfo currentProcessor = ManagementCatalogue.getInstance().getCurrentProcessorInfo(); items.add(createProcessorItem(currentProcessor)); items.add(new Separator()); String instance = ManagementCatalogue.getCurrentYamcsInstance(); List<ProcessorInfo> processors = ManagementCatalogue.getInstance().getProcessors(instance); Collections.sort(processors, (p1, p2) -> p1.getName().compareTo(p2.getName())); processors.forEach(processor -> { if (!processor.getName().equals(currentProcessor.getName())) { CommandContributionItem item = createProcessorItem(processor); items.add(item); } }); updateSelection(); return items.toArray(new IContributionItem[0]); }
@Override protected IContributionItem[] getContributionItems() { File[] files = GpsQuickImportFiles.getGpsFiles(); if (files.length == 0) { return new IContributionItem[] { new ContributionItem() { @Override public void fill(Menu menu, int index) { MenuItem item = new MenuItem(menu, 0); item.setText("No files available"); } } }; } IContributionItem[] result = new IContributionItem[files.length]; for (int i = 0; i < result.length; i++) { CommandContributionItemParameter parameter = new CommandContributionItemParameter( serviceLocator, "com.genuitec.eclipse.gerrit.tools.quickImportProjects." + i, //$NON-NLS-1$ "com.genuitec.eclipse.gerrit.tools.importProjects", SWT.PUSH); //$NON-NLS-1$ parameter.parameters = Collections.singletonMap("file", files[i].toString()); //$NON-NLS-1$ parameter.label = files[i].getName(); result[i] = new CommandContributionItem(parameter); } return result; }
@Override public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { CommandContributionItemParameter toggleWatchpointParam = new CommandContributionItemParameter(serviceLocator, null, "org.eclipse.debug.ui.commands.ToggleWatchpoint", CommandContributionItem.STYLE_PUSH); toggleWatchpointParam.icon = DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_WATCHPOINT); toggleWatchpointParam.disabledIcon = DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_WATCHPOINT_DISABLED); toggleWatchpointParam.label = "Add Watchpoint"; CommandContributionItem toggleWatchpoint = new CommandContributionItem(toggleWatchpointParam); Expression toggleWatchpointVisible = new Expression() { @Override public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { return EvaluationResult.valueOf((context.getVariable("activeEditor") instanceof BfEditor)); } }; additions.addContributionItem(toggleWatchpoint, toggleWatchpointVisible); }
private IContributionItem getItem(String actionId, String commandId, String image, String disabledImage, String label, String tooltip, String helpContextId) { ISharedImages sharedImages = getWindow().getWorkbench() .getSharedImages(); IActionCommandMappingService acms = (IActionCommandMappingService) getWindow() .getService(IActionCommandMappingService.class); acms.map(actionId, commandId); CommandContributionItemParameter commandParm = new CommandContributionItemParameter( getWindow(), actionId, commandId, null, sharedImages.getImageDescriptor(image), sharedImages.getImageDescriptor(disabledImage), null, label, null, tooltip, CommandContributionItem.STYLE_PUSH, null, false); return new CommandContributionItem(commandParm); }
private IContributionItem getItem(String actionId, String commandId, String image, String disabledImage, String label, String tooltip, String helpContextId) { ISharedImages sharedImages = getWindow().getWorkbench().getSharedImages(); IActionCommandMappingService acms = (IActionCommandMappingService) getWindow().getService( IActionCommandMappingService.class); acms.map(actionId, commandId); CommandContributionItemParameter commandParm = new CommandContributionItemParameter(getWindow(), actionId, commandId, null, sharedImages.getImageDescriptor(image), sharedImages.getImageDescriptor(disabledImage), null, label, null, tooltip, CommandContributionItem.STYLE_PUSH, null, false); return new CommandContributionItem(commandParm); }
@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) }; }
@Override public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { for (PlanModifierFactory factory : PlanModifierRegistry.getInstance().getModifierFactories()) { String name = factory.getName(); ImageDescriptor imageDescriptor = factory.getImageDescriptor(); String id = null; String commandId = TEMPORAL_MODIFICATION_COMMAND_ID; Map<?, ?> parameters = Collections.singletonMap("name", name); ImageDescriptor icon = imageDescriptor; String label = name; String tooltip = name; FactoryServiceLocator locator = new FactoryServiceLocator(serviceLocator, factory); CommandContributionItemParameter parameter = new CommandContributionItemParameter(locator, id, commandId, parameters, icon, null, null, label, null, tooltip, SWT.RADIO, null, false); IContributionItem item = new CommandContributionItem(parameter); Expression visibleWhen = null; additions.addContributionItem(item, visibleWhen); } }
/** * @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()]); }
private CommandContributionItem createProcessorItem(ProcessorInfo processor) { CommandContributionItemParameter itemParameter = new CommandContributionItemParameter( PlatformUI.getWorkbench().getActiveWorkbenchWindow(), null, SWITCH_PROCESSOR_COMMAND, CommandContributionItem.STYLE_RADIO); HashMap<String, String> params = new HashMap<>(); params.put(RadioState.PARAMETER_ID, processor.getName()); itemParameter.label = processor.getName(); itemParameter.parameters = params; return new CommandContributionItem(itemParameter); }
private IContributionItem[] createPerBranchContributionItems(List<Repository> repositories, String cmdId, int mode, String user) { List<String> branches = BranchingUtils.getBranches(repositories, mode, user); List<IContributionItem> result = new ArrayList<IContributionItem>(); String curBranch = null; try { curBranch = repositories != null && repositories.size() == 1 ? repositories.get(0).getFullBranch() : null; } catch (IOException e) { //ignore } for (String brName: branches) { if (result.isEmpty() && ( (mode & MODE_ADD_SEPARATOR) != 0)) { result.add(new Separator()); } int ind = brName.lastIndexOf('/'); String branch = brName.substring(ind + 1); CommandContributionItemParameter parameter = new CommandContributionItemParameter( serviceLocator, cmdId + (repositories == null ? ".all." : ".") + brName, cmdId, SWT.PUSH); if (repositories == null) { Map<String, Object> map = new HashMap<String, Object>(); parameter.parameters = map; map.put("branch.ref", brName); map.put("all.repos", "true"); } else { parameter.parameters = Collections.singletonMap("branch.ref", brName); } parameter.label = branch; parameter.icon = GerritToolsPlugin.getDefault().getImageRegistry().getDescriptor( ((mode & MODE_STABLE) != 0) ? GerritToolsPlugin.IMG_BRANCH : GerritToolsPlugin.IMG_FEATURE_BRANCH); if (brName.equals(curBranch)) { result.add(new CurrentBranchCommandContributionItem(parameter)); } else { result.add(new CommandContributionItem(parameter)); } } return result.toArray(new IContributionItem[result.size()]); }
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; }
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); }
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); }
private void createMenu(Control parent) { if(manager == null) { manager = new MenuManager(); List<CommandContributionItem> items = getContrbutionItems(); for (CommandContributionItem item : items) manager.add(item); manager.createContextMenu(parent); } }
public void associate(final CommandContributionItem pluginAction, ITranslatableText localizableText) { associate(pluginAction, new TranslatableTextInput(localizableText) { @Override public void updateControl(String text) { // TODO: Don't know how to do this. The setText method // is private. // pluginAction.setText(text); pluginAction.update(); } }); }
private CommandContributionItem createActionFactoryCommandContributionItem(ActionFactory factory) { IWorkbenchWindow window = getWindow(); CommandContributionItemParameter parameter = new CommandContributionItemParameter(window, factory.getId(), factory.getCommandId(), SWT.PUSH); IWorkbenchAction action = factory.create(window); parameter.icon = action.getImageDescriptor(); parameter.disabledIcon = action.getDisabledImageDescriptor(); parameter.label = action.getText(); parameter.tooltip = action.getToolTipText(); window.getPartService().removePartListener((RetargetAction)action); return new CommandContributionItem(parameter); }
private void createBodyMenu() { MenuManager menuMgr = new MenuManager(); bodyMenu = menuMgr.createContextMenu(table.getShell()); menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, ActionFactory.CUT.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages .getString("tmxedtior.bodyMenuConfiguration.cut"), null, null, CommandContributionItem.STYLE_PUSH, null, false))); menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, ActionFactory.COPY.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages .getString("tmxedtior.bodyMenuConfiguration.copy"), null, null, CommandContributionItem.STYLE_PUSH, null, false))); menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, ActionFactory.PASTE.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages .getString("tmxedtior.bodyMenuConfiguration.paste"), null, null, CommandContributionItem.STYLE_PUSH, null, false))); menuMgr.add(new Separator()); menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.te.tmxeditor.command.addtu", Collections.EMPTY_MAP, null, null, null, null, null, null, CommandContributionItem.STYLE_PUSH, null, false))); menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.te.tmxeditor.command.deletetu", Collections.EMPTY_MAP, null, null, null, null, null, null, CommandContributionItem.STYLE_PUSH, null, false))); menuMgr.add(new Separator()); menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.te.ui.command.cleanSelectInnerTag", Collections.EMPTY_MAP, null, null, null, null, null, null, CommandContributionItem.STYLE_PUSH, null, false))); }
@SuppressWarnings({ "unchecked" }) private void addCommand(IServiceLocator serviceLocator, IContributionRoot additions, String id) { CommandContributionItemParameter p = new CommandContributionItemParameter( serviceLocator, id, CommandId, SWT.PUSH); p.label = id; if (p.parameters == null) { p.parameters = new HashMap<Object, Object>(); } p.parameters.put("id", id); CommandContributionItem item = new CommandContributionItem(p); item.setVisible(true); additions.addContributionItem(item, null); }
@Override public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { CommandContributionItemParameter p = new CommandContributionItemParameter( serviceLocator, "","org.eclipse.ui.file.exit", SWT.PUSH); p.label = "Exit the application"; CommandContributionItem item = new CommandContributionItem(p); item.setVisible(true); }
public static CommandContributionItemParameter contribItemParameter(IServiceLocator svLocator, String commandId) { return new CommandContributionItemParameter(svLocator, commandId, commandId, CommandContributionItem.STYLE_PUSH ); }
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; }
public static CommandContributionItemParameter contribItemParameter(IServiceLocator svLocator, String commandId, String contribId) { return new CommandContributionItemParameter(svLocator, contribId, commandId, CommandContributionItem.STYLE_PUSH ); }
public void editorContextMenuAboutToShow(IMenuManager ctxMenu) { ctxMenu.prependToGroup(ICommonMenuConstants.GROUP_OPEN, new CommandContributionItem( createCommandContrib_OpenDefinitionContrib())); ctxMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new CommandContributionItem( createCommandContrib_QuickOutline())); prepareSourceMenu(ctxMenu); }
protected IContributionItem[] getContributionItems() { final Vector<CommandContributionItem> modelContributions = new Vector<CommandContributionItem>(); Spec currentSpec = ToolboxHandle.getCurrentSpec(); if (currentSpec == null) { return new IContributionItem[0]; } IProject specProject = currentSpec.getProject(); try { // refresh local to pick up any models that have been added // to the file system but not recognized by the toolbox's resource // framework. // TODO decouple from UI thread or question why it has to be done // here. Meaning, why doesn't the resource fw handle this case // already? specProject.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor()); } catch (CoreException e) { e.printStackTrace(); } // First, search for all models for the given spec. final Set<String> modelNames = currentSpec.getAdapter(TLCSpec.class).getModels().keySet(); for (String modelName : modelNames) { // Next, set the command and the parameters for the command // that will be called when the user selects this item. Map<String, String> parameters = new HashMap<String, String>(); // fill the model name for the handler parameters.put(CloneModelHandlerDelegate.PARAM_MODEL_NAME, modelName); // create the contribution item CommandContributionItemParameter param = new CommandContributionItemParameter(UIHelper .getActiveWindow(), "toolbox.command.model.clone." + modelName, COMMAND_ID_ALWAYS_ENABLED, parameters, modelIcon, null, null, modelName, null, "Clones " + modelName, CommandContributionItem.STYLE_PUSH, null, true); // add contribution item to the list modelContributions.add(new CommandContributionItem(param)); } return (IContributionItem[]) modelContributions.toArray(new IContributionItem[modelContributions.size()]); }
protected IContributionItem[] getContributionItems() { /* * Does nothing if the active editor is not a model editor. The * following code gets the config file for the active model editor (if * it is the active editor), gets the model folder for that config, * iterates through all members of the model folder, adding a * contribution item for each member that has extension .tla and is not * TE.tla or MC.tla. */ IEditorPart editor = UIHelper.getActiveEditor(); if (editor instanceof ModelEditor) { IFolder modelFolder = ((ModelEditor) editor).getModel().getTargetDirectory(); if (modelFolder != null && modelFolder.exists()) { try { /* * The collection of command contribution items that will * populate the menu and contain the command to be run when * selected. */ final List<IContributionItem> contributions = new ArrayList<IContributionItem>(); // get all resources in the model folder IResource[] members = modelFolder.members(); for (int i = 0; i < members.length; i++) { /* * We add to the menu an option to open every file that * has exists, has extension .tla, and is not the TE or * MC file. * * On Nov 2011, DR added a null check to members[i].getFileExtension() which * can return null for directories. */ if (members[i].exists() && members[i].getFileExtension() != null && members[i].getFileExtension().equals(ResourceHelper.TLA_EXTENSION) && !members[i].getName().equals(ModelHelper.FILE_TLA) && !members[i].getName().equals(ModelHelper.TE_FILE_TLA)) { Map<String, String> parameters = new HashMap<String, String>(1); parameters.put(OpenSavedModuleHandler.PARAM_MODULE_PATH, members[i].getRawLocation() .toPortableString()); contributions.add(new CommandContributionItem(new CommandContributionItemParameter(UIHelper .getActiveWindow(), "toolbox.command.model.open.savedModule.", OpenSavedModuleHandler.COMMAND_ID, parameters, null, null, null, members[i] .getName(), null, "Opens the version saved in the last run of TLC.", SWT.PUSH, null, true))); } } return (IContributionItem[]) contributions.toArray(new IContributionItem[contributions.size()]); } catch (CoreException e) { TLCUIActivator.getDefault().logError("Error getting members of model folder " + modelFolder, e); } } } return new IContributionItem[0]; }
@Override public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) { // TODO Auto-generated method stub ISelectionService serv = (ISelectionService) serviceLocator.getService(ISelectionService.class); ISelection selection = serv.getSelection(); TreeSelection treeselection = (TreeSelection)selection; Object firstelement = treeselection.getFirstElement(); if(firstelement instanceof IProject || firstelement instanceof IFolder){ IProject pro = null; if(firstelement instanceof IProject) pro = (IProject)firstelement; if(firstelement instanceof IFolder) pro = ((IFolder)firstelement).getProject(); try { IProjectNature nature = pro.getNature(WTNewProjectNature.ID); if(nature==null) return; } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } MenuManager menu = new MenuManager(); menu.setMenuText("New WT"); if(firstelement instanceof IProject) { CommandContributionItemParameter pcommand = new CommandContributionItemParameter(serviceLocator, "", "org.eclipse.ui.newWizard", CommandContributionItem.STYLE_PUSH); pcommand.parameters = new HashMap<String,String>(); pcommand.parameters.put("newWizardId", "org.mondo.wt.cstudy.collectioninputoutput.collectioninputoutputNewFile"); CommandContributionItem itemitsInputOutput = new CommandContributionItem(pcommand); menu.add(itemitsInputOutput); pcommand.parameters.put("newWizardId", "org.mondo.wt.cstudy.mainsubsystem.mainsubsystemNewFile"); CommandContributionItem itemitsSubsystems = new CommandContributionItem(pcommand); menu.add(itemitsSubsystems); } else if(firstelement instanceof IFolder) { IFolder fol = (IFolder)firstelement; IPath filePath = fol.getFullPath().append("/"+fol.getName().concat(".xmi")); XMI_File file = new XMI_File(URI.createPlatformResourceURI(filePath.toString(), true), true); EObject root = null; try { root = file.Get_Root(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if(root!=null) { } } additions.addContributionItem(menu, null); } }
@Override protected final IContributionItem[] getContributionItems() { // By default, return an empty list (if context menu entry must not be // shown) Boolean showEntry = false; IContributionItem[] items = new IContributionItem[] {}; final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { final ISelection selection = window.getSelectionService().getSelection(); if ((selection != null) && (selection.isEmpty() == false)) { Object receiver = null; // Context menu has been opened in a tree view if (selection instanceof IStructuredSelection) { final IStructuredSelection structuredSelection = (IStructuredSelection) selection; receiver = structuredSelection.getFirstElement(); } else if (selection instanceof TextSelection) { receiver = WorkbenchUtil.getCurrentDocument(); } if (receiver != null) { final BeyondCompareSavedLeft savedLeftType = bc.getSavedLeftType(); final IAdapterManager adapterManager = Platform.getAdapterManager(); if (adapterManager != null) { int resourceType = IResource.NONE; final IResource resource = adapterManager.getAdapter(receiver, IResource.class); if (resource != null) { resourceType = resource.getType(); } if (((resourceType == IResource.PROJECT) || (resourceType == IResource.FOLDER)) && (savedLeftType == BeyondCompareSavedLeft.Directory)) { showEntry = true; } else if ((resourceType == IResource.FILE) && (savedLeftType == BeyondCompareSavedLeft.File)) { showEntry = true; } else { showEntry = false; } if (showEntry) { final String savedLeft = bc.getSavedLeft(); if (savedLeft != null) { final CommandContributionItemParameter parameter = new CommandContributionItemParameter(this.currentServiceLocator, null, "ContextQuickie.commands.compareToRight", 0); final String filename = new File(savedLeft).getName(); parameter.label = "Compare to " + filename; parameter.icon = contextquickie.Activator.getImageDescriptor("icons/BeyondCompare/Compare.png"); items = new IContributionItem[] { new CommandContributionItem(parameter) }; } } } } } } return items; }
protected static CommandContributionItem createCommandContributionItem(String commandId, int style) { IWorkbench workbench = PlatformUI.getWorkbench(); CommandContributionItemParameter parameter = new CommandContributionItemParameter(workbench, null, commandId, style); return new CommandContributionItem(parameter); }
private void addCommand(MenuManager menuManager, List<MenuManager> items, String commandId) { CommandContributionItemParameter parm = new CommandContributionItemParameter( serviceLocator, null, commandId, CommandContributionItem.STYLE_PUSH); fillMenu(menuManager, items, new CommandContributionItem(parm)); }
public static CommandContributionItem pushItem(IServiceLocator svLocator, String commandId) { return new CommandContributionItem(contribItemParameter(svLocator, commandId)); }
public static CommandContributionItem pushItem(IServiceLocator svLocator, String commandId, String contribId) { return new CommandContributionItem(contribItemParameter(svLocator, commandId, contribId)); }
protected CommandContributionItem pushItem(String commandId, String contribId) { return CommandsHelper.pushItem(getServiceLocator(), commandId, contribId); }
protected CommandContributionItem pushItem(String commandId) { return CommandsHelper.pushItem(getServiceLocator(), commandId, commandId); }
/** * Create an IContributionItem for commandId of specified style * (SWT.PUSH or SWT.CHECK) and contribute to both toolbar and menu. * @param commandId * @param style */ protected void contribute(String commandId, int style) { CommandContributionItem item = createCommandContributionItem(commandId, style); getItems().add(item); }
protected abstract List<CommandContributionItem> getContrbutionItems();