Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
berry::IWorkbench Struct Referenceabstract

#include <berryIWorkbench.h>

Inheritance diagram for berry::IWorkbench:
Collaboration diagram for berry::IWorkbench:

Public Member Functions

 berryObjectMacro (berry::IWorkbench)
 
 ~IWorkbench () override
 
virtual DisplayGetDisplay () const =0
 
virtual void AddWorkbenchListener (IWorkbenchListener *listener)=0
 
virtual void RemoveWorkbenchListener (IWorkbenchListener *listener)=0
 
virtual IWorkbenchListener::EventsGetWorkbenchEvents ()=0
 
virtual void AddWindowListener (IWindowListener *listener)=0
 
virtual void RemoveWindowListener (IWindowListener *listener)=0
 
virtual IWindowListener::EventsGetWindowEvents ()=0
 
virtual bool Close ()=0
 
virtual IWorkbenchWindow::Pointer GetActiveWorkbenchWindow () const =0
 
virtual IExtensionTrackerGetExtensionTracker () const =0
 
virtual IPerspectiveRegistryGetPerspectiveRegistry () const =0
 
virtual IViewRegistryGetViewRegistry () const =0
 
virtual IEditorRegistryGetEditorRegistry () const =0
 
virtual std::size_t GetWorkbenchWindowCount () const =0
 
virtual QList< IWorkbenchWindow::PointerGetWorkbenchWindows () const =0
 
virtual IWorkbenchWindow::Pointer OpenWorkbenchWindow (const QString &perspectiveId, IAdaptable *input)=0
 
virtual IWorkbenchWindow::Pointer OpenWorkbenchWindow (IAdaptable *input)=0
 
virtual SmartPointer< IWorkbenchPageShowPerspective (const QString &perspectiveId, IWorkbenchWindow::Pointer window)=0
 
virtual SmartPointer< IWorkbenchPageShowPerspective (const QString &perspectiveId, IWorkbenchWindow::Pointer window, IAdaptable *input)=0
 
virtual bool SaveAllEditors (bool confirm)=0
 
virtual IElementFactoryGetElementFactory (const QString &factoryId) const =0
 
virtual IIntroManagerGetIntroManager () const =0
 
virtual bool IsClosing () const =0
 
virtual void UpdateTheme ()=0
 
- Public Member Functions inherited from berry::IServiceLocator
 berryObjectMacro (berry::IServiceLocator, Object)
 
 ~IServiceLocator () override
 
template<class S >
S * GetService ()
 
template<class S >
bool HasService () const
 
virtual ObjectGetService (const QString &api)=0
 
virtual bool HasService (const QString &api) const =0
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
virtual QString ToString () const
 
virtual uint HashCode () const
 
virtual bool operator< (const Object *) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
virtual bool operator== (const Object *) const
 

Additional Inherited Members

- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

A workbench is the root object for the BlueBerry Platform user interface.

A workbench has one or more main windows which present to the end user information based on some underlying model, typically on resources in an underlying workspace. A workbench usually starts with a single open window, and automatically closes when its last window closes.

Each workbench window has a collection of pages; the active page is the one that is being presented to the end user; at most one page is active in a window at a time.

Each workbench page has a collection of workbench parts, of which there are two kinds: views and editors. A page's parts are arranged (tiled or stacked) for presentation on the screen. The arrangement is not fixed; the user can arrange the parts as they see fit. A perspective is a template for a page, capturing a collection of parts and their arrangement.

The platform creates a workbench when the workbench plug-in is activated; since this happens at most once during the life of the running platform, there is only one workbench instance. Due to its singular nature, it is commonly referred to as the workbench.

The workbench supports a few services by default. If these services are used to allocate resources, it is important to remember to clean up those resources after you are done with them. Otherwise, the resources will exist until the workbench shuts down. The supported services are:

This interface is not intended to be implemented by clients.

See also
PlatformUI::GetWorkbench

Definition at line 80 of file berryIWorkbench.h.

Constructor & Destructor Documentation

◆ ~IWorkbench()

berry::IWorkbench::~IWorkbench ( )
override

Member Function Documentation

◆ AddWindowListener()

virtual void berry::IWorkbench::AddWindowListener ( IWindowListener listener)
pure virtual

Adds a window listener.

Parameters
listenerthe window listener to add
Since
2.0

◆ AddWorkbenchListener()

virtual void berry::IWorkbench::AddWorkbenchListener ( IWorkbenchListener listener)
pure virtual

Adds a workbench listener.

Parameters
listenerthe workbench listener to add
Since
3.2

◆ berryObjectMacro()

berry::IWorkbench::berryObjectMacro ( berry::IWorkbench  )

◆ Close()

virtual bool berry::IWorkbench::Close ( )
pure virtual

Closes this workbench and all its open windows.

