Medical Imaging Interaction Toolkit  2018.4.99-c0f884b2
Medical Imaging Interaction Toolkit
berry::IWorkbenchPart Struct Referenceabstract

#include <berryIWorkbenchPart.h>

Inheritance diagram for berry::IWorkbenchPart:
Collaboration diagram for berry::IWorkbenchPart:

Public Member Functions

 berryObjectMacro (berry::IWorkbenchPart, Object)
 
 ~IWorkbenchPart () override
 
virtual void AddPropertyListener (IPropertyChangeListener *listener)=0
 
virtual void CreatePartControl (QWidget *parent)=0
 
virtual SmartPointer< IWorkbenchPartSiteGetSite () const =0
 
virtual QString GetPartName () const =0
 
virtual QString GetContentDescription () const =0
 
virtual QIcon GetTitleImage () const =0
 
virtual QString GetTitleToolTip () const =0
 
virtual void RemovePropertyListener (IPropertyChangeListener *listener)=0
 
virtual QString GetPartProperty (const QString &key) const =0
 
virtual void SetPartProperty (const QString &key, const QString &value)=0
 
virtual const QHash< QString, QString > & GetPartProperties () const =0
 
virtual void SetFocus ()=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 part is a visual component within a workbench page. There are two subtypes: view and editor, as defined by IViewPart and IEditorPart.

A view is typically used to navigate a hierarchy of information (like the workspace), open an editor, or display properties for the active editor. Modifications made in a view are saved immediately.

An editor is typically used to edit or browse a document or input object. The input is identified using an IEditorInput. Modifications made in an editor part follow an open-save-close lifecycle model.

This interface may be implemented directly. For convenience, a base implementation is defined in WorkbenchPart.

The lifecycle of a workbench part is as follows:

  • When a part extension is created:
    • instantiate the part
    • create a part site
    • call part.init(site)
  • When a part becomes visible in the workbench:
    • add part to presentation by calling part.createControl(parent) to create actual widgets
    • fire partOpened event to all listeners
  • When a part is activated or gets focus:
    • call part.setFocus()
    • fire partActivated event to all listeners
  • When a part is closed:
    • if save is needed, do save; if it fails or is canceled return
    • if part is active, deactivate part
    • fire partClosed event to all listeners
    • remove part from presentation; part controls are disposed as part of the SWT widget tree
    • call part.dispose()

After createPartControl has been called, the implementor may safely reference the controls created. When the part is closed these controls will be disposed as part of an SWT composite. This occurs before the IWorkbenchPart.dispose method is called. If there is a need to free SWT resources the part should define a dispose listener for its own control and free those resources from the dispose listener. If the part invokes any method on the disposed SWT controls after this point an SWTError will be thrown.

The last method called on IWorkbenchPart is dispose. This signals the end of the part lifecycle.

An important point to note about this lifecycle is that following a call to init, createControl may never be called. Thus in the dispose method, implementors must not assume controls were created.

Workbench parts implement the IAdaptable interface; extensions are managed by the platform's adapter manager.

See also
IViewPart
IEditorPart

Definition at line 106 of file berryIWorkbenchPart.h.

Constructor & Destructor Documentation

◆ ~IWorkbenchPart()

berry::IWorkbenchPart::~IWorkbenchPart ( )
override

Definition at line 18 of file berryIWorkbenchPart.cpp.

Member Function Documentation

◆ AddPropertyListener()

virtual void berry::IWorkbenchPart::AddPropertyListener ( IPropertyChangeListener listener)
pure virtual

The property id for getTitle, getTitleImage and getTitleToolTip. Adds a listener for changes to properties of this workbench part. Has no effect if an identical listener is already registered.

The property ids are defined in IWorkbenchPartConstants.

Parameters
listenera property listener

Implemented in berry::WorkbenchPart.

◆ berryObjectMacro()

berry::IWorkbenchPart::berryObjectMacro ( berry::IWorkbenchPart  ,
Object   
)

◆ CreatePartControl()

virtual void berry::IWorkbenchPart::CreatePartControl ( QWidget *  parent)
pure virtual

Creates the controls for this workbench part.

Clients should not call this method (the workbench calls this method when it needs to, which may be never).

