Utility class for loading data, opening editors and other tasks in a MITK Workbench.
More...
#include <mitkWorkbenchUtil.h>
|
static void | LoadFiles (const QStringList &fileNames, berry::IWorkbenchWindow::Pointer wnd, bool openEditor=true) |
|
static berry::IEditorPart::Pointer | OpenEditor (berry::IWorkbenchPage::Pointer page, berry::IEditorInput::Pointer input, const QString &editorId, bool activate=false) |
|
static berry::IEditorPart::Pointer | OpenEditor (berry::IWorkbenchPage::Pointer page, DataStorageEditorInput::Pointer input, bool activate=false, bool determineContentType=false) |
|
static berry::IEditorDescriptor::Pointer | GetEditorDescriptor (const QString &name, bool inferContentType=true) |
|
static berry::IEditorDescriptor::Pointer | GetDefaultEditor (const QString &file, bool determineContentType) |
|
static IRenderWindowPart * | GetRenderWindowPart (berry::IWorkbenchPage::Pointer page, IRenderWindowPartStrategies strategies) |
| Returns the currently active mitk::IRenderWindowPart. More...
|
|
static IRenderWindowPart * | OpenRenderWindowPart (berry::IWorkbenchPage::Pointer page, bool activatedEditor=true) |
| Uses 'GetRenderWindowPart' to open the a render window part with a certain strategy: Calls 'GetRenderWindowPart' with strategy "ACTIVATE | OPEN" if the bool argument is true. Calls 'GetRenderWindowPart' with strategy "BRING_TO_FRONT | OPEN" if the bool argument is false. More...
|
|
static bool | SetDepartmentLogoPreference (const QString &logoResource, ctkPluginContext *context) |
|
Utility class for loading data, opening editors and other tasks in a MITK Workbench.
- Note
- Inferring the content type is not yet supported (ignore the comments about it in the method documentation).
Definition at line 37 of file mitkWorkbenchUtil.h.
◆ IRenderWindowPartStrategy
◆ GetDefaultEditor()
Returns the default editor for a given file. This method will attempt to resolve the editor based on content-type bindings as well as traditional name/extension bindings if determineContentType
is true
.
A default editor id may be registered for a specific file using setDefaultEditor
. If the given file has a registered default editor id the default editor will derived from it. If not, the default editor is determined by taking the file name for the file and obtaining the default editor for that name.
- Parameters
-
file | the file |
determineContentType | determine the content type for the given file |
- Returns
- the descriptor of the default editor, or
null
if not found
◆ GetEditorDescriptor()
Returns an editor descriptor appropriate for opening a file resource with the given name.
The editor descriptor is determined using a multi-step process. This method will attempt to infer the content type of the file if inferContentType
is true
.
-
The file is consulted for a persistent property named
IDE.EDITOR_KEY
containing the preferred editor id to be used.
-
The workbench editor registry is consulted to determine if an editor extension has been registered for the file type. If so, an instance of the editor extension is opened on the file. See
IEditorRegistry::GetDefaultEditor(std::string)
.
-
The operating system is consulted to determine if an in-place component editor is available (e.g. OLE editor on Win32 platforms).
-
The operating system is consulted to determine if an external editor is available.
- Parameters
-
name | the file name |
inferContentType | attempt to infer the content type from the file name if this is true |
- Returns
- an editor descriptor, appropriate for opening the file
- Exceptions
-
PartInitException | if no editor can be found |
◆ GetRenderWindowPart()
◆ LoadFiles()
Loads the set of given files into the active data storage of the given Workbench window.
If the window already has an editor open on the active datastorage then that editor is activated; otherwise the default editor for the "mitk" extension is activated.
- Parameters
-
fileNames | A list of file names with absolute path. |
wnd | The Workbench window in which the data will be loaded. |
openEditor | Whether an Editor is to be opened on file loading (for cases there is none). |
- See also
- mitk::IOUtil
◆ OpenEditor() [1/2]
Opens an editor on the given object.
If the page already has an editor open on the target object then that editor is brought to front; otherwise, a new editor is opened. If activate == true
the editor will be activated.
- Parameters
-
page | the page in which the editor will be opened |
input | the editor input |
editorId | the id of the editor extension to use |
activate | if true the editor will be activated |
- Returns
- an open editor or
null
if an external editor was opened
- Exceptions
-
PartInitException | if the editor could not be initialized |
- See also
- IWorkbenchPage::OpenEditor(IEditorInput::Pointer, std::string, bool)
◆ OpenEditor() [2/2]
Opens an editor on the given file resource. This method will attempt to resolve the editor based on content-type bindings as well as traditional name/extension bindings if determineContentType
is true
.
If the page already has an editor open on the target object then that editor is brought to front; otherwise, a new editor is opened. If activate == true
the editor will be activated.
- Parameters
-
page | the page in which the editor will be opened |
input | the editor input |
activate | if true the editor will be activated |
determineContentType | attempt to resolve the content type for this file |
- Returns
- an open editor or
null
if an external editor was opened
- Exceptions
-
PartInitException | if the editor could not be initialized |
- See also
- IWorkbenchPage::OpenEditor(IEditorInput::Pointer,std::string,bool)
◆ OpenRenderWindowPart()
Uses 'GetRenderWindowPart' to open the a render window part with a certain strategy: Calls 'GetRenderWindowPart' with strategy "ACTIVATE | OPEN" if the bool argument is true. Calls 'GetRenderWindowPart' with strategy "BRING_TO_FRONT | OPEN" if the bool argument is false.
- Parameters
-
page | The page in which the editor will be opened. |
activatedEditor | Determine if the render window part should be activated or just brought to front. |
- Returns
- The active and opened mitk::IRenderWindowPart.
◆ SetDepartmentLogoPreference()
static bool mitk::WorkbenchUtil::SetDepartmentLogoPreference |
( |
const QString & |
logoResource, |
|
|
ctkPluginContext * |
context |
|
) |
| |
|
static |
Set the "DepartmentLogo" preference using a Qt resource path.
This is a convenience method to set the preference for a "department" logo which is usually shown in render windows in the MITK workbench.
- Parameters
-
logoResource | A Qt resource path to the logo, e.g. ":/MyLogo.png". |
context | The plugin context of the plug-in containing the logo resource. |
- Returns
true
if the preference was set successfully, false
otherwise.
The documentation for this struct was generated from the following file: