Examples of ICommandService


Examples of org.eclipse.ui.commands.ICommandService

    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

Examples of org.eclipse.ui.commands.ICommandService

  public ShowViewMenu(IWorkbenchWindow window, String id, final boolean makeFast) {
    super(id);
    this.window = window;
    final IHandlerService handlerService = (IHandlerService) window
        .getService(IHandlerService.class);
    final ICommandService commandService = (ICommandService) window
        .getService(ICommandService.class);
    final ParameterizedCommand cmd = getCommand(commandService, makeFast);
   
        showDlgAction = new Action(WorkbenchMessages.ShowView_title) {
            public void run() {
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

  /* (non-Javadoc)
   * @see org.eclipse.ui.internal.CycleBaseHandler#getBackwardCommand()
   */
  protected ParameterizedCommand getBackwardCommand() {
    final ICommandService commandService = (ICommandService) window.getWorkbench().getService(ICommandService.class);
    final Command command = commandService.getCommand("org.eclipse.ui.window.previousEditor"); //$NON-NLS-1$
    ParameterizedCommand commandBack = new ParameterizedCommand(command, null);
    return commandBack;
  }
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

  /* (non-Javadoc)
   * @see org.eclipse.ui.internal.CycleBaseHandler#getForwardCommand()
   */
  protected ParameterizedCommand getForwardCommand() {
    final ICommandService commandService = (ICommandService) window.getWorkbench().getService(ICommandService.class);
    final Command command = commandService.getCommand("org.eclipse.ui.window.nextEditor"); //$NON-NLS-1$
    ParameterizedCommand commandF = new ParameterizedCommand(command, null);
    return commandF;
  }
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

              */
            public void partDeactivated( IWorkbenchPartReference partRef )
            {
                if ( partRef.getPart( false ) == instance && contextActivation != null )
                {
                    ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
                        ICommandService.class );
                    if ( commandService != null )
                    {
                        commandService.getCommand( newServer.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( openConfiguration.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( delete.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( rename.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( run.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( stop.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( properties.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 ) == instance )
                {
                    IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
                        IContextService.class );
                    contextActivation = contextService.activateContext( ApacheDsPluginConstants.CONTEXTS_SERVERS_VIEW );

                    ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
                        ICommandService.class );
                    if ( commandService != null )
                    {
                        commandService.getCommand( newServer.getActionDefinitionId() ).setHandler(
                            new ActionHandler( newServer ) );
                        commandService.getCommand( openConfiguration.getActionDefinitionId() ).setHandler(
                            new ActionHandler( openConfiguration ) );
                        commandService.getCommand( delete.getActionDefinitionId() ).setHandler(
                            new ActionHandler( delete ) );
                        commandService.getCommand( rename.getActionDefinitionId() ).setHandler(
                            new ActionHandler( rename ) );
                        commandService.getCommand( run.getActionDefinitionId() ).setHandler( new ActionHandler( run ) );
                        commandService.getCommand( stop.getActionDefinitionId() )
                            .setHandler( new ActionHandler( stop ) );
                        commandService.getCommand( properties.getActionDefinitionId() ).setHandler(
                            new ActionHandler( properties ) );
                    }
                }
            }

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( newSchema.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( newAttributeType.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( newObjectClass.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( openElement.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( openTypeHierarchy.getActionDefinitionId() ).setHandler( null );
                        commandService.getCommand( deleteSchemaElement.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_SCHEMA_VIEW );

                    ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
                        ICommandService.class );
                    if ( commandService != null )
                    {
                        commandService.getCommand( newSchema.getActionDefinitionId() ).setHandler(
                            new ActionHandler( newSchema ) );
                        commandService.getCommand( newAttributeType.getActionDefinitionId() ).setHandler(
                            new ActionHandler( newAttributeType ) );
                        commandService.getCommand( newObjectClass.getActionDefinitionId() ).setHandler(
                            new ActionHandler( newObjectClass ) );
                        commandService.getCommand( openElement.getActionDefinitionId() ).setHandler(
                            new ActionHandler( openElement ) );
                        commandService.getCommand( openTypeHierarchy.getActionDefinitionId() ).setHandler(
                            new ActionHandler( openTypeHierarchy ) );
                        commandService.getCommand( deleteSchemaElement.getActionDefinitionId() ).setHandler(
                            new ActionHandler( deleteSchemaElement ) );
                    }
                }
            }

View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

     * @param workbench
     * @param scope
     */
    protected void processOperations( IWorkbench workbench ){
        IHandlerService handlers = (IHandlerService)workbench.getService( IHandlerService.class );
        ICommandService commands = (ICommandService)workbench.getService( ICommandService.class );
        IMenuService menuService = (IMenuService) workbench.getService(IMenuService.class);
        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
       
        List<IConfigurationElement> list = ExtensionPointList.getExtensionPointList("org.locationtech.udig.ui.operation"); //$NON-NLS-1$
        List<IConfigurationElement> categoryElements = listCategories(list);
        if( categoryElements == null || categoryElements.isEmpty() ) return;
       
        for( IConfigurationElement element : categoryElements ) {
            final String ID = element.getAttribute("id");
            final String NAME = element.getName();
            final String DESCRIPTION = element.getName();
            List<IConfigurationElement> operationElements = listOperationsForCategory(list, ID );
            try {
                // Do not create operation category anymore; only worked for one window
                // categories.put(ID, new OperationCategory(element)); //$NON-NLS-1$
                   
                // Create a Command Category
                Category category = commands.getCategory(ID);
                if( !category.isDefined()){
                    category.define(NAME, DESCRIPTION);                   
                }
                // TODO: Create an ActionSet
               
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

                    return null;
                }
            };

        }
        ICommandService service = (ICommandService) PlatformUI.getWorkbench().getAdapter(
                ICommandService.class);

        Command command = service.getCommand("org.locationtech.udig.tool.edit.clearAction"); //$NON-NLS-1$
        command.setHandler(clearEditBlackboardHandler);
       
        if(clearEditBlackboardCommandListener == null){
            clearEditBlackboardCommandListener  =  new ICommandListener(){
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

     *  Removes a command handler for the "ESC" button.
     *  <p>
     *  Called from <code>EditToolHandler.disableListeners()</code>.
     */
    static synchronized void disableClearBlackboardCommand() {
        ICommandService service = (ICommandService) PlatformUI.getWorkbench().getAdapter(
                ICommandService.class);
        Command command = service.getCommand("org.locationtech.udig.tool.edit.clearAction"); //$NON-NLS-1$

        if(clearEditBlackboardCommandListener != null){
            command.removeCommandListener(clearEditBlackboardCommandListener);
            clearEditBlackboardCommandListener = null;
        }
View Full Code Here

Examples of org.eclipse.ui.commands.ICommandService

    /**
     * Register commands handlers; so they can be used by the keyboard short cut system.
     */
    private void setCommandHandlers() {
        Set<String> ids = new HashSet<String>();
        ICommandService service = (ICommandService) PlatformUI.getWorkbench().getAdapter(
                ICommandService.class);
        for( ModalToolCategory category : modalCategories ) {
            if (!ids.contains(category.getId())) {
                ids.add(category.getId());
                category.setCommandHandlers(service);
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.