Package org.eclipse.core.commands

Examples of org.eclipse.core.commands.Command


    resetToggleCommand("com.subgraph.vega.commands.proxyPassthrough", proxyService.isPassthrough());
  }
 
  private void resetToggleCommand(String commandId, boolean value) {
    final ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    final Command command = service.getCommand(commandId);
    if(command == null) {
      return;
    }
    final State state = command.getState("org.eclipse.ui.commands.toggleState");
    if(state != null) {
      state.setValue(value);
    }
  }
View Full Code Here


      }

      // Retrieve the cached command from the command config.
      // If it has not been initialized before, it will be created on demand and
      // stored in the command config.
      Command command = this.getCommandFromCommandConfig(commandConfig);
      getLogFacility().logDebug(
          "got command for " + commandConfig.getCommand() + ": " + command);
      getLogFacility().logDebug("command.isDefined(): " + command.isDefined());

      CommandContributionItemParameter commandContributionItemParameter = new CommandContributionItemParameter( //
          this.getServiceLocator(), // IServiceLocator serviceLocator,
          command.getId(), // String id,
          command.getId(), // String commandId,
          CommandContributionItem.STYLE_PUSH // int style)
      );
      commandContributionItemParameter.label = this
          .getNameFromCommandConfig(commandConfig);
      contributionItemList.add(this
View Full Code Here

        .intToString(getNextCustomCommandIdNumber());
    String commandId = "de.bastiankrol.startexplorer.customCommand"
        + commandNumberString;
    ICommandService commandService = this
        .getCommandService(getServiceLocator());
    Command command = commandService.getCommand(commandId);
    String commandName = "StartExplorer Custom Command " + commandNumberString;
    getLogFacility().logDebug(
        "defining command for " + commandConfig.getCommand() + " as "
            + commandName);
    command.define(commandName, this.getNameFromCommandConfig(commandConfig),
        this.getLazyInitCategory(commandService));
    this.activateHandler(commandConfig, commandId);
    getLogFacility().logDebug(
        "createCommand(" + commandConfig.getCommand() + ") done");
    return command;
View Full Code Here

    getLogFacility().logDebug("doCleanup(" + atPluginStop + ") start");
    if (this.commandConfigList != null)
    {
      for (CommandConfig commandConfig : this.commandConfigList)
      {
        Command eclipseCommandForResourceViewNoInit = commandConfig
            .getEclipseCommandForResourceViewNoInit();
        this.disposeCommand(eclipseCommandForResourceViewNoInit, atPluginStop);
        commandConfig.deleteEclipseCommandForResourceView();
        deactivateHandler(commandConfig.getHandlerActivationForResourceView(),
            commandConfig.getNameForResourcesMenu());
        commandConfig.setHandlerActivationForResourceView(null);

        Command eclipseCommandForEditorNoInit = commandConfig
            .getEclipseCommandForEditorNoInit();
        this.disposeCommand(eclipseCommandForEditorNoInit, atPluginStop);
        commandConfig.deleteEclipseCommandForEditor();
        deactivateHandler(commandConfig.getHandlerActivationForEditor(),
            commandConfig.getNameForTextSelectionMenu());
View Full Code Here

  private void createSkeleton(String containerName, String projectName) throws CoreException {
    ICommandService cmdService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
   
    // get the command
    Command cmd = cmdService.getCommand("q_impress.pmi.plugin.commands.createProjectSkeleton");
    IParameter rootParm = null;
    IParameter projectNameParm = null;
    try {
      rootParm = cmd.getParameter("q_impress.pmi.plugin.commands.createProjectSkeleton.root");
      projectNameParm = cmd.getParameter("q_impress.pmi.plugin.commands.createProjectSkeleton.projectName");
    } catch (NotDefinedException e) {
      this.throwCoreException("Unable to execute command, invalid parameter :" + e.getMessage(), e);
    }

    // parametrize it
View Full Code Here

  private void createEmptyModel(String containerName, String fileName) throws CoreException {
    ICommandService cmdService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
   
    // get the command
    Command createPmiFileCmd = cmdService.getCommand("q_impress.pmi.plugin.commands.createEmptyPerformanceModel");
    IParameter dirParm = null;
    IParameter fileParm = null;
    try {
      dirParm = createPmiFileCmd.getParameter("q_impress.pmi.plugin.commands.createEmptyPerformanceModel.directory");
      fileParm = createPmiFileCmd.getParameter("q_impress.pmi.plugin.commands.createEmptyPerformanceModel.filename");
    } catch (NotDefinedException e) {
      this.throwCoreException("Unable to execute command, invalid parameter :" + e.getMessage(), e);
    }

    // parametrize it
View Full Code Here

   
    ICommandService cmdService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
   
    // get the command
    Command command = cmdService.getCommand(AddUmlResourceHandler.COMMAND_ID);
    IParameter umlPathParm = null;
    IParameter doBundlingParm = null;
    IParameter targetModelFileParm = null;
    try {
      umlPathParm = command.getParameter(AddUmlResourceHandler.PARAM_UML_RESOURCE_PATH);
      doBundlingParm = command.getParameter(AddUmlResourceHandler.PARAM_DO_BUNDLING);
      targetModelFileParm = command.getParameter(AddUmlResourceHandler.PARAM_TARGET_MODEL_PATH);
    } catch (NotDefinedException e) {
      this.throwCoreException("Unable to execute command, invalid parameter :" + e.getMessage(), e);
    }
 
    // parametrize it
View Full Code Here

   */
  protected ExecutionEvent createExecutionEvent() {
    IServiceLocator locator = getServiceLocator();
    ICommandService srv = CommonUtils.getService(locator, ICommandService.class);
    IHandlerService hsrv = CommonUtils.getService(locator, IHandlerService.class);
    Command command = srv.getCommand(commandId);

    ExecutionEvent event = hsrv.createExecutionEvent(command, null);
    if (event.getApplicationContext() instanceof IEvaluationContext)
      ((IEvaluationContext) event.getApplicationContext()).addVariable(
          ISources.ACTIVE_CURRENT_SELECTION_NAME, mySelection);
View Full Code Here

  public final Object execute(ExecutionEvent event) throws ExecutionException {
    if (!shouldRunAction())
      return null;

    ICommandService srv = CommonUtils.getService(getServiceLocator(), ICommandService.class);
    Command command = srv.getCommand(commandId);
    try {
      return command.executeWithChecks(event);
    } catch (ExecutionException e) {
      Activator.handleError(e.getMessage(), e, true);
    } catch (NotDefinedException e) {
      Activator.handleError(e.getMessage(), e, true);
    } catch (NotEnabledException e) {
View Full Code Here

    super.createPartControl(displayArea);

    IWorkbenchWindow w = PlatformUI.getWorkbench()
        .getActiveWorkbenchWindow();
    ICommandService csrv = CommonUtils.getService(w, ICommandService.class);
    Command command = csrv
        .getCommand("org.eclipse.egit.ui.RepositoriesLinkWithSelection"); //$NON-NLS-1$
    reactOnSelection = (Boolean) command.getState(
        RegistryToggleState.STATE_ID).getValue();

    IWorkbenchSiteProgressService service = CommonUtils.getService(getSite(), IWorkbenchSiteProgressService.class);
    if (service != null) {
      service.showBusyForFamily(JobFamilies.REPO_VIEW_REFRESH);
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.