Package org.eclipse.core.commands

Examples of org.eclipse.core.commands.Command


            public void widgetSelected(SelectionEvent e) {
                try {
                    ICommandService cService = (ICommandService) getSite().getService(ICommandService.class);
                    IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
                   
                    Command command = cService.getCommand("de.innovationgate.eclipse.ids.commands.OpenModuleInBrowser");
                   
                    IParameter paramTMLFile = command.getParameter("de.innovationgate.eclipse.ids.commands.OpenModuleInBrowser.paramTMLFilePath");
 
                    Parameterization parm = new Parameterization(paramTMLFile, getInputFile().getFullPath().toString());
      
                    ParameterizedCommand parmCommand = new ParameterizedCommand(command, new Parameterization[] { parm });
View Full Code Here


    if (commandService == null)
      return;

    /* Define Command For Each Label */
    for (final ILabel label : labels) {
      Command command = commandService.getCommand(LABEL_ACTION_PREFIX + label.getOrder());
      command.define(NLS.bind(Messages.Controller_LABEL, label.getName()), NLS.bind(Messages.Controller_LABEL_MSG, label.getName()), commandService.getCategory(RSSOWL_KEYBINDING_CATEGORY));
      command.setHandler(new LabelNewsHandler(label));
    }
  }
View Full Code Here

  }
 
  private IContributionItem createContributionItem(IServiceLocator serviceLocator, Action item) {
    ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class);
   
    Command command = commandService.getCommand("io.emmet.eclipse.commands." + item.getId());
    command.define(item.getName(), "", commandService.getCategory("io.emmet.eclipse.commands.category"));
   
    IHandlerService handlerService = (IHandlerService) serviceLocator.getService(IHandlerService.class);
    handlerService.activateHandler(command.getId(), handlerFactory(item.getId()));
   
    CommandContributionItemParameter p = new CommandContributionItemParameter(
        serviceLocator, "", command.getId(), CommandContributionItem.STYLE_PUSH);
   
    p.label = item.getName();
   
    CommandContributionItem contribItem = new CommandContributionItem(p);
    contribItem.setVisible(true);
View Full Code Here

        final Iterator listenerItr = registeredListeners.entrySet()
            .iterator();
        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)) {
            Object value = entry.getValue();
View Full Code Here

     * Calling this method with an undefined command id will generate a log
     * message.
     */
    public final boolean isActive(final String commandId) {
      if (commandId != null) {
        final Command command = commandManager.getCommand(commandId);

        if (!command.isDefined()
            && (!loggedCommandIds.contains(commandId))) {
          // The command is not yet defined, so we should log this.
          final String message = MessageFormat.format(Util
              .translateString(RESOURCE_BUNDLE,
                  "undefinedCommand.WarningMessage", null), //$NON-NLS-1$
              new String[] { command.getId() });
          IStatus status = new Status(IStatus.ERROR,
              "org.eclipse.jface", //$NON-NLS-1$
              0, message, new Exception());
          Policy.getLog().log(status);

          // And remember this item so we don't log it again.
          loggedCommandIds.add(commandId);
          command.addCommandListener(new ICommandListener() {
            /*
             * (non-Javadoc)
             *
             * @see org.eclipse.ui.commands.ICommandListener#commandChanged(org.eclipse.ui.commands.CommandEvent)
             */
            public final void commandChanged(
                final CommandEvent commandEvent) {
              if (command.isDefined()) {
                command.removeCommandListener(this);
                loggedCommandIds.remove(commandId);
              }
            }
          });

View Full Code Here

      String actionDefinitionId = action.getActionDefinitionId();
      if (actionDefinitionId==null
          || !applicabilityChecker.isApplicable(action)) {
        return;
      }
      Command command = commandManager.getCommand(actionDefinitionId);
      ExecutionEvent executionEvent = new ExecutionEvent(command,
          Collections.EMPTY_MAP, event, null);

      commandManager.firePreExecute(actionDefinitionId, executionEvent);
    }
View Full Code Here

      throws Exception {
    @SuppressWarnings("unchecked")
    Collection<String> ids = commandService.getDefinedCommandIds();
    for (String id : ids) {
      if (imageService.getImageDescriptor(id) != null) {
        Command cmdWithImage = commandService.getCommand(id);
        assertThat(provider.getImage(cmdWithImage), notNullValue());
        break;
      }
    }
  }
View Full Code Here

    provider = new CommandDescriptionProvider();
  }

  @Test
  public void getForegroundShouldReturnGrayForAnUndefinedCommand() {
    Command command = getCommandService().getCommand("a.b.c.e.f");
    assertThat(provider.getForeground(command), equalTo(PlatformUI
        .getWorkbench().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)));
  }
View Full Code Here

    assertThat(provider.getText(new Object()), nullValue());
  }

  @Test
  public void getTextShouldReturnTheDescriptionOfTheCommand() throws Exception {
    Command command = getCommandWithDescription();
    assertThat(command, notNullValue());
    assertThat(provider.getText(command), equalTo(command.getDescription()));
  }
View Full Code Here

  @Test
  public void testDisabled() throws Exception {
    tracker.setEnabled(false);

    String commandId = System.currentTimeMillis() + "." + System.nanoTime();
    Command command = getCommandService().getCommand(commandId);
    command.define("a", "b", getCommandService().getDefinedCategories()[0]);

    getHandlerService().activateHandler(command.getId(), createHandler());
    getHandlerService().executeCommand(command.getId(), null);

    assertTrue(tracker.getData().isEmpty());
  }
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.