Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
berry::EditorPart Class Referenceabstract

#include <berryEditorPart.h>

Inheritance diagram for berry::EditorPart:
Collaboration diagram for berry::EditorPart:

Public Member Functions

 berryObjectMacro (EditorPart, WorkbenchPart, IEditorPart)
 
void DoSave () override=0
 
void DoSaveAs () override=0
 
IEditorInput::Pointer GetEditorInput () const override
 
IEditorSite::Pointer GetEditorSite () const override
 
QString GetTitleToolTip () const override
 
void Init (IEditorSite::Pointer site, IEditorInput::Pointer input) override=0
 
bool IsDirty () const override=0
 
bool IsSaveAsAllowed () const override=0
 
bool IsSaveOnCloseNeeded () const override
 
- Public Member Functions inherited from berry::WorkbenchPart
 berryObjectMacro (WorkbenchPart, QObject, IWorkbenchPart, IExecutableExtension)
 
 ~WorkbenchPart () override
 
void AddPropertyListener (IPropertyChangeListener *l) override
 
void RemovePropertyListener (IPropertyChangeListener *l) override
 
void SetPartProperty (const QString &key, const QString &value) override
 
QString GetPartProperty (const QString &key) const override
 
const QHash< QString, QString > & GetPartProperties () const override
 
void SetInitializationData (const IConfigurationElement::Pointer &cfig, const QString &propertyName, const Object::Pointer &data) override
 
void CreatePartControl (QWidget *parent) override=0
 
void SetFocus () override=0
 
IWorkbenchPartSite::Pointer GetSite () const override
 
QString GetPartName () const override
 
QString GetContentDescription () const override
 
QIcon GetTitleImage () const override
 
QString GetTitleToolTip () const override
 
- Public Member Functions inherited from berry::IWorkbenchPart
 berryObjectMacro (berry::IWorkbenchPart, Object)
 
 ~IWorkbenchPart () override
 
- 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
 
- Public Member Functions inherited from berry::IExecutableExtension
virtual ~IExecutableExtension ()
 
virtual void SetInitializationData (const SmartPointer< IConfigurationElement > &config, const QString &propertyName, const Object::Pointer &data)=0
 
- Public Member Functions inherited from berry::IEditorPart
 berryObjectMacro (berry::IEditorPart, IWorkbenchPart, ISaveablePart)
 
 ~IEditorPart () override
 
virtual void Init (SmartPointer< IEditorSite > site, SmartPointer< IEditorInput > input)=0
 
- Public Member Functions inherited from berry::ISaveablePart
 berryObjectMacro (berry::ISaveablePart)
 

Protected Member Functions

 EditorPart ()
 
virtual void SetInput (IEditorInput::Pointer input)
 
virtual void SetInputWithNotify (IEditorInput::Pointer input)
 
void SetContentDescription (const QString &description) override
 
void SetPartName (const QString &partName) override
 
void CheckSite (IWorkbenchPartSite::Pointer site) override
 
- Protected Member Functions inherited from berry::WorkbenchPart
 WorkbenchPart ()
 
IConfigurationElement::Pointer GetConfigurationElement () const
 
void SetSite (IWorkbenchPartSite::Pointer site)
 
virtual void SetTitleImage (const QIcon &titleImage)
 
virtual void SetTitleToolTip (const QString &toolTip)
 
void FirePropertyChanged (const QString &key, const QString &oldValue, const QString &newValue)
 
void FirePropertyChange (int propertyId)
 
- 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
 

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 ()
 
- Static Public Attributes inherited from berry::ISaveablePart
static const int PROP_DIRTY
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

Abstract base implementation of all workbench editors.

This class should be subclassed by clients wishing to define new editors. The name of the subclass should be given as the "class" attribute in a editor extension contributed to the workbench's editor extension point (named "org.mitk.ui.editors"). For example, the plug-in's XML markup might contain:

<extension point="org.blueberry.ui.editors">
<editor id="com.example.myplugin.ed"
name="My Editor"
icon="./images/cedit.gif"
extensions="foo"
class="com.example.myplugin.MyFooEditor"
contributorClass="com.example.myplugin.MyFooEditorContributor" />
</extension>

where com.example.myplugin.MyEditor is the name of the EditorPart subclass.

Subclasses must implement the following methods:

  • IEditorPart.init - to initialize editor when assigned its site
  • IWorkbenchPart.createPartControl - to create the editor's controls
  • IWorkbenchPart.setFocus - to accept focus
  • IEditorPart.isDirty - to decide whether a significant change has occurred
  • IEditorPart.doSave - to save contents of editor
  • IEditorPart.doSaveAs - to save contents of editor
  • IEditorPart.isSaveAsAllowed - to control Save As

Subclasses may extend or reimplement the following methods as required:

  • IExecutableExtension.setInitializationData - extend to provide additional initialization when editor extension is instantiated
  • IWorkbenchPart.dispose - extend to provide additional cleanup
  • IAdaptable.getAdapter - reimplement to make the editor adaptable

Definition at line 71 of file berryEditorPart.h.

Constructor & Destructor Documentation

◆ EditorPart()

berry::EditorPart::EditorPart ( )
protected

Creates a new workbench editor.

Member Function Documentation

◆ berryObjectMacro()

berry::EditorPart::berryObjectMacro ( EditorPart  ,
WorkbenchPart  ,
IEditorPart   
)

◆ CheckSite()

void berry::EditorPart::CheckSite ( IWorkbenchPartSite::Pointer  site)
overrideprotectedvirtual

