Package org.eclipse.core.commands

Examples of org.eclipse.core.commands.Command


      // Read out the help context identifier.
      final String helpContextId = readOptional(configurationElement,
          ATT_HELP_CONTEXT_ID);

      final Command command = commandService.getCommand(commandId);
      final Category category = commandService.getCategory(categoryId);
      if (!category.isDefined()) {
        addWarning(
            warningsToLog,
            "Commands should really have a category", //$NON-NLS-1$
            configurationElement, commandId,
            "categoryId", categoryId); //$NON-NLS-1$
      }

      final ParameterType returnType;
      if (returnTypeId == null) {
        returnType = null;
      } else {
        returnType = commandService.getParameterType(returnTypeId);
      }

      command.define(name, description, category, parameters, returnType,
          helpContextId);
      readState(configurationElement, warningsToLog, command);
    }

    // If there were any warnings, then log them now.
View Full Code Here


   * @param commandService
   * @param makeFast
   */
  private ParameterizedCommand getCommand(ICommandService commandService,
      final boolean makeFast) {
    Command c = commandService.getCommand(SHOW_VIEW_ID);
    Parameterization[] parms = null;
    if (makeFast) {
      try {
        IParameter parmDef = c.getParameter(PARAMETER_MAKE_FAST);
        parms = new Parameterization[] {
            new Parameterization(parmDef, "true") //$NON-NLS-1$
        };
      } catch (NotDefinedException e) {
        // this should never happen
View Full Code Here

     * All state on all commands neeeds to be disposed. This is so that the
     * state has a chance to persist any changes.
     */
    final Command[] commands = commandManager.getAllCommands();
    for (int i = 0; i < commands.length; i++) {
      final Command command = commands[i];
      final String[] stateIds = command.getStateIds();
      for (int j = 0; j < stateIds.length; j++) {
        final String stateId = stateIds[j];
        final State state = command.getState(stateId);
        if (state instanceof PersistentState) {
          final PersistentState persistentState = (PersistentState) state;
          if (persistentState.shouldPersist()) {
            persistentState.save(PrefUtil
                .getInternalPreferenceStore(),
View Full Code Here

    return commandManager.getHelpContextId(command);
  }

  public final String getHelpContextId(final String commandId)
      throws NotDefinedException {
    final Command command = getCommand(commandId);
    return commandManager.getHelpContextId(command);
  }
View Full Code Here

   *
   * @see org.eclipse.ui.commands.ICommandService#refreshElements(java.lang.String,
   *      java.util.Map)
   */
  public final void refreshElements(String commandId, Map filter) {
    Command cmd = getCommand(commandId);

    if (!cmd.isDefined() || !(cmd.getHandler() instanceof IElementUpdater)) {
      return;
    }
    final IElementUpdater updater = (IElementUpdater) cmd.getHandler();

    if (commandCallbacks == null) {
      return;
    }

View Full Code Here

    }
    parameterizedCommands.add(elementReference);

    // If the active handler wants to update the callback, it can do
    // so now
    Command command = getCommand(elementReference.getCommandId());
    if (command.isDefined()) {
      if (command.getHandler() instanceof IElementUpdater) {
        ((IElementUpdater) command.getHandler()).updateElement(
            elementReference.getElement(), elementReference
                .getParameters());
      }
    }
  }
View Full Code Here

    // return new CategoryWrapper(commandManager.getCategory(categoryId));
    return null;
  }

  public ICommand getCommand(String commandId) {
    final Command command = commandManager.getCommand(commandId);
    return new CommandLegacyWrapper(command, bindingManager);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.ui.internal.CycleBaseHandler#getBackwardCommand()
   */
  protected ParameterizedCommand getBackwardCommand() {
    final ICommandService commandService = (ICommandService) window.getWorkbench().getService(ICommandService.class);
    final Command command = commandService.getCommand("org.eclipse.ui.window.previousEditor"); //$NON-NLS-1$
    ParameterizedCommand commandBack = new ParameterizedCommand(command, null);
    return commandBack;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.ui.internal.CycleBaseHandler#getForwardCommand()
   */
  protected ParameterizedCommand getForwardCommand() {
    final ICommandService commandService = (ICommandService) window.getWorkbench().getService(ICommandService.class);
    final Command command = commandService.getCommand("org.eclipse.ui.window.nextEditor"); //$NON-NLS-1$
    ParameterizedCommand commandF = new ParameterizedCommand(command, null);
    return commandF;
  }
View Full Code Here

     */
    public void setCommandHandlers( ICommandService service ) {

        if (!handlersSet) {
            if (commandId != null) {
                Command command = service.getCommand(commandId);
                if (command != null && getHandler() != null)
                    command.setHandler(getHandler());
            }
            handlersSet = true;
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.core.commands.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.