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