Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryWorkbenchWindowAdvisor.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 
18 
19 #include <Poco/Bugcheck.h>
20 
21 #include <berryShell.h>
22 #include <berryActionBarAdvisor.h>
24 #include <berryObjects.h>
25 #include <berryIPreferences.h>
27 
28 #include "internal/berryWorkbenchWindowConfigurer.h"
29 #include "internal/berryWorkbenchPlugin.h"
30 
31 namespace berry
32 {
33 
35 {
36  return windowConfigurer;
37 }
38 
40  const IWorkbenchWindowConfigurer::Pointer& configurer)
41 {
42  poco_assert(configurer.IsNotNull());
43  this->windowConfigurer = configurer;
44 }
45 
47 {
48 }
49 
51 {
52  // do nothing
53 }
54 
57 {
58  ActionBarAdvisor::Pointer actionBarAdvisor(new ActionBarAdvisor(configurer));
59  return actionBarAdvisor;
60 }
61 
63 {
64  // do nothing
65 }
66 
68 {
69  // TODO: Refactor this into an IIntroManager.openIntro(IWorkbenchWindow) call
70 
71  // introOpened flag needs to be global
72  IWorkbenchConfigurer::Pointer wbConfig = GetWindowConfigurer()->GetWorkbenchConfigurer();
73  QString key = "introOpened"; //$NON-NLS-1$
74  ObjectBool::Pointer introOpened = wbConfig->GetData(key).Cast<ObjectBool>();
75  if (introOpened && introOpened->GetValue())
76  {
77  return;
78  }
79 
80  wbConfig->SetData(key, ObjectBool::Pointer(new ObjectBool(true)));
81 
82  IPreferences::Pointer workbenchPrefs = WorkbenchPlugin::GetDefault()->GetPreferencesService()->GetSystemPreferences();
83 
84  bool showIntro = workbenchPrefs->GetBool(WorkbenchPreferenceConstants::SHOW_INTRO, true);
85 
86  IIntroManager* introManager = wbConfig->GetWorkbench()->GetIntroManager();
87 
88  bool hasIntro = introManager->HasIntro();
89  bool isNewIntroContentAvailable = introManager->IsNewContentAvailable();
90 
91  if (hasIntro && (showIntro || isNewIntroContentAvailable))
92  {
93  introManager
94  ->ShowIntro(GetWindowConfigurer()->GetWindow(), false);
95 
96  workbenchPrefs->PutBool(WorkbenchPreferenceConstants::SHOW_INTRO, false);
97  workbenchPrefs->Flush();
98  }
99 }
100 
102 {
103  // do nothing
104 }
105 
107 {
108  // do nothing
109 }
110 
112 {
113  // do nothing, but allow the close() to proceed
114  return true;
115 }
116 
118 {
119  // do nothing
120 }
121 
123 {
124  this->GetWindowConfigurer().Cast<WorkbenchWindowConfigurer>()->CreateDefaultContents(shell);
125 }
126 
128 {
129  return nullptr;
130 }
131 
133 {
134  // do nothing
135  return true;
136 }
137 
139 {
140  // do nothing
141  return true;
142 }
143 
144 }
virtual SmartPointer< ActionBarAdvisor > CreateActionBarAdvisor(SmartPointer< IActionBarConfigurer > configurer)
virtual void CreateWindowContents(SmartPointer< Shell > shell)
virtual bool SaveState(SmartPointer< IMemento > memento)
virtual IIntroPart::Pointer ShowIntro(IWorkbenchWindow::Pointer preferredWindow, bool standby)=0
SmartPointer< IWorkbenchWindowConfigurer > GetWindowConfigurer()
virtual bool HasIntro() const =0
WorkbenchWindowAdvisor(const SmartPointer< IWorkbenchWindowConfigurer > &configurer)
virtual QWidget * CreateEmptyWindowContents(QWidget *parent)
virtual bool IsNewContentAvailable()=0
SmartPointer< Other > Cast() const
virtual bool RestoreState(SmartPointer< IMemento > memento)