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