Examples of ICommandService


Examples of com.adaptrex.tools.command.ICommandService

    /*
     * Get guiced and get the environment service
     */
    Injector injector = Guice.createInjector(new ToolsModule());
    ICommandService commandService = injector.getInstance(ICommandService.class);
   
    /*
     * Get our options.  We've got a problem with scripts breaking apart arguments
     * that include spaces... so we manually rebuild it here
     */
    String[] realArgs = args.length > 1 ? Arrays.copyOfRange(args, 2, args.length) : null;
    String repackagedArgs = " ";
    for (String arg : realArgs) repackagedArgs += arg + " ";
    List<String> optionArgs = new ArrayList<String>();
    for (String splitArg : repackagedArgs.split(" -")) {
      splitArg = splitArg.trim();
      if (!splitArg.isEmpty()) optionArgs.add("-" + splitArg.trim());
    }
   
    /*
     * Initialize our command service
     */
    boolean goodEnv = commandService.initialize(verb, target,
        optionArgs.toArray(new String[optionArgs.size()]));
   
    if (!goodEnv) {
      System.out.println(CR + "This is the first time you are running Adaptrex Tools." + CR + CR +
          "Before you can run the tools, you need to run \"adaptrex config environment\"" + CR +
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

       
        _btnOpenInBrowser.addSelectionListener(new SelectionListener() {
           
            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());
      
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

   */
  private void defineLabelCommands(Collection<ILabel> labels) {
    if (InternalOwl.TESTING)
      return;

    ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    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

Examples of org.eclipse.ui.commands.ICommandService

  /* TODO Also need to remove any keybinding associated with Label if existing */
  private void undefineLabelCommands(Collection<ILabel> labels) {
    if (InternalOwl.TESTING)
      return;

    ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    if (commandService == null)
      return;

    for (ILabel label : labels) {
      commandService.getCommand(LABEL_ACTION_PREFIX + label.getOrder()).undefine();
    }
  }
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

              */
            public void partDeactivated( IWorkbenchPartReference partRef )
            {
                if ( partRef.getPart( false ) == view && contextActivation != null )
                {
                    ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
                        ICommandService.class );
                    if ( commandService != null )
                    {
                        commandService.getCommand( newProject.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( renameProject.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( deleteProject.getActionDefinitionId() ).setHandler( null );
                    }

                    IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
                        IContextService.class );
                    contextService.deactivateContext( contextActivation );
                    contextActivation = null;
                }
            }


            /**
             * This implementation activates the shortcuts when the part is activated.
             */
            public void partActivated( IWorkbenchPartReference partRef )
            {
                if ( partRef.getPart( false ) == view )
                {
                    IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
                        IContextService.class );
                    contextActivation = contextService.activateContext( PluginConstants.CONTEXT_PROJECTS_VIEW );

                    ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
                        ICommandService.class );
                    if ( commandService != null )
                    {
                        commandService.getCommand( newProject.getActionDefinitionId() ).setHandler(
                            new ActionHandler( newProject ) );
                        commandService.getCommand( renameProject.getActionDefinitionId() ).setHandler(
                            new ActionHandler( renameProject ) );
                        commandService.getCommand( deleteProject.getActionDefinitionId() ).setHandler(
                            new ActionHandler( deleteProject ) );
                    }
                }
            }

View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

   
    return createContributionItem(serviceLocator, (Action) item);
  }
 
  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(
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

  /**
   * TODO Register prefixes by extension point
   */
  private void registerCorrectionHandlers() {
    final String COMMAND_PREFIX = "org.pdtextensions.core.ui.correction."; //$NON-NLS-1$
    final ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
   
    for (final Object ob : commandService.getDefinedCommandIds()) {
      String id = (String) ob;
      if (!id.startsWith(COMMAND_PREFIX)) {
        continue;
      }
     
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

        .getService(IContextService.class);
    final IContextService context = new NestableContextService(
        parentContext, defaultExpression);
    serviceLocator.registerService(IContextService.class, context);

    final ICommandService parentCommandService = (ICommandService) serviceLocator
        .getService(ICommandService.class);
    final ICommandService commandService = new SlaveCommandService(
        parentCommandService, IServiceScopes.MPESITE_SCOPE,
        this);
    serviceLocator.registerService(ICommandService.class, commandService);

  }
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

        .getService(IContextService.class);
    final IContextService contextSlave = new NestableContextService(
        contextParent, defaultExpression);
    serviceLocator.registerService(IContextService.class, contextSlave);
   
    final ICommandService parentCommandService = (ICommandService) serviceLocator
        .getService(ICommandService.class);
    final ICommandService commandService = new SlaveCommandService(
        parentCommandService, IServiceScopes.PAGESITE_SCOPE,
        this);
    serviceLocator.registerService(ICommandService.class, commandService);

  }
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

    final String oldText = getText();

    // Update the command.
    final Command oldBaseCommand = command.getCommand();
    oldBaseCommand.removeCommandListener(commandListener);
    final ICommandService commandService = (ICommandService) serviceLocator
        .getService(ICommandService.class);
    final Command newBaseCommand = commandService.getCommand(id);
    command = new ParameterizedCommand(newBaseCommand, null);
    newBaseCommand.addCommandListener(commandListener);

    // Get the new values.
    final boolean newChecked = isChecked();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.