Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
berryPlatformUI.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 
13 #include "berryPlatformUI.h"
14 
15 #include "berryPlatform.h"
17 
18 #include "internal/berryWorkbench.h"
19 
20 #include "berryUIException.h"
21 
22 #include <vector>
23 
24 namespace berry {
25 
26 QString PlatformUI::PLUGIN_ID() { static QString str = "org.blueberry.ui"; return str; }
27 const QString PlatformUI::XP_WORKBENCH = PlatformUI::PLUGIN_ID() + ".workbench";
28 const QString PlatformUI::XP_VIEWS = PlatformUI::PLUGIN_ID() + ".views";
29 
30 const int PlatformUI::RETURN_OK = 0;
31 const int PlatformUI::RETURN_RESTART = 1;
32 const int PlatformUI::RETURN_UNSTARTABLE = 2;
34 
35 int
37 {
38  return Workbench::CreateAndRunWorkbench(display, advisor);
39 }
40 
42 {
43  return Workbench::CreateDisplay();
44 }
45 
48 {
49  if (Workbench::GetInstance() == nullptr)
50  {
51  // app forgot to call createAndRunWorkbench beforehand
52  throw Poco::IllegalStateException("Workbench has not been created yet.");
53  }
54  return Workbench::GetInstance();
55 }
56 
57 bool
59 {
60  return Workbench::GetInstance() != nullptr
61  && Workbench::GetInstance()->IsRunning();
62 }
63 
64 TestableObject::Pointer
66 {
67  return Workbench::GetWorkbenchTestable();
68 }
69 
70 PlatformUI::PlatformUI()
71 {
72 
73 }
74 
75 }
static TestableObject::Pointer GetTestableObject()
static Display * CreateDisplay()
static const int RETURN_RESTART
static const int RETURN_EMERGENCY_CLOSE
static const QString XP_WORKBENCH
static const int RETURN_OK
static const int RETURN_UNSTARTABLE
static QString PLUGIN_ID()
static IWorkbench * GetWorkbench()
static int CreateAndRunWorkbench(Display *display, WorkbenchAdvisor *advisor)
static bool IsWorkbenchRunning()
static const QString XP_VIEWS