Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Utility class for loading data, opening editors and other tasks in a MITK Workbench. More...
#include <mitkWorkbenchUtil.h>
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, mitk::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 bool | SetDepartmentLogoPreference (const QString &logoResource, ctkPluginContext *context) |
Utility class for loading data, opening editors and other tasks in a MITK Workbench.
Definition at line 40 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 251 of file mitkWorkbenchUtil.cpp.
References berry::IEditorRegistry::FindEditor(), berry::IEditorRegistry::GetDefaultEditor(), berry::IWorkbench::GetEditorRegistry(), berry::PlatformUI::GetWorkbench(), and berry::SmartPointer< TObjectType >::IsNotNull().
Referenced by OpenEditor().
|
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 233 of file mitkWorkbenchUtil.cpp.
References berry::IEditorRegistry::GetDefaultEditor(), berry::IWorkbench::GetEditorRegistry(), and berry::PlatformUI::GetWorkbench().
|
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 99 of file mitkWorkbenchUtil.cpp.
References mitk::IDataStorageService::GetDataStorage(), 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, MITK_WARN, and OpenEditor().
Referenced by QmitkDefaultDropTargetListener::DropEvent(), and QmitkFileOpenAction::Run().
|
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 199 of file mitkWorkbenchUtil.cpp.
References berry::SmartPointer< TObjectType >::IsNull().
Referenced by QmitkAbstractView::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 213 of file mitkWorkbenchUtil.cpp.
References GetDefaultEditor(), berry::PlatformUI::GetWorkbench(), and berry::SmartPointer< TObjectType >::IsNull().
|
static |
Set the "DepartmentLogo" preference using a Qt resource path.
This is a convenience method to set the preference for a "deparment" 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 283 of file mitkWorkbenchUtil.cpp.
References BERRY_WARN, and berry::IPreferencesService::GetSystemPreferences().