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