Package org.eclipse.core.commands

Examples of org.eclipse.core.commands.ParameterizedCommand


        List<Tuple<Binding, ParameterizedCommand>> matches = new ArrayList<Tuple<Binding, ParameterizedCommand>>();
        //Ok, it may be that the binding we're looking for is not active, so, let's give a spin on all
        //the bindings
        Binding[] bindings = bindingSvc.getBindings();
        for (Binding binding : bindings) {
            ParameterizedCommand command = binding.getParameterizedCommand();
            if (command != null) {
                if (commandId.equals(command.getId())) {
                    matches.add(new Tuple<Binding, ParameterizedCommand>(binding, command));
                }
            }
        }
        for (Tuple<Binding, ParameterizedCommand> tuple : matches) {
View Full Code Here


            Activator.handleError(e.getMessage(), e, true);
            parms = null;
          }
        else
          parms = null;
        ParameterizedCommand pcmd = new ParameterizedCommand(cmd, parms);
        try {
          hsrv.executeCommandInContext(pcmd, null, hsrv
              .getCurrentState());
        } catch (Exception e) {
          Activator.handleError(e.getMessage(), e, true);
View Full Code Here

      c.removeVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
    }
    try {
      if (c != null)
        handlerService.executeCommandInContext(
            new ParameterizedCommand(cmd, null), null, c);
      else
        handlerService.executeCommand(commandId, null);

      return true;
    } catch (CommandException ignored) {
View Full Code Here

      Log.error("Could not get ICommandService or IHandlerService while trying to execute: " + command, null); //$NON-NLS-1$
      return false;
    }

    try {
      ParameterizedCommand pCommand = commandService.deserialize(command);
      pCommand.executeWithChecks(null, handlerService.getCurrentState());

      // Executed command successfully. Now set intro standby if needed.
      if (standbyState == null)
        return true;
      return setStandbyState(standbyState);
View Full Code Here

      (IStatus.ERROR,
      ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, 0,
      Messages.ERROR_COMMAND_SERVICE_UNAVAILABLE, null);
    }

    ParameterizedCommand selectedCommand;
    Object result;     
    String rawSerialization = command.getSerialization();
    try {
      String substitutedSerialization = csm.performVariableSubstitution(rawSerialization);
      selectedCommand = commandService.deserialize(substitutedSerialization);
      IEvaluationContext state = handlerService.getCurrentState();
      result = selectedCommand.executeWithChecks(null, state);
     
      String returnsAttribute = command.getReturns();
      if ((returnsAttribute != null) && (result != null)) {
        ParameterType returnType = selectedCommand.getCommand().getReturnType();
        if ((returnType != null && (returnType.getValueConverter() != null))) {
          String resultString = returnType.getValueConverter().convertToString(result);
          csm.setDataQualified(returnsAttribute, resultString);
        }
        else {
View Full Code Here

                    IParameter p = cmd.getParameter(parameters[ii]);
                    parameterizations.add(new Parameterization(p, parameters[++ii]));
                }
            }

            ParameterizedCommand pCmd = new ParameterizedCommand(cmd,
                            parameterizations.toArray(new Parameterization[0]));
            if (handlerService.canExecute(pCmd))
                handlerService.executeHandler(pCmd);
        }
        catch (NotDefinedException e)
View Full Code Here

    }

    private void executeCommand(String command)
    {
        Command cmd = commandService.getCommand(command);
        ParameterizedCommand pCmd = new ParameterizedCommand(cmd, null);
        if (handlerService.canExecute(pCmd))
        {
            handlerService.executeHandler(pCmd);
        }
    }
View Full Code Here

        while (listenerItr.hasNext()) {
          final Map.Entry entry = (Map.Entry) listenerItr.next();
          final String commandId = (String) entry.getKey();
          final Command command = commandManager
              .getCommand(commandId);
          final ParameterizedCommand parameterizedCommand = new ParameterizedCommand(
              command, null);
          if (event.isActiveBindingsChangedFor(parameterizedCommand)) {
            final IPropertyChangeListener listener = (IPropertyChangeListener) entry
                .getValue();
            listener.propertyChange(new PropertyChangeEvent(event
View Full Code Here

   * @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 final TriggerSequence[] getActiveBindingsFor(final String commandId) {
    final ParameterizedCommand parameterizedCommand = new ParameterizedCommand(
        commandManager.getCommand(commandId), null);
    final Object object = getActiveBindingsByParameterizedCommand().get(
        parameterizedCommand);
    if (object instanceof Collection) {
      final Collection collection = (Collection) object;
View Full Code Here

      if (isPartialMatch(sequenceAfterKeyStroke)) {
        incrementState(sequenceAfterKeyStroke);
        return true;

      } else if (isPerfectMatch(sequenceAfterKeyStroke)) {
        final ParameterizedCommand cmd = getPerfectMatch(sequenceAfterKeyStroke);
        try {
          return executeCommand(cmd, event) || !sequenceBeforeKeyStroke.isEmpty();
        } catch (final CommandException e) {
          return true;
        }
View Full Code Here

TOP

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

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.