Checks that the given site is valid for this type of part. The site for an editor must be an IEditorSite.

Parameters
sitethe site to check
Since
3.1

Reimplemented from berry::WorkbenchPart.

◆ DoSave()

void berry::EditorPart::DoSave ( )
overridepure virtual

Saves the contents of this part.

If the save is successful, the part should fire a property changed event reflecting the new dirty state (PROP_DIRTY property).

If the save is cancelled through user action, or for any other reason, the part should invoke setCancelled on the IProgressMonitor to inform the caller.

This method is long-running; progress and cancellation are provided by the given progress monitor.

Implements berry::ISaveablePart.

Implemented in QmitkAbstractRenderEditor.

◆ DoSaveAs()

void berry::EditorPart::DoSaveAs ( )
overridepure virtual

Saves the contents of this part to another object.

Implementors are expected to open a "Save As" dialog where the user will be able to select a new name for the contents. After the selection is made, the contents should be saved to that new name. During this operation a IProgressMonitor should be used to indicate progress.

If the save is successful, the part fires a property changed event reflecting the new dirty state (PROP_DIRTY property).

Implements berry::ISaveablePart.

Implemented in QmitkAbstractRenderEditor.

◆ GetEditorInput()

IEditorInput::Pointer berry::EditorPart::GetEditorInput ( ) const
overridevirtual

The property id for getEditorInput. Returns the input for this editor. If this value changes the part must fire a property listener event with PROP_INPUT.

Returns
the editor input

Implements berry::IEditorPart.

◆ GetEditorSite()

IEditorSite::Pointer berry::EditorPart::GetEditorSite ( ) const
overridevirtual

Returns the site for this editor. This method is equivalent to (IEditorSite) getSite().

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

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

Implements berry::IEditorPart.

◆ GetTitleToolTip()

QString berry::EditorPart::GetTitleToolTip ( ) const
overridevirtual

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)

Implements berry::IWorkbenchPart.

◆ Init()

void berry::EditorPart::Init ( IEditorSite::Pointer  site,
IEditorInput::Pointer  input 
)
overridepure virtual

Implemented in QmitkAbstractRenderEditor.

◆ IsDirty()

bool berry::EditorPart::IsDirty ( ) const
overridepure virtual

Returns whether the contents of this part have changed since the last save operation. If this value changes the part must fire a property listener event with PROP_DIRTY.

Note: this method is called often on a part open or part activation switch, for example by actions to determine their enabled status.

Returns
true if the contents have been modified and need saving, and false if they have not changed since the last save

Implements berry::ISaveablePart.

Implemented in QmitkAbstractRenderEditor.

◆ IsSaveAsAllowed()

bool berry::EditorPart::IsSaveAsAllowed ( ) const
overridepure virtual

Returns whether the "Save As" operation is supported by this part.

Returns
true if "Save As" is supported, and false if not supported

Implements berry::ISaveablePart.

Implemented in QmitkAbstractRenderEditor.

◆ IsSaveOnCloseNeeded()

bool berry::EditorPart::IsSaveOnCloseNeeded ( ) const
overridevirtual

Returns whether the contents of this part should be saved when the part is closed.

Returns
true if the contents of the part should be saved on close, and false if the contents are expendable

Implements berry::ISaveablePart.

◆ SetContentDescription()

void berry::EditorPart::SetContentDescription ( const QString &  description)
overrideprotectedvirtual

Sets the content description for this part. The content description is typically a short string describing the current contents of the part. Setting this to the empty string will cause a default content description to be used. Clients should call this method instead of overriding getContentDescription(). For views, the content description is shown (by default) in a line near the top of the view. For editors, the content description is shown beside the part name when showing a list of editors. If the editor is open on a file, this typically contains the path to the input file, without the filename or trailing slash.

Parameters
descriptionthe content description

Reimplemented from berry::WorkbenchPart.

◆ SetInput()

virtual void berry::EditorPart::SetInput ( IEditorInput::Pointer  input)
protectedvirtual

Sets the input to this editor. This method simply updates the internal member variable.

Unlike most of the other set methods on this class, this method does not fire a property change. Clients that call this method from a subclass must ensure that they fire an IWorkbenchPartConstants.PROP_INPUT property change after calling this method but before leaving whatever public method they are in. Clients that expose this method as public API must fire the property change within their implementation of setInput.

Note that firing a property change may cause listeners to immediately reach back and call methods on this editor. Care should be taken not to fire the property change until the editor has fully updated its internal state to reflect the new input.

Parameters
inputthe editor input
See also
SetInputWithNotify

◆ SetInputWithNotify()

virtual void berry::EditorPart::SetInputWithNotify ( IEditorInput::Pointer  input)
protectedvirtual

Sets the input to this editor and fires a PROP_INPUT property change if the input has changed. This is the convenience method implementation.

Note that firing a property change may cause other objects to reach back and invoke methods on the editor. Care should be taken not to call this method until the editor has fully updated its internal state to reflect the new input.

Since
3.2
Parameters
inputthe editor input

◆ SetPartName()

void berry::EditorPart::SetPartName ( const QString &  partName)
overrideprotectedvirtual

Sets the name of this part. The name will be shown in the tab area for the part. Clients should call this method instead of overriding getPartName. Setting this to the empty string will cause a default part name to be used.

Parameters
partNamethe part name, as it should be displayed in tabs.

Reimplemented from berry::WorkbenchPart.


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