For implementors this is a multi-step process:

  1. Create one or more controls within the parent.
  2. Set the parent layout as needed.
  3. Register any global actions with the site's IActionBars.
  4. Register any context menus with the site.
  5. Register a selection provider with the site, to make it available to the workbench's ISelectionService (optional).
Parameters
parentthe parent control

Implemented in QmitkFunctionality, berry::WorkbenchPart, berry::QtViewPart, and berry::QtEditorPart.

◆ GetContentDescription()

virtual QString berry::IWorkbenchPart::GetContentDescription ( ) const
pure virtual

Returns the content description of this part. The content description is an optional user-readable string that describes what is currently being displayed in the part. By default, the workbench will display the content description in a line near the top of the view or editor. An empty string indicates no content description text. If this value changes the part must fire a property listener event with IWorkbenchPartConstants#PROP_CONTENT_DESCRIPTION.

Returns
the content description of this part (not null)

Implemented in berry::WorkbenchPart.

◆ GetPartName()

virtual QString berry::IWorkbenchPart::GetPartName ( ) const
pure virtual

Returns the name of this part. If this value changes the part must fire a property listener event with IWorkbenchPartConstants#PROP_PART_NAME.

Returns
the name of this view, or the empty string if the name is being managed by the workbench (not null)

Implemented in berry::WorkbenchPart.

◆ GetPartProperties()

virtual const QHash<QString, QString>& berry::IWorkbenchPart::GetPartProperties ( ) const
pure virtual

Return an unmodifiable map of the arbitrary properties. This method can be used to save the properties during workbench save/restore.

Returns
A Map of the properties. Must not be null.

Implemented in berry::WorkbenchPart.

◆ GetPartProperty()

virtual QString berry::IWorkbenchPart::GetPartProperty ( const QString &  key) const
pure virtual

Return the value for the arbitrary property key, or null.

Parameters
keythe arbitrary property. Must not be null.
Returns
the property value, or null.

Implemented in berry::WorkbenchPart.

◆ GetSite()

virtual SmartPointer<IWorkbenchPartSite> berry::IWorkbenchPart::GetSite ( ) const
pure virtual

Returns the site for this workbench part. The site can be null while the workbench part is being initialized. After the initialization is complete, this value must be non-null for the remainder of the part's life cycle.

Returns
The part site; this value may be null if the part has not yet been initialized

Implemented in berry::WorkbenchPart.

◆ GetTitleImage()

virtual QIcon berry::IWorkbenchPart::GetTitleImage ( ) const
pure virtual

Returns the title image of this workbench part. If this value changes the part must fire a property listener event with PROP_TITLE.

The title image is usually used to populate the title bar of this part's visual container. Since this image is managed by the part itself, callers must not dispose the returned image.

Returns
the title image

Implemented in berry::WorkbenchPart.

◆ GetTitleToolTip()

virtual QString berry::IWorkbenchPart::GetTitleToolTip ( ) const
pure virtual

Returns the title tool tip text of this workbench part. An empty string result indicates no tool tip. If this value changes the part must fire a property listener event with PROP_TITLE.

The tool tip text is used to populate the title bar of this part's visual container.

Returns
the workbench part title tool tip (not null)

Implemented in berry::WorkbenchPart, and berry::EditorPart.

◆ RemovePropertyListener()

virtual void berry::IWorkbenchPart::RemovePropertyListener ( IPropertyChangeListener listener)
pure virtual

Removes the given property listener from this workbench part. Has no affect if an identical listener is not registered.

Parameters
listenera property listener

Implemented in berry::WorkbenchPart.

◆ SetFocus()

virtual void berry::IWorkbenchPart::SetFocus ( )
pure virtual

Asks this part to take focus within the workbench.

Clients should not call this method (the workbench calls this method at appropriate times). To have the workbench activate a part, use IWorkbenchPage.activate(IWorkbenchPart) instead.

Implemented in QmitkFunctionality, berry::WorkbenchPart, QmitkDataManagerView, and QmitkPAUSViewerView.

◆ SetPartProperty()

virtual void berry::IWorkbenchPart::SetPartProperty ( const QString &  key,
const QString &  value 
)
pure virtual

Set an arbitrary property on the part. It is the implementor's responsibility to fire the corresponding PropertyChangeEvent.

A default implementation has been added to WorkbenchPart.

Parameters
keythe arbitrary property. Must not be null.
valuethe property value. A null value will remove that property.

Implemented in berry::WorkbenchPart.


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