*/
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 ) );
}
}
}