Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryPlatformUI.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "berryPlatformUI.h"
18 
19 #include "berryPlatform.h"
21 
22 #include "internal/berryWorkbench.h"
23 
24 #include "berryUIException.h"
25 
26 #include <vector>
27 
28 namespace berry {
29 
30 QString PlatformUI::PLUGIN_ID() { static QString str = "org.blueberry.ui"; return str; }
31 const QString PlatformUI::XP_WORKBENCH = PlatformUI::PLUGIN_ID() + ".workbench";
32 const QString PlatformUI::XP_VIEWS = PlatformUI::PLUGIN_ID() + ".views";
33 
34 const int PlatformUI::RETURN_OK = 0;
35 const int PlatformUI::RETURN_RESTART = 1;
36 const int PlatformUI::RETURN_UNSTARTABLE = 2;
38 
39 int
41 {
42  return Workbench::CreateAndRunWorkbench(display, advisor);
43 }
44 
46 {
47  return Workbench::CreateDisplay();
48 }
49 
52 {
53  if (Workbench::GetInstance() == nullptr)
54  {
55  // app forgot to call createAndRunWorkbench beforehand
56  throw Poco::IllegalStateException("Workbench has not been created yet.");
57  }
58  return Workbench::GetInstance();
59 }
60 
61 bool
63 {
64  return Workbench::GetInstance() != nullptr
65  && Workbench::GetInstance()->IsRunning();
66 }
67 
70 {
71  return Workbench::GetWorkbenchTestable();
72 }
73 
74 PlatformUI::PlatformUI()
75 {
76 
77 }
78 
79 }
static TestableObject::Pointer GetTestableObject()
itk::SmartPointer< Self > Pointer
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