Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
Workbench

Internal and External Editors

Identifier

org.blueberry.ui.editors

Description

This extension point is used to add new editors to the workbench. A editor is a visual component within a workbench page. It is typically used to edit or browse a document or input object. To open an editor, the user will typically invoke "Open" on an IFile. When this action is performed the workbench registry is consulted to determine an appropriate editor for the file type and then a new instance of the editor type is created. The actual result depends on the type of the editor. The workbench provides support for the creation of internal editors, which are tightly integrated into the workbench, and external editors, which are launched in a separate frame window. There are also various levels of integration between these extremes.

In the case of an internal editor tight integration can be achieved between the workbench window and the editor part. The workbench menu and toolbar are pre-loaded with a number of common actions, such as cut, copy, and paste. The active part, view or editor, is expected to provide the implementation for these actions. An internal editor may also define new actions which appear in the workbench window. These actions only appear when the editor is active.

The integration between the workbench and external editors is more tenuous. In this case the workbench may launch an editor but after has no way of determining the state of the external editor or collaborating with it by any means except through the file system.

Configuration Markup

<!ELEMENT extension (editor*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
  • point: a fully qualified identifier of the target extension point
  • id: an optional identifier of the extension instance
  • name: an optional name of the extension instance
<!ELEMENT editor (contentTypeBinding*)>
<!ATTLIST editor
id CDATA #REQUIRED
name CDATA #REQUIRED
icon CDATA #IMPLIED
extensions CDATA #IMPLIED
class CDATA #IMPLIED
command CDATA #IMPLIED
launcher CDATA #IMPLIED
contributorClass CDATA #IMPLIED
default (true | false) "false"
filenames CDATA #IMPLIED
matchingStrategy CDATA #IMPLIED>
  • id: a unique name that will be used to identify this editor
  • name: a translatable name that will be used in the UI for this editor
  • icon: A relative name of the icon that will be used for all resources that match the specified extensions. Editors should provide an icon to make it easy for users to distinguish between different editor types. If you specify a command rather than a class, an icon is not needed. In that case, the workbench will use the icon provided by the operating system.
  • extensions: an optional field containing the list of file types understood by the editor. This is a string containing comma separate file extensions. For instance, an editor which understands hypertext documents may register for "htm, html".
  • class: the name of a class that implements berry::IEditorPart. The attributes class , command , and launcher are mutually exclusive. If this attribute is defined then contributorClass should also be defined.
  • command: a command to run in order to launch an external editor. The executable command must be located on the system path or in the plug-in's directory. The attributes class, command, and launcher are mutually exclusive.
  • launcher: the name of a class which that implements berry::IEditorLauncher. A launcher will open an external editor. The attributes class , command , and launcher are mutually exclusive.
  • contributorClass: the name of a class that implements berry::IEditorActionBarContributor. This attribute should only be defined if the class attribute is defined. This class is used to add new actions to the workbench menu and tool bar which reflect the features of the editor type.
  • default: if true, this editor will be used as the default editor for the type. This is only relevant in a case where more than one editor is registered for the same type. If an editor is not the default for the type, it can still be launched using "Open with..." submenu for the selected resource. Please note that this attribute is only honored for filename and extension associations at this time. It will not be honored for content type bindings. Content type-based resolution will occur on a first come, first serve basis and is not explicitly specified.
  • filenames: an optional field containing the list of file names understood by the editor. This is a string containing comma separate file names. For instance, an editor which understands specific hypertext documents may register for "ejb.htm, ejb.html".
  • matchingStrategy: the name of a class that implements berry::IEditorMatchingStrategy. This attribute should only be defined if the class attribute is defined. This allows the editor extension to provide its own algorithm for matching the input of one of its editors to a given editor input.
<!ELEMENT contentTypeBinding EMPTY>
<!ATTLIST contentTypeBinding
contentTypeId CDATA #REQUIRED>

Advertises that the containing editor understands the given content type and is suitable for editing files of that type.

  • contentTypeId: The content type identifier. This is an ID defined by the org.blueberry.core.runtime.contentTypes extension point.

Examples

The following is an example of an internal editor extension definition:

<extension point="org.blueberry.ui.editors">
<editor
id="com.xyz.XMLEditor"
name="Fancy XYZ XML editor"
icon="./icons/XMLEditor.gif"
extensions="xml"
class="xyz::XMLEditor"
contributorClass="xyz::XMLEditorContributor"
default="false">
</editor>
</extension>

Supplied Implementation

The workbench provides a "Default Text Editor". The end user product may contain other editors as part of the shipping bundle. In that case, editors will be registered as extensions using the syntax described above.

Keywords

Identifier

org.blueberry.ui.keywords

Description

The keywords extension point defines keywords and a unique id for reference by other schemas. See propertyPages and preferencePages .

Configuration Markup

<!ELEMENT extension (keyword*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
  • point: a fully qualified identifier of the target extension point
  • id: an optional identifier of the extension instance
  • name: an optional name of the extension instance
<!ELEMENT keyword EMPTY>
<!ATTLIST keyword
id CDATA #REQUIRED
label CDATA #REQUIRED>
  • id: The id is the unique id used to reference the keyword
  • label: The human readable label of the keyword

Examples

The following is an example of a keyword extension:

<extension
point="org.blueberry.ui.keywords">
<keyword
label="presentation tab themes"
id="com.xyz.AppearanceKeywords"/>
</extension>

Supplied Implementation

Keywords are used only with preference and property pages. See the keywordReference element of the org.blueberry.ui.propertyPages and org.blueberry.ui.preferencePages extension points.

Perspective Extensions

Identifier

org.blueberry.ui.perspectiveExtensions

Description

This extension point is used to extend perspectives registered by other plug-ins. A perspective defines the initial contents of the window action bars (menu and toolbar) and the initial set of views and their layout within a workbench page. Other plug-ins may contribute actions or views to the perspective which appear when the perspective is selected. Optional additions by other plug-ins are appended to the initial definition.

Configuration Markup

<!ELEMENT extension (perspectiveExtension*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
  • point: a fully qualified identifier of the target extension point
  • id: an optional identifier of the extension instance
  • name: an optional name of the extension instance
<!ELEMENT perspectiveExtension (actionSet | viewShortcut | perspectiveShortcut | newWizardShortcut | view | showInPart | hiddenMenuItem | hiddenToolBarItem)*>
<!ATTLIST perspectiveExtension
targetID IDREF #REQUIRED>
  • targetID: the unique identifier of the perspective (as specified in the registry) into which the contribution is made. If the value is set to "*" the extension is applied to all perspectives.
<!ELEMENT actionSet EMPTY>
<!ATTLIST actionSet
id IDREF #REQUIRED>
  • id: the unique identifier of the action set which will be added to the perspective.
<!ELEMENT viewShortcut EMPTY>
<!ATTLIST viewShortcut
id IDREF #REQUIRED>
  • id: the unique identifier of the view which will be added to the perspective's "Show View" submenu of the "Window" menu.
<!ELEMENT perspectiveShortcut EMPTY>
<!ATTLIST perspectiveShortcut
id IDREF #REQUIRED>
  • id: the unique identifier of the perspective which will be added to the perspective's "Open Perspective" submenu of the "Window" menu.
<!ELEMENT newWizardShortcut EMPTY>
<!ATTLIST newWizardShortcut
id IDREF #REQUIRED>
  • id: the unique identifier of the new wizard which will be added to the perspective's "New" submenu of the "File" menu.
<!ELEMENT showInPart EMPTY>
<!ATTLIST showInPart
id IDREF #IMPLIED>
  • id: the unique identifier of the view which will be added to the perspective's "Show In..." prompter in the Navigate menu.
<!ELEMENT view EMPTY>
<!ATTLIST view
id IDREF #REQUIRED
relative IDREF #IMPLIED
relationship (stack|left|right|top|bottom|fast)
ratio CDATA #IMPLIED
visible (true | false)
closeable (true | false)
moveable (true | false)
standalone (true | false)
showTitle (true | false)
minimized (true | false) "false">
  • id: the unique identifier of the view which will be added to the perspective layout.
  • relative: the unique identifier of a view which already exists in the perspective. This will be used as a reference point for placement of the view. The relationship between these two views is defined by relationship . Ignored if relationship is "fast".
  • relationship: specifies the relationship between id and relative . The following values are supported:
    • fast: the view extension will be created as a fast view.
    • stack: the view extension will be stacked with the relative view in a folder.
    • left, right, top, bottom: the view extension will be placed beside the relative view. In this case a ratio must also be defined.
  • ratio: the percentage of area within the relative view which will be donated to the view extension. If the view extension is a fast view, the ratio is the percentage of the workbench the fast view will cover when active. This must be defined as a floating point value and lie between 0.05 and 0.95.
  • visible: whether the view is initially visible when the perspective is opened. This attribute should have a value of "true" or "false" if used. If this attribute is not used, the view will be initially visible by default.
  • closeable: whether the view is closeable in the target perspective. This attribute should have a value of "true" or "false" if used. If this attribute is not used, the view will be closeable, unless the perspective itself is marked as fixed.
  • moveable: whether the view is moveable. A non-moveable view cannot be moved either within the same folder, or moved between folders in the perspective. This attribute should have a value of "true" or "false" if used. If this attribute is not used, the view will be moveable, unless the perspective itself is marked as fixed.
  • standalone: whether the view is a standalone view. A standalone view cannot be docked together with others in the same folder. This attribute should have a value of "true" or "false" if used. This attribute is ignored if the relationship attribute is "fast" or "stacked". If this attribute is not used, the view will be a regular view, not a standalone view (default is "false").
  • showTitle: whether the view's title is shown. This attribute should have a value of "true" or "false" if used. This attribute only applies to standalone views. If this attribute is not used, the view's title will be shown (default is "true").
  • minimized: If the perspective extension will result in a new view stack being created (i.e. the 'relationship' attribute is one of left, right, top or bottom) this field determines the new stack's initial display state.
<!ELEMENT hiddenMenuItem EMPTY>
<!ATTLIST hiddenMenuItem
id CDATA #REQUIRED>
  • id: The unique identifier of the Command which is to be removed from the menu. WARNING: This is considered to be a 'Product level' extension and should not be used in consumable plugins without great care.
<!ELEMENT hiddenToolBarItem EMPTY>
<!ATTLIST hiddenToolBarItem
id CDATA #REQUIRED>
  • id: The unique identifier of the Command which is to be removed from thetoolbar. WARNING: This is considered to be a 'Product level' extension and should not be used in consumable plugins without great care.

Examples

The following is an example of a perspective extension (note the subelements and the way attributes are used):

<extension point="org.blueberry.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.blueberry.ui.resourcePerspective">
<actionSet id="org.xyz.MyActionSet"/>
<viewShortcut id="org.xyz.views.PackageExplorer"/>
<newWizardShortcut id="org.xyz.wizards.NewProjectCreationWizard"/>
<perspectiveShortcut id="org.xyz.MyPerspective"/>
<view id="org.xyz.views.PackageExplorer"
relative="org.blueberry.ui.views.ResourceNavigator"
relationship="stack"/>
<view id="org.xyz.views.TypeHierarchy"
relative="org.blueberry.ui.views.ResourceNavigator"
relationship="left"
ratio="0.50"/>
</perspectiveExtension>
</extension>

In the example above, an action set, view shortcut, new wizard shortcut, and perspective shortcut are contributed to the initial contents of the Resource Perspective. In addition, the Package Explorer view is stacked on the Resource Navigator and the Type Hierarchy View is added beside the Resource Navigator.

Perspectives

Identifier

org.blueberry.ui.perspective

Description

This extension point is used to add perspective factories to the workbench. A perspective factory is used to define the initial layout and visible action sets for a perspective. The user can select a perspective by invoking the "Open Perspective" submenu of the "Window" menu.

Configuration Markup

<!ELEMENT extension (perspective*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
  • point: a fully qualified identifier of the target extension point
  • id: an optional identifier of the extension instance
  • name: an optional name of the extension instance
<!ELEMENT perspective (description? , keywordReference*)>
<!ATTLIST perspective
id CDATA #REQUIRED
name CDATA #REQUIRED
class CDATA #REQUIRED
icon CDATA #IMPLIED
fixed (true | false)>
  • id: a unique name that will be used to identify this perspective.
  • name: a translatable name that will be used in the workbench window menu bar to represent this perspective.
  • class: a fully qualified name of the class that implements berry::IPerspectiveFactory interface.
  • icon: a relative name of the icon that will be associated with this perspective.
  • fixed: indicates whether the layout of the perspective is fixed. If true, then views created by the perspective factory are not closeable, and cannot be moved. The default is false.
<!ELEMENT description (#PCDATA)>

An optional subelement whose body should contain text providing a short description of the perspective.

Examples

The following is an example of a perspective extension:

<extension
point="org.blueberry.ui.perspectives">
<perspective
id="org.blueberry.ui.resourcePerspective"
name="Resource"
class="berry::ResourcePerspective"
icon="resources/MyIcon.gif">
</perspective>
</extension>

Supplied Implementation

The workbench provides a "Resource Perspective". Additional perspectives may be added by plug-ins. They are selected using the "Open Perspective" submenu of the "Window" menu.

Preference Pages

Identifier

org.blueberry.ui.preferencePages

Description

The workbench provides one common dialog box for preferences. The purpose of this extension point is to allow plug-ins to add pages to the preference dialog box. When preference dialog box is opened (initiated from the menu bar), pages contributed in this way will be added to the dialog box.

Configuration Markup

<!ELEMENT extension (page*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
  • point: a fully qualified identifier of the target extension point
  • id: an optional identifier of the extension instance
  • name: an optional name of the extension instance
<!ELEMENT page (keywordReference*)>
<!ATTLIST page
id CDATA #REQUIRED
name CDATA #REQUIRED
class CDATA #REQUIRED
category IDREF #IMPLIED>
  • id: a unique name that will be used to identify this page.
  • name: a translatable name that will be used in the UI for this page.
  • class: a name of the fully qualified class that implements berry::IWorkbenchPreferencePage.
  • category: a path indicating the location of the page in the preference tree. The path may either be a parent node ID or a sequence of IDs separated by '/', representing the full path from the root node.
<!ELEMENT keywordReference EMPTY>
<!ATTLIST keywordReference
id IDREF #REQUIRED>

A reference by a preference page to a keyword. See the keywords extension point.

  • id: The id of the keyword being referred to.

Examples

The following is an example for the preference extension point:

<extension
point="org.blueberry.ui.preferencePages">
<page
id="com.xyz.prefpage1"
name="XYZ"
class="xyz::PrefPage1">
<keywordReference id="xyz.Keyword"/>
</page>
<page
id="com.xyz.prefpage2"
name="Keyboard Settings"
class="xyz::PrefPage2"
category="com.xyz.prefpage1">
</page>
</extension>

Supplied Implementation

The workbench adds several pages for setting the preferences of the platform. Pages registered through this extension will be added after them according to their category information.

Presentation Factories

Identifier

org.blueberry.ui.presentationFactories

Description

This extension point is used to add presentation factories to the workbench. A presentation factory defines the overall look and feel of the workbench, including how views and editors are presented.

Configuration Markup

<!ELEMENT extension (factory*)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
<!ELEMENT factory EMPTY>
<!ATTLIST factory
class CDATA #REQUIRED
id CDATA #REQUIRED
name CDATA #REQUIRED>
  • class: Specify the fully qualified class to be used for the presentation factory. The specified value must implement the interface berry::IPresentationFactory.
  • id: a unique name that will be used to identify this presentation factory
  • name: a translatable name that can be used to show this presentation factory in the UI

Examples

The following is an example of a presentationFactory extension:

<extension point="org.blueberry.ui.presentationFactories">
<factory
class="berry::ExampleWorkbenchPresentationFactory"/>
</extension>

Supplied Implementation

If a presentation factory is not specified or is missing then the implementation in berry::QtWorkbenchPresentationFactory will be used.

Services

Identifier

org.blueberry.ui.services

Description

Define service factories so that services can be contributed declaratively and will be available through berry::IServiceLocator::GetService(Class). The implementation of AbstractServiceFactory must be able to return a global service and multiple child services (if applicable).

Configuration Markup

<!ELEMENT extension (serviceFactory? , sourceProvider?)+>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>

Contribute services to the workbench.

<!ELEMENT serviceFactory (service+)>
<!ATTLIST serviceFactory
factoryClass CDATA #REQUIRED>

Match a service interface to a factory that can supply a hierachical implementation of that service.

  • factoryClass: The factory that extends AbstractServiceFactory and can create the implementation for the serviceClass.
<!ELEMENT service EMPTY>
<!ATTLIST service
serviceClass CDATA #IMPLIED>

A service this factory can provide.

  • serviceClass: The interface that represents a service contract.
<!ELEMENT sourceProvider (variable+)>
<!ATTLIST sourceProvider
provider CDATA #REQUIRED>

A Source Provider supplies source variables to the IEvaluationService. It can also notify the IEvaluationService when one or more of the variables change.

  • provider: This class must provide variables and call the appropriate fireSourceChanged(*) method when any of the variables change.
<!ELEMENT variable EMPTY>
<!ATTLIST variable
name CDATA #REQUIRED
priorityLevel (workbench|activeContexts|activeShell|activeWorkbenchWindow|activeEditorId|activePartId|activeSite) >

A source variable from this provider. A source provider must declare all variables that it provides.

  • name: The name of a contributed source variable. It is a good practice to prepend the plugin id to the variable name to avoid collisions with other source providers.
  • priorityLevel: For conflict resolution used by services like the IHandlerService , contributed source variables must assign a priority. workbench is the global default priority. See ISources for relative priority information.

Examples

Here is a basic definition:

<extension point="org.blueberry.ui.services">
<serviceFactory factoryClass="my::LevelServiceFactory">
<service serviceClass="my::ILevelService">
</service>
</serviceFactory>
</extension>

The LevelServiceFactory can return an ILevelService when it is requested from the IServiceLocator:

berry::ILevelService::Pointer s = GetSite()->GetService(my::ILevelService::GetStaticClassName());
std::cout << s->GetLevel();

In this test example, the factory would instantiate three ILevelService implementations during the first call to GetSite()->GetService(*) . The global one in the workbench, one for the workbench window, and one for the site.

Tweaklets

Identifier

org.blueberry.ui.tweaklets

Description

Typically, although not required, the value of the definition attribute is the fully qualified name without colons of an abstract class defined by the workbench, and the value of the implementation attribute is the fully qualified name of a non-abstract class provided by the extending plug-in.

Configuration Markup

<!ELEMENT extension (tweaklet)*>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
<!ELEMENT tweaklet EMPTY>
<!ATTLIST tweaklet
id CDATA #REQUIRED
name CDATA #REQUIRED
description CDATA #IMPLIED
definition CDATA #IMPLIED
implementation CDATA #IMPLIED>
  • id: a unique name that will be used to identify this tweaklet
  • name: a translatable name that will be used in the UI for this tweaklet
  • description: a translatable short description of this tweaklet, to be used in the UI
  • definition: an identifier of the tweaklet definition in the workbench, typically a fully qualified type name without colons
  • implementation: an identifier of the tweaklet implementation provided by the extender, typically a fully qualified class name

Supplied Implementation

Tweaklets are usually used to specialize the workbench for a specific GUI toolkit.

Views

Identifier

org.blueberry.ui.views

Description

This extension point is used to define additional views for the workbench. A view is a visual component within a workbench page. It is typically used to navigate a hierarchy of information (like the workspace), open an editor, or display properties for the active editor. The user can make a view visible from the Window > Show View menu or close it from the view local title bar.

In order to reduce the visual clutter in the Show View Dialog, views should be grouped using categories.

Configuration Markup

<!ELEMENT extension (category | view | stickyView)*>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
  • point: a fully qualified identifier of the target extension point
  • id: an optional identifier of the extension instance
  • name: an optional name of the extension instance
<!ELEMENT category EMPTY>
<!ATTLIST category
id CDATA #REQUIRED
name CDATA #REQUIRED
parentCategory IDREF #IMPLIED>
  • id: a unique name that will be used to identify this category
  • name: a translatable name that will be used in the UI for this category
  • parentCategory: an optional path composed of category IDs separated by '/'. This allows the creation of a hierarchy of categories.
<!ELEMENT view (description? , keywordReference*)>
<!ATTLIST view
id CDATA #REQUIRED
name CDATA #REQUIRED
category IDREF #IMPLIED
class CDATA #REQUIRED
icon CDATA #IMPLIED
fastViewWidthRatio CDATA #IMPLIED
allowMultiple (true | false)
restorable (true | false) "true">
  • id: a unique name that will be used to identify this view
  • name: a translatable name that will be used in the UI for this view
  • category: an optional attribute that is composed of the category IDs separated by '/'. Each referenced category must be declared in a corresponding category element.
  • class: a fully qualified name of the class that implements berry::IViewPart. A common practice is to subclass berry::ViewPart or berry::QtViewPart in order to inherit the default functionality.
  • icon: a relative name of the icon that will be associated with the view.
  • fastViewWidthRatio: the percentage of the width of the workbench that the view will take up as an active fast view. This must be defined as a floating point value and lie between 0.05 and 0.95. If no value is supplied, a default ratio will be used.
  • allowMultiple: flag indicating whether this view allows multiple instances to be created using IWorkbenchPage::ShowView(QString id, QString secondaryId). The default is false.
  • restorable: flag indicating whether this view allows to be restored upon workbench restart. If set to false, the view will not be open after a workbench restart. The default is true.
<!ELEMENT description (#PCDATA)>

An optional subelement whose body should contain text providing a short description of the view.

<!ELEMENT stickyView EMPTY>
<!ATTLIST stickyView
id IDREF #REQUIRED
location (RIGHT|LEFT|TOP|BOTTOM)
closeable (true | false)
moveable (true | false)>
\endcoe
A sticky view is a view that will appear by default across all perspectives in a window once it is opened.
Its initial placement is governemed by the location attribute, but nothing prevents it from being moved or closed by the user.
Use of this element will only cause a placeholder for the view to be created, it will not show the view.
Please note that usage of this element should be done with great care and should only be applied to views that truely have a need to live across perspectives.
- <tt>id</tt>: the id of the view to be made sticky.
- <tt>location</tt>: optional attribute that specifies the location of the sticky view relative to the editor area. If absent, the view will be docked to the right of the editor area.
- <tt>closeable</tt>: optional attribute that specifies wether the view should be closeable. If absent it will be closeable.
- <tt>moveable</tt>: optional attribute that specifies wether the view should be moveable. If absent it will be moveable.
\subsection BlueBerryExtPointsIndex_Workbench_Views_Examples Examples
The following is an example of the extension point:
\code{.unparsed}
<extension point="org.blueberry.ui.views">
<category
id="com.xyz.views.XYZviews"
name="XYZ"/>
<view
id="com.xyz.views.XYZView"
name="XYZ View"
category="com.xyz.views.XYZviews"
class="ns::XYZView"
icon="icons/XYZ.gif"/>
</extension>

The following is an example of a sticky view declaration:

<extension point="org.blueberry.ui.views">
<stickyView id="com.xyz.views.XYZView" />
</extension>

Supplied Implementation

The BlueBerry Platform provides a number of standard views. From the user point of view, these views are no different from any other view provided by the plug-ins. All the views can be shown from the "Show View" submenu of the "Window" menu. The position of a view is persistent: it is saved when the view is closed and restored when the view is reopened in a single session. The position is also persisted between workbench sessions.