org.csstudio.startup.module
Interface ProjectExtPoint

All Superinterfaces:
CSSStartupExtensionPoint
All Known Implementing Classes:
DefaultProject

public interface ProjectExtPoint
extends CSSStartupExtensionPoint

ProjectExtPoint defines methods which will open or close the projects that belong to the application context.

Author:
Jaka Bobnar

Field Summary
static java.lang.String NAME
          The name of this extension point element
static java.lang.String PROJECTS
          The tag under which the opened projects should be stored in the parameters
 
Method Summary
 java.lang.Object closeProjects(Display display, IApplicationContext context, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Called by Application to allow implementors of the CSSStartupExtensionPoint to perform project cleanup in case that is considered necessary.
 java.lang.Object openProjects(Display display, IApplicationContext context, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Opens the projects defined by the given application context.
 

Field Detail

NAME

static final java.lang.String NAME
The name of this extension point element

See Also:
Constant Field Values

PROJECTS

static final java.lang.String PROJECTS
The tag under which the opened projects should be stored in the parameters

See Also:
Constant Field Values
Method Detail

openProjects

java.lang.Object openProjects(Display display,
                              IApplicationContext context,
                              java.util.Map<java.lang.String,java.lang.Object> parameters)
                              throws java.lang.Exception
Opens the projects defined by the given application context. The implementation should also take care of initialization of projects and any other actions required for them to run properly. The projects that were run should be placed inside the parameters map under the tag "css.projects" to enable their usage by other extension point.

Parameters:
context - the application's context
parameters - contains additional parameters, which can define some special behaviour during the execution of this method (the keys are parameters names and the values are parameters values)
Returns:
the exit code if something happened which requires to exit or restart application or null if everything is alright
Throws:
java.lang.Exception - if an error occurred during the operation

closeProjects

java.lang.Object closeProjects(Display display,
                               IApplicationContext context,
                               java.util.Map<java.lang.String,java.lang.Object> parameters)
                               throws java.lang.Exception
Called by Application to allow implementors of the CSSStartupExtensionPoint to perform project cleanup in case that is considered necessary.

In principle this method could close all those projects that were previously opened by #openProjects(IApplicationContext) method but it is not mandatory that the implementation follows the rules.

In most cases, one should actually NOT close any projects in here. The suggested way to assert that all resources are properly saved on exiting CSS is to call ResourcesPlugin.getWorkspace().save(true, new NullProgressMonitor()); from the WorkbenchAdvisor's preShutdown() method. RCP will invoke that preShutdown() when the workbench is about to close as part of the workbench run cycle. This closeProjects() method is actually called later from the Application code and in fact results in an "exited with unsaved changes" warning on the following startup of CSS.

Parameters:
context - the application's context
parameters - contains additional parameters, which can define some special behaviour during the execution of this method (the keys are parameters names and the values are parameters values)
Returns:
the exit code if something happened which requires to exit or restart application or null if everything is alright
Throws:
java.lang.Exception - if an error occurred during the operation