Package org.eclipse.ui.commands

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


   */
  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

  /* 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

              */
            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

   
    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

  /**
   * 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

        .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

        .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

    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

    final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
        .getActiveWorkbenchWindowChecked(event);
    if (activeWorkbenchWindow instanceof WorkbenchWindow) {
      WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
      window.toggleToolbarVisibility();
      ICommandService commandService = (ICommandService) activeWorkbenchWindow
          .getService(ICommandService.class);
      Map filter = new HashMap();
      filter.put(IServiceScopes.WINDOW_SCOPE, window);
      commandService.refreshElements(event.getCommand().getId(), filter);
    }

    return null;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.commands.ICommandService

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.