Package org.eclipse.ui.commands

Examples of org.eclipse.ui.commands.ICommandService


    /**
     * Activates the action handlers.
     */
    public void activateGlobalActionHandlers()
    {
        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
            ICommandService.class );

        if ( actionBars != null )
        {
            actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), ( IAction ) browserActionMap
                .get( refreshAction ) );
            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), ( IAction ) browserActionMap
                .get( propertyDialogAction ) );
            actionBars.updateActionBars();
        }
        else
        {
            if ( commandService != null )
            {
                IAction pda = ( IAction ) browserActionMap.get( propertyDialogAction );
                pda.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.properties" );
                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( new ActionHandler( pda ) );

                IAction ra = ( IAction ) browserActionMap.get( refreshAction );
                commandService.getCommand( ra.getActionDefinitionId() ).setHandler( new ActionHandler( ra ) );
            }
        }

        if ( commandService != null )
        {
            IAction ua = ( IAction ) browserActionMap.get( upAction );
            commandService.getCommand( ua.getActionDefinitionId() ).setHandler( new ActionHandler( ua ) );
        }
    }
View Full Code Here


                ( IAction ) this.searchResultEditorActionMap.get( propertyDialogAction ) );
            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), this.showQuickFilterAction );
            actionBars.updateActionBars();
        }

        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
            ICommandService.class );
        if ( commandService != null )
        {
            IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction );
            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( new ActionHandler( nva ) );
            IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction );
            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( new ActionHandler( lid ) );
            IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction );
            commandService.getCommand( osr.getActionDefinitionId() ).setHandler( new ActionHandler( osr ) );
            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler(
                new ActionHandler( openDefaultValueEditorActionProxy ) );
        }
    }
View Full Code Here

            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), null );
            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), null );
            actionBars.updateActionBars();
        }

        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
            ICommandService.class );
        if ( commandService != null )
        {
            IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction );
            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( null );
            IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction );
            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( null );
            IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction );
            commandService.getCommand( osr.getActionDefinitionId() ).setHandler( null );
            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler( null );
        }
    }
View Full Code Here

                .get( refreshAttributesAction ) );
        }

        super.activateGlobalActionHandlers();

        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
            ICommandService.class );
        if ( commandService != null )
        {
            IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
            commandService.getCommand( naa.getActionDefinitionId() ).setHandler( new ActionHandler( naa ) );
            IAction lid = ( IAction ) entryEditorActionMap.get( locateDnInDitAction );
            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( new ActionHandler( lid ) );
            IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
            commandService.getCommand( eada.getActionDefinitionId() ).setHandler( new ActionHandler( eada ) );
        }
    }
View Full Code Here

            actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), null );
        }

        super.deactivateGlobalActionHandlers();

        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
            ICommandService.class );
        if ( commandService != null )
        {
            IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
            commandService.getCommand( naa.getActionDefinitionId() ).setHandler( null );
            IAction lid = ( IAction ) entryEditorActionMap.get( locateDnInDitAction );
            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( null );
            IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
            commandService.getCommand( eada.getActionDefinitionId() ).setHandler( null );
        }
    }
View Full Code Here

        @Override
        public void widgetSelected(SelectionEvent e) {
            IPerspectiveDescriptor perspectiveDescriptor = (IPerspectiveDescriptor) e.widget
                    .getData(KEY_PERSPECTIVE);

            ICommandService commandService = (ICommandService) PlatformUI.getWorkbench()
                    .getService(ICommandService.class);

            Command command = commandService.getCommand("org.eclipse.ui.perspectives.showPerspective");


            Map parameters = new HashMap();
            parameters.put("org.eclipse.ui.perspectives.showPerspective.perspectiveId", perspectiveDescriptor.getId());
            ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, parameters);
View Full Code Here

        .getService(IContextService.class);
    final IContextService contextService = new SlaveContextService(
        parentContextService, defaultExpression);
    serviceLocator.registerService(IContextService.class, contextService);

    final ICommandService parentCommandService = (ICommandService) serviceLocator
        .getService(ICommandService.class);
    final ICommandService commandService = new SlaveCommandService(
        parentCommandService, IServiceScopes.PARTSITE_SCOPE,
        this);
    serviceLocator.registerService(ICommandService.class, commandService);
  }
View Full Code Here

      // already initialized
      return;
    }
    handlerService = (IHandlerService) serviceLocator
        .getService(IHandlerService.class);
    ICommandService commandService = (ICommandService) serviceLocator
        .getService(ICommandService.class);
    createCommand(commandService, commandIdIn, parameterMap);
    if (parameterizedCommand != null) {
      setId(parameterizedCommand.getId());
      try {
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

              */
            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( start.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( LdapServersPluginConstants.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( start.getActionDefinitionId() ).setHandler(
                            new ActionHandler( start ) );
                        commandService.getCommand( stop.getActionDefinitionId() )
                            .setHandler( new ActionHandler( stop ) );
                        commandService.getCommand( properties.getActionDefinitionId() ).setHandler(
                            new ActionHandler( properties ) );
                    }
                }
            }

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.