Medical Imaging Interaction Toolkit
2024.06.00
Medical Imaging Interaction Toolkit
|
#include <berryWorkbenchAdvisor.h>
Public Member Functions | |
void | InternalBasicInitialize (IWorkbenchConfigurer::Pointer configurer) |
virtual void | Initialize (IWorkbenchConfigurer::Pointer configurer) |
virtual void | PreStartup () |
virtual void | PostStartup () |
virtual bool | PreShutdown () |
virtual void | PostShutdown () |
virtual WorkbenchWindowAdvisor * | CreateWorkbenchWindowAdvisor (IWorkbenchWindowConfigurer::Pointer configurer)=0 |
virtual IAdaptable * | GetDefaultPageInput () |
virtual QString | GetInitialWindowPerspectiveId ()=0 |
virtual QString | GetMainPreferencePageId () |
virtual bool | OpenWindows () |
virtual bool | SaveState (IMemento::Pointer memento) |
virtual bool | RestoreState (IMemento::Pointer memento) |
Protected Member Functions | |
WorkbenchAdvisor () | |
virtual | ~WorkbenchAdvisor () |
IWorkbenchConfigurer::Pointer | GetWorkbenchConfigurer () |
public: base class for configuring the workbench.
Note that the workbench advisor object is created in advance of creating the workbench. However, by the time the workbench starts calling methods on this class, PlatformUI::GetWorkbench()
is guaranteed to have been properly initialized.
Example of creating and running a workbench (in an berry::IApplication
):
class MyApplication : public berry::IApplication {
public:
int Start()
{
WorkbenchAdvisor* workbenchAdvisor = new MyWorkbenchAdvisor();
berry::Display* display = berry::PlatformUI::CreateDisplay();
int returnCode = berry::PlatformUI::CreateAndRunWorkbench(display, workbenchAdvisor);
if (returnCode == PlatformUI::RETURN_RESTART) {
return berry::IApplication::EXIT_RESTART;
} else {
return berry::IApplication::EXIT_OK;
}
};
An application should declare a subclass of berry::WorkbenchAdvisor
and override methods to configure the workbench to suit the needs of the particular application.
The following advisor methods are called at strategic points in the workbench's lifecycle (all occur within the dynamic scope of the call to PlatformUI::CreateAndRunWorkbench()
):
Definition at line 92 of file berryWorkbenchAdvisor.h.
|
protected |
Creates and initializes a new workbench advisor instance.
|
protectedvirtual |
|
pure virtual |
Creates a new workbench window advisor for configuring a new workbench window via the given workbench window configurer. Clients should override to provide their own window configurer.
configurer | the workbench window configurer |
|
virtual |
Returns the default input for newly created workbench pages when the input is not explicitly specified.
The default implementation returns null
. Subclasses may override.
null
if none
|
pure virtual |
Returns the id of the perspective to use for the initial workbench window, or null
if no initial perspective should be shown in the initial workbench window.
This method is called during startup when the workbench is creating the first new window. Subclasses must implement.
If the WorkbenchPreferenceConstants::DEFAULT_PERSPECTIVE_ID
preference is specified, it supercedes the perspective specified here.
null
if no initial perspective should be shown
|
virtual |
Returns the id of the preference page that should be presented most prominently.
The default implementation returns null
. Subclasses may override.
null
if none
|
protected |
Returns the workbench configurer for the advisor. Can be null
if the advisor is not initialized yet.
null
if the advisor is not initialized yet
|
virtual |
Performs arbitrary initialization before the workbench starts running.
This method is called during workbench initialization prior to any windows being opened. Clients must not call this method directly (although super calls are okay). The default implementation does nothing. Subclasses may override. Typical clients will use the configurer passed in to tweak the workbench. If further tweaking is required in the future, the configurer may be obtained using GetWorkbenchConfigurer()
.
configurer | an object for configuring the workbench |
Reimplemented in berry::QtWorkbenchAdvisor.
void berry::WorkbenchAdvisor::InternalBasicInitialize | ( | IWorkbenchConfigurer::Pointer | configurer | ) |
Remembers the configurer and calls Initialize()
.
For internal use by the workbench only.
configurer | an object for configuring the workbench |
|
virtual |
Opens the workbench windows on startup. The default implementation tries to restore the previously saved workbench state using IWorkbenchConfigurer::RestoreState()
. If there was no previously saved state, or if the restore failed, then a first-time window is opened using IWorkbenchConfigurer::OpenFirstTimeWindow().
true
to proceed with workbench startup, or false
to exit
|
virtual |
Performs arbitrary finalization after the workbench stops running.
This method is called during workbench shutdown after all windows have been closed. Clients must not call this method directly (although super calls are okay). The default implementation does nothing. Subclasses may override.
|
virtual |
Performs arbitrary actions after the workbench windows have been opened (or restored), but before the main event loop is run.
This method is called just after the windows have been opened. Clients must not call this method directly (although super calls are okay). The default implementation does nothing. Subclasses may override. It is okay to call IWorkbench::Close()
from this method.
|
virtual |
Performs arbitrary finalization before the workbench is about to shut down.
This method is called immediately prior to workbench shutdown before any windows have been closed. Clients must not call this method directly (although super calls are okay). The default implementation returns true
. Subclasses may override.
The advisor may veto a regular shutdown by returning false
, although this will be ignored if the workbench is being forced to shut down.
true
to allow the workbench to proceed with shutdown, false
to veto a non-forced shutdown
|
virtual |
Performs arbitrary actions just before the first workbench window is opened (or restored).
This method is called after the workbench has been initialized and just before the first window is about to be opened. Clients must not call this method directly (although super calls are okay). The default implementation does nothing. Subclasses may override.
|
virtual |
Restores arbitrary application-specific state information for this workbench advisor.
The default implementation simply returns an OK status. Subclasses may extend or override.
memento | the memento from which to restore the advisor's state |
|
virtual |
Saves arbitrary application-specific state information for this workbench advisor.
The default implementation simply returns an OK status. Subclasses may extend or override.
memento | the memento in which to save the advisor's state |