protected ParameterizedCommand buildParameterizedCommand() { ArrayList<Parameterization> list = new ArrayList<>(fParameterToValue.size()); for (Entry<IParameter, String> entry : fParameterToValue.entrySet()) { list.add(new Parameterization(entry.getKey(), entry.getValue())); } Parameterization[] parameterizations = list.toArray(new Parameterization[list.size()]); ParameterizedCommand pCommand = new ParameterizedCommand(fSelectedCommand, parameterizations); return pCommand; }
private TriggerSequence[] getKeyBindings(BindingManager localBindingManager, ICommandService commandService, String commandID) { Command command= commandService.getCommand(commandID); ParameterizedCommand pCmd= new ParameterizedCommand(command, null); return localBindingManager.getActiveBindingsDisregardingContextFor(pCmd); }
String getKeybindingAsString() { final Parameterization[] params= { new Parameterization(fParam, fCategory.getId()) }; final ParameterizedCommand pCmd= new ParameterizedCommand(fCommand, params); String key= getKeyboardShortcut(pCmd); return key; } boolean isInDefaultCategory() {
private TriggerSequence[] getKeyBindings(BindingManager localBindingManager, ICommandService commandService, String commandID) { Command command= commandService.getCommand(commandID); ParameterizedCommand pCmd= new ParameterizedCommand(command, null); return localBindingManager.getActiveBindingsDisregardingContextFor(pCmd); }
String getKeybindingAsString() { final Parameterization[] params= { new Parameterization(fParam, fCategory.getId()) }; final ParameterizedCommand pCmd= new ParameterizedCommand(fCommand, params); String key= getKeyboardShortcut(pCmd); return key; } boolean isInDefaultCategory() {
String getKeybindingAsString() { final Parameterization[] params= { new Parameterization(fParam, fCategory.getId()) }; final ParameterizedCommand pCmd= new ParameterizedCommand(fCommand, params); String key= getKeyboardShortcut(pCmd); return key; } boolean isInDefaultCategory() {
/** * <p> * Returns the active bindings for a particular command identifier. This * method operates in O(n) time over the number of bindings. * </p> * <p> * This method completes in <code>O(1)</code>. If the active bindings are * not yet computed, then this completes in <code>O(nn)</code>, where * <code>n</code> is the number of bindings. * </p> * * @param commandId * The identifier of the command whose bindings are requested. * This argument may be <code>null</code>. It is assumed that * the command has no parameters. * @return The array of active triggers (<code>TriggerSequence</code>) * for a particular command identifier. This value is guaranteed not * to be <code>null</code>, but it may be empty. */ public TriggerSequence[] getActiveBindingsFor(final String commandId) { final ParameterizedCommand parameterizedCommand = new ParameterizedCommand( commandManager.getCommand(commandId), null); return getActiveBindingsFor(parameterizedCommand); }
/** * Gets the best active binding for a command. The best binding is the one * that would be most appropriate to show in a menu. Bindings which belong * to a child scheme are given preference over those in a parent scheme. * Bindings which belong to a particular locale or platform are given * preference over those that do not. The rest of the calculaton is based * most on various concepts of "length", as well as giving some modifier * keys preference (e.g., <code>Alt</code> is less likely to appear than * <code>Ctrl</code>). * * @param commandId * The identifier of the command for which the best active * binding should be retrieved; must not be <code>null</code>. * @return The trigger sequence for the best binding; may be * <code>null</code> if no bindings are active for the given * command. * @since 3.2 */ public final TriggerSequence getBestActiveBindingFor(final String commandId) { return getBestActiveBindingFor(new ParameterizedCommand(commandManager.getCommand(commandId), null)); }
@Override protected ParameterizedCommand getForwardCommand() { final ICommandService commandService = window .getWorkbench().getService(ICommandService.class); final Command command= commandService.getCommand(IWorkbenchCommandConstants.NAVIGATE_NEXT_PAGE); ParameterizedCommand commandF = new ParameterizedCommand(command, null); return commandF; }
@Override protected ParameterizedCommand getBackwardCommand() { final ICommandService commandService = window.getWorkbench().getService(ICommandService.class); final Command command = commandService.getCommand(IWorkbenchCommandConstants.WINDOW_PREVIOUS_EDITOR); ParameterizedCommand commandBack = new ParameterizedCommand(command, null); return commandBack; }
private ParameterizedCommand getParametrizedCommand(String workbenchCommand) { final ICommandService commandService = window.getWorkbench().getService(ICommandService.class); final Command command = commandService.getCommand(workbenchCommand); ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, null); return parameterizedCommand; }
@Override protected ParameterizedCommand getForwardCommand() { final ICommandService commandService = window.getWorkbench().getService(ICommandService.class); final Command command = commandService.getCommand(ORG_ECLIPSE_UI_WINDOW_OPEN_EDITOR_DROP_DOWN); ParameterizedCommand commandF = new ParameterizedCommand(command, null); return commandF; }
@Override protected ParameterizedCommand getForwardCommand() { final ICommandService commandService = window.getWorkbench().getService(ICommandService.class); final Command command = commandService.getCommand(IWorkbenchCommandConstants.WINDOW_NEXT_PERSPECTIVE); ParameterizedCommand commandF = new ParameterizedCommand(command, null); return commandF; }
@Override protected ParameterizedCommand getForwardCommand() { final ICommandService commandService = window.getWorkbench().getService(ICommandService.class); final Command command = commandService.getCommand(IWorkbenchCommandConstants.WINDOW_NEXT_EDITOR); ParameterizedCommand commandF = new ParameterizedCommand(command, null); return commandF; }
private ParameterizedCommand getContentAssistCommand() { final ICommandService commandSvc = PlatformUI.getWorkbench().getAdapter(ICommandService.class); final Command command = commandSvc.getCommand(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); ParameterizedCommand pCmd = new ParameterizedCommand(command, null); return pCmd; } }
@Override protected ParameterizedCommand getBackwardCommand() { final ICommandService commandService = window .getWorkbench().getService(ICommandService.class); final Command command = commandService.getCommand(IWorkbenchCommandConstants.NAVIGATE_PREVIOUS_PAGE); ParameterizedCommand commandF = new ParameterizedCommand(command, null); return commandF; }
@Override protected ParameterizedCommand getBackwardCommand() { final ICommandService commandService = window.getWorkbench().getService(ICommandService.class); final Command command = commandService.getCommand(IWorkbenchCommandConstants.WINDOW_PREVIOUS_PERSPECTIVE); ParameterizedCommand commandBack = new ParameterizedCommand(command, null); return commandBack; }
/** * Build a command from the executable extension information. * * @param commandService * to get the Command object * @param commandId * the command id for this action * @param parameterMap */ private void createCommand(ICommandService commandService, String commandId, Map parameterMap) { Command cmd = commandService.getCommand(commandId); if (!cmd.isDefined()) { WorkbenchPlugin.log("Command " + commandId + " is undefined"); //$NON-NLS-1$//$NON-NLS-2$ return; } if (parameterMap == null) { parameterizedCommand = new ParameterizedCommand(cmd, null); return; } parameterizedCommand = ParameterizedCommand.generateCommand(cmd, parameterMap); }
public void run() { ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); Command command = commandService.getCommand(EnableEditBox.COMMAND_ID); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { IHandlerService handlerService = (IHandlerService) window.getWorkbench().getService(IHandlerService.class); if (handlerService != null) try { handlerService.executeCommand(new ParameterizedCommand(command, null), null); EditBox.toggleToolBarItem(window, true); //EditBox.toggleToolBarItemInAllWindows(enabled); //no need as there is to be only one window } catch (Exception e) { EditBox.logError(this, "Failed to enable EditBox at startup", e); } } }
@Override public void apply(IDocument document) { try { IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class); ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class); Command command = commandService.getCommand("org.eclipse.pde.ui.searchTargetRepositories"); //$NON-NLS-1$ IParameter parameter = command.getParameter("org.eclipse.pde.ui.searchTargetRepositories.term"); //$NON-NLS-1$ Parameterization parameterization = new Parameterization(parameter, fPackageName); ParameterizedCommand pc = new ParameterizedCommand(command, new Parameterization[] {parameterization}); handlerService.executeCommand(pc, null); } catch (ExecutionException e) { PDEPlugin.log(e); } catch (NotDefinedException e) { PDEPlugin.log(e); } catch (NotEnabledException e) { PDEPlugin.log(e); } catch (NotHandledException e) { PDEPlugin.log(e); } }