Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
berryHandlerUtil.h
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 #ifndef BERRYHANDLERUTIL_H_
14 #define BERRYHANDLERUTIL_H_
15 
16 #include <berryExecutionEvent.h>
17 #include <berryObjectList.h>
18 #include <berryObjectString.h>
19 
21 #include "berryIWorkbenchPart.h"
23 #include "berryISelection.h"
24 #include "berryIWorkbenchWindow.h"
25 
26 #include "berryISources.h"
27 
28 namespace berry {
29 
41 
42 private:
43 
44  static void NoVariableFound(const ExecutionEvent::ConstPointer& event, const QString& name);
45 
46  static void IncorrectTypeFound(const ExecutionEvent::ConstPointer& event, const QString& name,
47  const QString& expectedType, const QString& wrongType);
48 
49 
50 public:
51 
53 
64  static Object::ConstPointer GetVariable(const ExecutionEvent::ConstPointer& event, const QString& name);
65 
78  static Object::ConstPointer GetVariableChecked(const ExecutionEvent::ConstPointer& event, const QString& name);
79 
90  static Object::ConstPointer GetVariable(Object::Pointer context, const QString& name);
91 
99  static StringVectorType::ConstPointer GetActiveContexts(const ExecutionEvent::ConstPointer& event);
100 
111  static StringVectorType::ConstPointer GetActiveContextsChecked(const ExecutionEvent::ConstPointer& event);
112 
121 // static Shell GetActiveShell(const ExecutionEvent::ConstPointer& event) {
122 // Object::Pointer o = getVariable(event, ISources.ACTIVE_SHELL_NAME);
123 // if (o instanceof Shell) {
124 // return (Shell) o;
125 // }
126 // return null;
127 // }
128 
139 // static Shell GetActiveShellChecked(const ExecutionEvent::ConstPointer& event)
140 // {
141 // Object::Pointer o = getVariableChecked(event, ISources.ACTIVE_SHELL_NAME);
142 // if (!(o instanceof Shell)) {
143 // incorrectTypeFound(event, ISources.ACTIVE_SHELL_NAME, Shell.class,
144 // o.getClass());
145 // }
146 // return (Shell) o;
147 // }
148 
156  static IWorkbenchWindow::Pointer GetActiveWorkbenchWindow(const ExecutionEvent::ConstPointer& event);
157 
167  static IWorkbenchWindow::Pointer GetActiveWorkbenchWindowChecked(
168  const ExecutionEvent::ConstPointer& event);
169 
177  //static IEditorPart::Pointer GetActiveEditor(const ExecutionEvent::ConstPointer& event);
178 
188  //static IEditorPart::Pointer GetActiveEditorChecked(const ExecutionEvent::ConstPointer& event);
189 
197  static ObjectString::ConstPointer GetActiveEditorId(const ExecutionEvent::ConstPointer& event);
198 
209  static ObjectString::ConstPointer GetActiveEditorIdChecked(const ExecutionEvent::ConstPointer& event);
210 
218  static IWorkbenchPart::Pointer GetActivePart(const ExecutionEvent::ConstPointer& event);
219 
229  static IWorkbenchPart::Pointer GetActivePartChecked(const ExecutionEvent::ConstPointer& event);
230 
238  static ObjectString::ConstPointer GetActivePartId(const ExecutionEvent::ConstPointer& event);
239 
249  static ObjectString::ConstPointer GetActivePartIdChecked(const ExecutionEvent::ConstPointer& event);
250 
258  static IWorkbenchPartSite::Pointer GetActiveSite(const ExecutionEvent::ConstPointer& event);
259 
269  static IWorkbenchPartSite::Pointer GetActiveSiteChecked(const ExecutionEvent::ConstPointer& event);
270 
278  static ISelection::ConstPointer GetCurrentSelection(const ExecutionEvent::ConstPointer& event);
279 
289  static ISelection::ConstPointer GetCurrentSelectionChecked(const ExecutionEvent::ConstPointer& event);
290 
299  static StringVectorType::ConstPointer GetActiveMenus(const ExecutionEvent::ConstPointer& event);
300 
311  static StringVectorType::ConstPointer GetActiveMenusChecked(const ExecutionEvent::ConstPointer& event);
312 
321  static ISelection::ConstPointer GetActiveMenuSelection(const ExecutionEvent::ConstPointer& event);
322 
333  static ISelection::ConstPointer GetActiveMenuSelectionChecked(const ExecutionEvent::ConstPointer& event);
334 
343  static ISelection::ConstPointer GetActiveMenuEditorInput(const ExecutionEvent::ConstPointer& event);
344 
356  static ISelection::ConstPointer GetActiveMenuEditorInputChecked(
357  const ExecutionEvent::ConstPointer& event);
358 
366  static ISelection::ConstPointer GetShowInSelection(const ExecutionEvent::ConstPointer& event);
367 
377  static ISelection::ConstPointer GetShowInSelectionChecked(const ExecutionEvent::ConstPointer& event);
378 
386  static Object::ConstPointer GetShowInInput(const ExecutionEvent::ConstPointer& event);
387 
397  static Object::ConstPointer GetShowInInputChecked(const ExecutionEvent::ConstPointer& event);
398 
408  static bool ToggleCommandState(const SmartPointer<Command>& command);
409 
423  static bool MatchesRadioState(const SmartPointer<ExecutionEvent>& event);
424 
436  static void UpdateRadioState(const SmartPointer<Command>& command, const QString& newState);
437 };
438 
439 }
440 #endif /*BERRYHANDLERUTIL_H_*/
ObjectList< ObjectString::Pointer > StringVectorType
#define BERRY_UI_QT