Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Utility class for loading data, opening editors and other tasks in a MITK Workbench. More...
#include <mitkWorkbenchUtil.h>
Public Types | |
enum | IRenderWindowPartStrategy { NONE, BRING_TO_FRONT, ACTIVATE, OPEN } |
Static Public Member Functions | |
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.
Definition at line 37 of file mitkWorkbenchUtil.h.
Describes the strategies to be used for getting an mitk::IRenderWindowPart instance.
Enumerator | |
---|---|
NONE | |
BRING_TO_FRONT | |
ACTIVATE | |
OPEN |
Definition at line 42 of file mitkWorkbenchUtil.h.
|
static |
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.
file | the file |
determineContentType | determine the content type for the given file |
null
if not found Definition at line 242 of file mitkWorkbenchUtil.cpp.
References berry::IEditorRegistry::FindEditor(), berry::IEditorRegistry::GetDefaultEditor(), berry::IWorkbench::GetEditorRegistry(), berry::PlatformUI::GetWorkbench(), and berry::SmartPointer< TObjectType >::IsNotNull().
|
static |
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
.
IDE.EDITOR_KEY
containing the preferred editor id to be used. IEditorRegistry::GetDefaultEditor(std::string)
. name | the file name |
inferContentType | attempt to infer the content type from the file name if this is true |
PartInitException | if no editor can be found |
Definition at line 226 of file mitkWorkbenchUtil.cpp.
References berry::IEditorRegistry::GetDefaultEditor(), berry::IWorkbench::GetEditorRegistry(), and berry::PlatformUI::GetWorkbench().
|
static |
Returns the currently active mitk::IRenderWindowPart.
page | The page in which the editor will be opened. |
strategies | Strategies for returning a mitk::IRenderWindowPart instance if there is currently no active one. |
Definition at line 273 of file mitkWorkbenchUtil.cpp.
References berry::SmartPointer< TObjectType >::GetPointer(), and OpenEditor().
Referenced by QmitkAbstractView::GetRenderWindowPart(), GlobalReinitAction::Run(), and ReinitAction::Run().
|
static |
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.
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). |
Definition at line 116 of file mitkWorkbenchUtil.cpp.
References mitk::RenderingManager::GetInstance(), berry::SmartPointer< TObjectType >::GetPointer(), berry::Platform::GetPreferencesService(), berry::IPreferencesService::GetSystemPreferences(), mitk::RenderingManager::InitializeViewsByBoundingObjects(), berry::SmartPointer< TObjectType >::IsNotNull(), berry::SmartPointer< TObjectType >::IsNull(), QmitkIOUtil::Load(), MITK_INFO, and OpenEditor().
Referenced by QmitkDefaultDropTargetListener::DropEvent(), QmitkFileOpenAction::Run(), and QmitkDnDFrameWidget::~QmitkDnDFrameWidget().
|
static |
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.
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 |
null
if an external editor was opened PartInitException | if the editor could not be initialized |
Definition at line 197 of file mitkWorkbenchUtil.cpp.
References berry::SmartPointer< TObjectType >::IsNull().
Referenced by GetRenderWindowPart(), LoadFiles(), and QmitkExtWorkbenchWindowAdvisor::PostWindowOpen().
|
static |
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.
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 |
null
if an external editor was opened PartInitException | if the editor could not be initialized |
Definition at line 209 of file mitkWorkbenchUtil.cpp.
References berry::PlatformUI::GetWorkbench(), and berry::SmartPointer< TObjectType >::IsNull().
|
static |
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.
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. |
Definition at line 366 of file mitkWorkbenchUtil.cpp.
Referenced by QmitkDataManagerView::NodeTreeViewRowsInserted(), GlobalReinitAction::Run(), and ReinitAction::Run().
|
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.
logoResource | A Qt resource path to the logo, e.g. ":/MyLogo.png". |
context | The plugin context of the plug-in containing the logo resource. |
true
if the preference was set successfully, false
otherwise. Definition at line 378 of file mitkWorkbenchUtil.cpp.
References BERRY_WARN, and berry::IPreferencesService::GetSystemPreferences().