Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryHandlerUtil.h
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 #ifndef BERRYHANDLERUTIL_H_
18 #define BERRYHANDLERUTIL_H_
19 
20 #include <berryExecutionEvent.h>
21 #include <berryObjectList.h>
22 #include <berryObjectString.h>
23 
25 #include "berryIWorkbenchPart.h"
27 #include "berryISelection.h"
28 #include "berryIWorkbenchWindow.h"
29 
30 #include "berryISources.h"
31 
32 namespace berry {
33 
45 
46 private:
47 
48  static void NoVariableFound(const ExecutionEvent::ConstPointer& event, const QString& name);
49 
50  static void IncorrectTypeFound(const ExecutionEvent::ConstPointer& event, const QString& name,
51  const QString& expectedType, const QString& wrongType);
52 
53 
54 public:
55 
57 
68  static Object::ConstPointer GetVariable(const ExecutionEvent::ConstPointer& event, const QString& name);
69 
82  static Object::ConstPointer GetVariableChecked(const ExecutionEvent::ConstPointer& event, const QString& name);
83 
94  static Object::ConstPointer GetVariable(Object::Pointer context, const QString& name);
95 
103  static StringVectorType::ConstPointer GetActiveContexts(const ExecutionEvent::ConstPointer& event);
104 
115  static StringVectorType::ConstPointer GetActiveContextsChecked(const ExecutionEvent::ConstPointer& event);
116 
125 // static Shell GetActiveShell(const ExecutionEvent::ConstPointer& event) {
126 // Object::Pointer o = getVariable(event, ISources.ACTIVE_SHELL_NAME);
127 // if (o instanceof Shell) {
128 // return (Shell) o;
129 // }
130 // return null;
131 // }
132 
143 // static Shell GetActiveShellChecked(const ExecutionEvent::ConstPointer& event)
144 // {
145 // Object::Pointer o = getVariableChecked(event, ISources.ACTIVE_SHELL_NAME);
146 // if (!(o instanceof Shell)) {
147 // incorrectTypeFound(event, ISources.ACTIVE_SHELL_NAME, Shell.class,
148 // o.getClass());
149 // }
150 // return (Shell) o;
151 // }
152 
160  static IWorkbenchWindow::Pointer GetActiveWorkbenchWindow(const ExecutionEvent::ConstPointer& event);
161 
171  static IWorkbenchWindow::Pointer GetActiveWorkbenchWindowChecked(
172  const ExecutionEvent::ConstPointer& event);
173 
181  //static IEditorPart::Pointer GetActiveEditor(const ExecutionEvent::ConstPointer& event);
182 
192  //static IEditorPart::Pointer GetActiveEditorChecked(const ExecutionEvent::ConstPointer& event);
193 
201  static ObjectString::ConstPointer GetActiveEditorId(const ExecutionEvent::ConstPointer& event);
202 
213  static ObjectString::ConstPointer GetActiveEditorIdChecked(const ExecutionEvent::ConstPointer& event);
214 
222  static IWorkbenchPart::Pointer GetActivePart(const ExecutionEvent::ConstPointer& event);
223 
233  static IWorkbenchPart::Pointer GetActivePartChecked(const ExecutionEvent::ConstPointer& event);
234 
242  static ObjectString::ConstPointer GetActivePartId(const ExecutionEvent::ConstPointer& event);
243 
253  static ObjectString::ConstPointer GetActivePartIdChecked(const ExecutionEvent::ConstPointer& event);
254 
262  static IWorkbenchPartSite::Pointer GetActiveSite(const ExecutionEvent::ConstPointer& event);
263 
273  static IWorkbenchPartSite::Pointer GetActiveSiteChecked(const ExecutionEvent::ConstPointer& event);
274 
282  static ISelection::ConstPointer GetCurrentSelection(const ExecutionEvent::ConstPointer& event);
283 
293  static ISelection::ConstPointer GetCurrentSelectionChecked(const ExecutionEvent::ConstPointer& event);
294 
303  static StringVectorType::ConstPointer GetActiveMenus(const ExecutionEvent::ConstPointer& event);
304 
315  static StringVectorType::ConstPointer GetActiveMenusChecked(const ExecutionEvent::ConstPointer& event);
316 
325  static ISelection::ConstPointer GetActiveMenuSelection(const ExecutionEvent::ConstPointer& event);
326 
337  static ISelection::ConstPointer GetActiveMenuSelectionChecked(const ExecutionEvent::ConstPointer& event);
338 
347  static ISelection::ConstPointer GetActiveMenuEditorInput(const ExecutionEvent::ConstPointer& event);
348 
360  static ISelection::ConstPointer GetActiveMenuEditorInputChecked(
361  const ExecutionEvent::ConstPointer& event);
362 
370  static ISelection::ConstPointer GetShowInSelection(const ExecutionEvent::ConstPointer& event);
371 
381  static ISelection::ConstPointer GetShowInSelectionChecked(const ExecutionEvent::ConstPointer& event);
382 
390  static Object::ConstPointer GetShowInInput(const ExecutionEvent::ConstPointer& event);
391 
401  static Object::ConstPointer GetShowInInputChecked(const ExecutionEvent::ConstPointer& event);
402 
412  static bool ToggleCommandState(const SmartPointer<Command>& command);
413 
427  static bool MatchesRadioState(const SmartPointer<ExecutionEvent>& event);
428 
440  static void UpdateRadioState(const SmartPointer<Command>& command, const QString& newState);
441 };
442 
443 }
444 #endif /*BERRYHANDLERUTIL_H_*/
ObjectList< ObjectString::Pointer > StringVectorType
#define BERRY_UI_QT