Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
Medical Imaging Interaction Toolkit
QmitkOpenDicomEditorAction.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
15 #include <QFileDialog>
16 #include <QFileInfo>
17 
18 #include "mitkCoreObjectFactory.h"
19 #include "mitkSceneIO.h"
20 #include "mitkProgressBar.h"
21 
23 #include <berryIEditorPart.h>
24 #include <berryIWorkbenchPage.h>
26 #include <berryIWorkbench.h>
27 #include <berryPlatform.h>
28 #include <berryFileEditorInput.h>
29 
30 #include "mitkProperties.h"
31 #include "mitkNodePredicateData.h"
32 #include "mitkNodePredicateNot.h"
34 
35 
37 : QAction(nullptr)
38 {
39  this->init(window);
40 }
41 
43 : QAction(nullptr)
44 {
45  this->setIcon(icon);
46 
47  this->init(window);
48 }
49 
50 void QmitkOpenDicomEditorAction::init(berry::IWorkbenchWindow::Pointer window)
51 {
52  m_Window = window;
53  this->setParent(static_cast<QWidget*>(m_Window->GetShell()->GetControl()));
54  this->setText("&DICOM");
55  this->setToolTip("Open dicom tool");
56 
58 
59  m_GeneralPreferencesNode = prefService->GetSystemPreferences()->Node("/General");
60 
61  this->connect(this, SIGNAL(triggered(bool)), this, SLOT(Run()));
62 }
63 
65 {
66 
67  // check if there is an open perspective, if not open the default perspective
68  if (m_Window->GetActivePage().IsNull())
69  {
70  QString defaultPerspId = m_Window->GetWorkbench()->GetPerspectiveRegistry()->GetDefaultPerspective();
71  m_Window->GetWorkbench()->ShowPerspective(defaultPerspId, m_Window);
72  }
73 
74  berry::IEditorInput::Pointer editorInput2(new berry::FileEditorInput(QString()));
75  m_Window->GetActivePage()->OpenEditor(editorInput2, "org.mitk.editors.dicomeditor");
76 }
77 
virtual SmartPointer< IPreferences > GetSystemPreferences()=0
QmitkOpenDicomEditorAction(berry::IWorkbenchWindow::Pointer window)
static IPreferencesService * GetPreferencesService()