If the workbench has an open editor with unsaved content, the user will be given the opportunity to save it.

Returns
true if the workbench was successfully closed, and false if it is still open

◆ GetActiveWorkbenchWindow()

virtual IWorkbenchWindow::Pointer berry::IWorkbench::GetActiveWorkbenchWindow ( ) const
pure virtual

Returns the currently active window for this workbench (if any). Returns null if there is no active workbench window. Returns null if called from a non-UI thread.

Returns
the active workbench window, or null if there is no active workbench window or if called from a non-UI thread

◆ GetDisplay()

virtual Display* berry::IWorkbench::GetDisplay ( ) const
pure virtual

Returns the display for this workbench.

Code should always ask the workbench for the display rather than rely on Display.getDefault().

Returns
the display to be used for all UI interactions with this workbench

◆ GetEditorRegistry()

virtual IEditorRegistry* berry::IWorkbench::GetEditorRegistry ( ) const
pure virtual

Returns the editor registry for the workbench.

Returns
the workbench editor registry

◆ GetElementFactory()

virtual IElementFactory* berry::IWorkbench::GetElementFactory ( const QString &  factoryId) const
pure virtual

Returns the element factory with the given id. The calles takes ownership of the returned pointer.

Parameters
factoryIdthe id of the element factory
Returns
the element factory, or null if none
See also
IElementFactory

◆ GetExtensionTracker()

virtual IExtensionTracker* berry::IWorkbench::GetExtensionTracker ( ) const
pure virtual

Return the extension tracker for the workbench. This tracker may be used by plug-ins to ensure responsiveness to changes to the plug-in registry.

The tracker at this level of the workbench is typically used to track elements that persist for the life of the workbench. For example, IEditorDescriptor objects fall into this category.

Returns
the extension tracker
See also
IWorkbenchWindow::GetExtensionTracker()
IWorkbenchPage::GetExtensionTracker()

◆ GetIntroManager()

virtual IIntroManager* berry::IWorkbench::GetIntroManager ( ) const
pure virtual

Return the intro manager for this workbench.

Returns
the intro manager for this workbench. Guaranteed not to be null.

◆ GetPerspectiveRegistry()

virtual IPerspectiveRegistry* berry::IWorkbench::GetPerspectiveRegistry ( ) const
pure virtual

Returns the perspective registry for the workbench.

Returns
the workbench perspective registry

◆ GetViewRegistry()

virtual IViewRegistry* berry::IWorkbench::GetViewRegistry ( ) const
pure virtual

Returns the view registry for the workbench.

Returns
the workbench view registry
Since
3.1

◆ GetWindowEvents()

virtual IWindowListener::Events& berry::IWorkbench::GetWindowEvents ( )
pure virtual

Returns the window events object

◆ GetWorkbenchEvents()

virtual IWorkbenchListener::Events& berry::IWorkbench::GetWorkbenchEvents ( )
pure virtual

Returns the workbench events object

◆ GetWorkbenchWindowCount()

virtual std::size_t berry::IWorkbench::GetWorkbenchWindowCount ( ) const
pure virtual

Returns the number of open main windows associated with this workbench. Note that wizards and dialogs are not included in this list since they are not considered main windows.

Returns
the number of open windows
Since
3.0

◆ GetWorkbenchWindows()

virtual QList<IWorkbenchWindow::Pointer> berry::IWorkbench::GetWorkbenchWindows ( ) const
pure virtual

Returns a list of the open main windows associated with this workbench. Note that wizards and dialogs are not included in this list since they are not considered main windows.

Returns
a list of open windows

◆ IsClosing()

virtual bool berry::IWorkbench::IsClosing ( ) const
pure virtual

Returns a boolean indicating whether the workbench is in the process of closing.

Returns
true if the workbench is in the process of closing, false otherwise
Since
3.1

◆ OpenWorkbenchWindow() [1/2]

virtual IWorkbenchWindow::Pointer berry::IWorkbench::OpenWorkbenchWindow ( const QString &  perspectiveId,
IAdaptable input 
)
pure virtual

Creates and opens a new workbench window with one page. The perspective of the new page is defined by the specified perspective ID. The new window and new page become active.

Note: The caller is responsible to ensure the action using this method will explicitly inform the user a new window will be opened. Otherwise, callers are strongly recommended to use the openPerspective APIs to programmatically show a perspective to avoid confusing the user.

In most cases where this method is used the caller is tightly coupled to a particular perspective. They define it in the registry and contribute some user interface action to open or activate it. In situations like this a static variable is often used to identify the perspective ID.

Parameters
perspectiveIdthe perspective id for the window's initial page, or null for no initial page
inputthe page input, or null if there is no current input. This is used to seed the input for the new page's views.
Returns
the new workbench window
Exceptions
WorkbenchExceptionif a new window and page could not be opened
See also
IWorkbench::showPerspective(String, IWorkbenchWindow, IAdaptable)

◆ OpenWorkbenchWindow() [2/2]

virtual IWorkbenchWindow::Pointer berry::IWorkbench::OpenWorkbenchWindow ( IAdaptable input)
pure virtual

Creates and opens a new workbench window with one page. The perspective of the new page is defined by the default perspective ID. The new window and new page become active.

Note: The caller is responsible to ensure the action using this method will explicitly inform the user a new window will be opened. Otherwise, callers are strongly recommended to use the openPerspective APIs to programmatically show a perspective to avoid confusing the user.

Parameters
inputthe page input, or null if there is no current input. This is used to seed the input for the new page's views.
Returns
the new workbench window
Exceptions
WorkbenchExceptionif a new window and page could not be opened
See also
IWorkbench::showPerspective(String, IWorkbenchWindow, IAdaptable)

◆ RemoveWindowListener()

virtual void berry::IWorkbench::RemoveWindowListener ( IWindowListener listener)
pure virtual

Removes a window listener.

Parameters
listenerthe window listener to remove
Since
2.0

◆ RemoveWorkbenchListener()

virtual void berry::IWorkbench::RemoveWorkbenchListener ( IWorkbenchListener listener)
pure virtual

Removes a workbench listener.

Parameters
listenerthe workbench listener to remove
Since
3.2

◆ SaveAllEditors()

virtual bool berry::IWorkbench::SaveAllEditors ( bool  confirm)
pure virtual

Save all dirty editors in the workbench. Opens a dialog to prompt the user if confirm is true. Return true if successful. Return false if the user has canceled the command.

Parameters
confirmtrue to ask the user before saving unsaved changes (recommended), and false to save unsaved changes without asking
Returns
true if the command succeeded, and false if the operation was canceled by the user or an error occurred while saving

◆ ShowPerspective() [1/2]

virtual SmartPointer<IWorkbenchPage> berry::IWorkbench::ShowPerspective ( const QString &  perspectiveId,
IWorkbenchWindow::Pointer  window 
)
pure virtual

Shows the specified perspective to the user. The caller should use this method when the perspective to be shown is not dependent on the page's input. That is, the perspective can open in any page depending on user preferences.

The perspective may be shown in the specified window, in another existing window, or in a new window depending on user preferences. The exact policy is controlled by the workbench to ensure consistency to the user. The policy is subject to change. The current policy is as follows:

  • If the specified window has the requested perspective open, then the window is given focus and the perspective is shown. The page's input is ignored.
  • If another window that has the workspace root as input and the requested perspective open and active, then the window is given focus.
  • Otherwise the requested perspective is opened and shown in the specified window or in a new window depending on the current user preference for opening perspectives, and that window is given focus.

The workbench also defines a number of menu items to activate or open each registered perspective. A complete list of these perspectives is available from the perspective registry found on IWorkbench.

Parameters
perspectiveIdthe perspective ID to show
windowthe workbench window of the action calling this method.
Returns
the workbench page that the perspective was shown
Exceptions
WorkbenchExceptionif the perspective could not be shown
Since
2.0

◆ ShowPerspective() [2/2]

virtual SmartPointer<IWorkbenchPage> berry::IWorkbench::ShowPerspective ( const QString &  perspectiveId,
IWorkbenchWindow::Pointer  window,
IAdaptable input 
)
pure virtual

Shows the specified perspective to the user. The caller should use this method when the perspective to be shown is dependent on the page's input. That is, the perspective can only open in any page with the specified input.

The perspective may be shown in the specified window, in another existing window, or in a new window depending on user preferences. The exact policy is controlled by the workbench to ensure consistency to the user. The policy is subject to change. The current policy is as follows:

  • If the specified window has the requested perspective open and the same requested input, then the window is given focus and the perspective is shown.
  • If another window has the requested input and the requested perspective open and active, then that window is given focus.
  • If the specified window has the same requested input but not the requested perspective, then the window is given focus and the perspective is opened and shown on condition that the user preference is not to open perspectives in a new window.
  • Otherwise the requested perspective is opened and shown in a new window, and the window is given focus.

The workbench also defines a number of menu items to activate or open each registered perspective. A complete list of these perspectives is available from the perspective registry found on IWorkbench.

Parameters
perspectiveIdthe perspective ID to show
windowthe workbench window of the action calling this method.
inputthe page input, or null if there is no current input. This is used to seed the input for the page's views
Returns
the workbench page that the perspective was shown
Exceptions
WorkbenchExceptionif the perspective could not be shown
Since
2.0

◆ UpdateTheme()

virtual void berry::IWorkbench::UpdateTheme ( )
pure virtual

Applies changes of the current theme to the user interface.


The documentation for this struct was generated from the following file: