Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkExtWorkbenchWindowAdvisor.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,
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 
19 
20 #include <QMenu>
21 #include <QMenuBar>
22 #include <QMainWindow>
23 #include <QStatusBar>
24 #include <QString>
25 #include <QFile>
26 #include <QRegExp>
27 #include <QTextStream>
28 #include <QSettings>
29 
30 #include <ctkPluginException.h>
31 #include <service/event/ctkEventAdmin.h>
32 
33 #include <berryPlatform.h>
34 #include <berryPlatformUI.h>
36 #include <berryIWorkbenchWindow.h>
37 #include <berryIWorkbenchPage.h>
41 #include <berryIProduct.h>
43 #include <berryQtPreferences.h>
44 
45 #include <internal/berryQtShowViewAction.h>
46 #include <internal/berryQtOpenPerspectiveAction.h>
47 
48 #include <QmitkFileOpenAction.h>
49 #include <QmitkFileSaveAction.h>
51 #include <QmitkFileExitAction.h>
53 #include <QmitkUndoAction.h>
54 #include <QmitkRedoAction.h>
56 #include <QmitkStatusBar.h>
57 #include <QmitkProgressBar.h>
59 #include <QmitkPreferencesDialog.h>
61 
62 #include <itkConfigure.h>
63 #include <vtkConfigure.h>
64 #include <mitkVersion.h>
68 #include <mitkWorkbenchUtil.h>
69 #include <vtkVersionMacros.h>
70 
71 // UGLYYY
72 #include "internal/QmitkExtWorkbenchWindowAdvisorHack.h"
73 #include "internal/QmitkCommonExtPlugin.h"
74 #include "mitkUndoController.h"
76 #include <QToolBar>
77 #include <QMessageBox>
78 #include <QLabel>
79 #include <QmitkAboutDialog.h>
80 
81 QmitkExtWorkbenchWindowAdvisorHack
82  * QmitkExtWorkbenchWindowAdvisorHack::undohack =
83  new QmitkExtWorkbenchWindowAdvisorHack();
84 
85 QString QmitkExtWorkbenchWindowAdvisor::QT_SETTINGS_FILENAME = "QtSettings.ini";
86 
88 
89 class PartListenerForTitle: public berry::IPartListener
90 {
91 public:
92 
93  PartListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) :
94  windowAdvisor(wa)
95  {
96  }
97 
98  Events::Types GetPartEventTypes() const override
99  {
102  }
103 
105  {
106  if (ref.Cast<berry::IEditorReference> ())
107  {
108  windowAdvisor->UpdateTitle(false);
109  }
110  }
111 
113  {
114  if (ref.Cast<berry::IEditorReference> ())
115  {
116  windowAdvisor->UpdateTitle(false);
117  }
118  }
119 
120  void PartClosed(const berry::IWorkbenchPartReference::Pointer& /*ref*/) override
121  {
122  windowAdvisor->UpdateTitle(false);
123  }
124 
125  void PartHidden(const berry::IWorkbenchPartReference::Pointer& ref) override
126  {
127  if (!windowAdvisor->lastActiveEditor.Expired() &&
128  ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock())
129  {
130  windowAdvisor->UpdateTitle(true);
131  }
132  }
133 
134  void PartVisible(const berry::IWorkbenchPartReference::Pointer& ref) override
135  {
136  if (!windowAdvisor->lastActiveEditor.Expired() &&
137  ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock())
138  {
139  windowAdvisor->UpdateTitle(false);
140  }
141  }
142 
143 private:
144  QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
145 };
146 
147 class PartListenerForViewNavigator: public berry::IPartListener
148 {
149 public:
150 
151  PartListenerForViewNavigator(QAction* act) :
152  viewNavigatorAction(act)
153  {
154  }
155 
156  Events::Types GetPartEventTypes() const override
157  {
160  }
161 
162  void PartOpened(const berry::IWorkbenchPartReference::Pointer& ref) override
163  {
164  if (ref->GetId()=="org.mitk.views.viewnavigatorview")
165  {
166  viewNavigatorAction->setChecked(true);
167  }
168  }
169 
170  void PartClosed(const berry::IWorkbenchPartReference::Pointer& ref) override
171  {
172  if (ref->GetId()=="org.mitk.views.viewnavigatorview")
173  {
174  viewNavigatorAction->setChecked(false);
175  }
176  }
177 
178  void PartVisible(const berry::IWorkbenchPartReference::Pointer& ref) override
179  {
180  if (ref->GetId()=="org.mitk.views.viewnavigatorview")
181  {
182  viewNavigatorAction->setChecked(true);
183  }
184  }
185 
186  void PartHidden(const berry::IWorkbenchPartReference::Pointer& ref) override
187  {
188  if (ref->GetId()=="org.mitk.views.viewnavigatorview")
189  {
190  viewNavigatorAction->setChecked(false);
191  }
192  }
193 
194 private:
195  QAction* viewNavigatorAction;
196 };
197 
198 class PartListenerForImageNavigator: public berry::IPartListener
199 {
200 public:
201 
202  PartListenerForImageNavigator(QAction* act) :
203  imageNavigatorAction(act)
204  {
205  }
206 
207  Events::Types GetPartEventTypes() const override
208  {
211  }
212 
213  void PartOpened(const berry::IWorkbenchPartReference::Pointer& ref) override
214  {
215  if (ref->GetId()=="org.mitk.views.imagenavigator")
216  {
217  imageNavigatorAction->setChecked(true);
218  }
219  }
220 
221  void PartClosed(const berry::IWorkbenchPartReference::Pointer& ref) override
222  {
223  if (ref->GetId()=="org.mitk.views.imagenavigator")
224  {
225  imageNavigatorAction->setChecked(false);
226  }
227  }
228 
229  void PartVisible(const berry::IWorkbenchPartReference::Pointer& ref) override
230  {
231  if (ref->GetId()=="org.mitk.views.imagenavigator")
232  {
233  imageNavigatorAction->setChecked(true);
234  }
235  }
236 
237  void PartHidden(const berry::IWorkbenchPartReference::Pointer& ref) override
238  {
239  if (ref->GetId()=="org.mitk.views.imagenavigator")
240  {
241  imageNavigatorAction->setChecked(false);
242  }
243  }
244 
245 private:
246  QAction* imageNavigatorAction;
247 };
248 
249 class PerspectiveListenerForTitle: public berry::IPerspectiveListener
250 {
251 public:
252 
253  PerspectiveListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) :
254  windowAdvisor(wa), perspectivesClosed(false)
255  {
256  }
257 
258  Events::Types GetPerspectiveEventTypes() const override
259  {
261  {
263  }
264  else
265  {
268  }
269  }
270 
272  const berry::IPerspectiveDescriptor::Pointer& /*perspective*/) override
273  {
274  windowAdvisor->UpdateTitle(false);
275  }
276 
278  const berry::IPerspectiveDescriptor::Pointer& /*oldPerspective*/,
279  const berry::IPerspectiveDescriptor::Pointer& /*newPerspective*/) override
280  {
281  windowAdvisor->UpdateTitle(false);
282  }
283 
285  const berry::IPerspectiveDescriptor::Pointer& /*perspective*/) override
286  {
287  windowAdvisor->UpdateTitle(false);
288  }
289 
291  const berry::IPerspectiveDescriptor::Pointer& /*perspective*/) override
292  {
293  if (perspectivesClosed)
294  {
295  QListIterator<QAction*> i(windowAdvisor->viewActions);
296  while (i.hasNext())
297  {
298  i.next()->setEnabled(true);
299  }
300 
301  //GetViewRegistry()->Find("org.mitk.views.imagenavigator");
302  if(windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor"))
303  {
304  windowAdvisor->openDicomEditorAction->setEnabled(true);
305  }
306  windowAdvisor->fileSaveProjectAction->setEnabled(true);
307  windowAdvisor->closeProjectAction->setEnabled(true);
308  windowAdvisor->undoAction->setEnabled(true);
309  windowAdvisor->redoAction->setEnabled(true);
310  windowAdvisor->imageNavigatorAction->setEnabled(true);
311  windowAdvisor->viewNavigatorAction->setEnabled(true);
312  windowAdvisor->resetPerspAction->setEnabled(true);
313  if( windowAdvisor->GetShowClosePerspectiveMenuItem() )
314  {
315  windowAdvisor->closePerspAction->setEnabled(true);
316  }
317  }
318 
319  perspectivesClosed = false;
320  }
321 
323  const berry::IPerspectiveDescriptor::Pointer& /*perspective*/) override
324  {
325  berry::IWorkbenchWindow::Pointer wnd = windowAdvisor->GetWindowConfigurer()->GetWindow();
326  bool allClosed = true;
327  if (wnd->GetActivePage())
328  {
329  QList<berry::IPerspectiveDescriptor::Pointer> perspectives(wnd->GetActivePage()->GetOpenPerspectives());
330  allClosed = perspectives.empty();
331  }
332 
333  if (allClosed)
334  {
335  perspectivesClosed = true;
336 
337  QListIterator<QAction*> i(windowAdvisor->viewActions);
338  while (i.hasNext())
339  {
340  i.next()->setEnabled(false);
341  }
342 
343  if(windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor"))
344  {
345  windowAdvisor->openDicomEditorAction->setEnabled(false);
346  }
347  windowAdvisor->fileSaveProjectAction->setEnabled(false);
348  windowAdvisor->closeProjectAction->setEnabled(false);
349  windowAdvisor->undoAction->setEnabled(false);
350  windowAdvisor->redoAction->setEnabled(false);
351  windowAdvisor->imageNavigatorAction->setEnabled(false);
352  windowAdvisor->viewNavigatorAction->setEnabled(false);
353  windowAdvisor->resetPerspAction->setEnabled(false);
354  if( windowAdvisor->GetShowClosePerspectiveMenuItem() )
355  {
356  windowAdvisor->closePerspAction->setEnabled(false);
357  }
358  }
359  }
360 
361 private:
362  QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
363  bool perspectivesClosed;
364 };
365 
366 class PerspectiveListenerForMenu: public berry::IPerspectiveListener
367 {
368 public:
369 
370  PerspectiveListenerForMenu(QmitkExtWorkbenchWindowAdvisor* wa) :
371  windowAdvisor(wa)
372  {
373  }
374 
375  Events::Types GetPerspectiveEventTypes() const override
376  {
378  }
379 
382  {
383  QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
384  if (action)
385  {
386  action->setChecked(true);
387  }
388  }
389 
391  const berry::IPerspectiveDescriptor::Pointer& perspective) override
392  {
393  QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
394  if (action)
395  {
396  action->setChecked(false);
397  }
398  }
399 
400 private:
401  QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
402 };
403 
406 berry::WorkbenchWindowAdvisor(configurer),
407  lastInput(nullptr),
408  wbAdvisor(wbAdvisor),
409  showViewToolbar(true),
410  showPerspectiveToolbar(false),
411  showVersionInfo(true),
412  showMitkVersionInfo(true),
413  showViewMenuItem(true),
414  showNewWindowMenuItem(false),
415  showClosePerspectiveMenuItem(true),
416  viewNavigatorFound(false),
417  showMemoryIndicator(true),
418  dropTargetListener(new QmitkDefaultDropTargetListener)
419 {
420  productName = QCoreApplication::applicationName();
421  viewExcludeList.push_back("org.mitk.views.viewnavigatorview");
422 }
423 
425 {
426 }
427 
430 {
432  {
433  berry::ActionBarAdvisor::Pointer actionBarAdvisor(
434  new QmitkExtActionBarAdvisor(configurer));
435  return actionBarAdvisor;
436  }
437  else
438  {
440  }
441 }
442 
444 {
445  QWidget* parentWidget = static_cast<QWidget*>(parent);
446  auto label = new QLabel(parentWidget);
447  label->setText("<b>No perspectives are open. Open a perspective in the <i>Window->Open Perspective</i> menu.</b>");
448  label->setContentsMargins(10,10,10,10);
449  label->setAlignment(Qt::AlignTop);
450  label->setEnabled(false);
451  parentWidget->layout()->addWidget(label);
452  return label;
453 }
454 
456 {
457  showClosePerspectiveMenuItem = show;
458 }
459 
461 {
462  return showClosePerspectiveMenuItem;
463 }
464 
466 {
467  showMemoryIndicator = show;
468 }
469 
471 {
472  return showMemoryIndicator;
473 }
474 
476 {
477  showNewWindowMenuItem = show;
478 }
479 
481 {
482  showViewToolbar = show;
483 }
484 
486 {
487  showViewMenuItem = show;
488 }
489 
491 {
492  showPerspectiveToolbar = show;
493 }
494 
496 {
497  showVersionInfo = show;
498 }
499 
501 {
502  showMitkVersionInfo = show;
503 }
504 
506 {
507  productName = product;
508 }
509 
511 {
512  windowIcon = wndIcon;
513 }
514 
516 {
517  // very bad hack...
519  this->GetWindowConfigurer()->GetWindow();
520  QMainWindow* mainWindow =
521  qobject_cast<QMainWindow*> (window->GetShell()->GetControl());
522 
523  if (!windowIcon.isEmpty())
524  {
525  mainWindow->setWindowIcon(QIcon(windowIcon));
526  }
527  mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);
528 
529  /*mainWindow->setStyleSheet("color: white;"
530  "background-color: #808080;"
531  "selection-color: #659EC7;"
532  "selection-background-color: #808080;"
533  " QMenuBar {"
534  "background-color: #808080; }");*/
535 
536  // Load selected icon theme
537 
538  QStringList searchPaths = QIcon::themeSearchPaths();
539  searchPaths.push_front( QString(":/org_mitk_icons/icons/") );
540  QIcon::setThemeSearchPaths( searchPaths );
541 
544  QString iconTheme = stylePref->Get(berry::QtPreferences::QT_ICON_THEME, "<<default>>");
545  if( iconTheme == QString( "<<default>>" ) )
546  {
547  iconTheme = QString( "tango" );
548  }
549  QIcon::setThemeName( iconTheme );
550 
551  // ==== Application menu ============================
552 
553  QMenuBar* menuBar = mainWindow->menuBar();
554  menuBar->setContextMenuPolicy(Qt::PreventContextMenu);
555 
556 #ifdef __APPLE__
557  menuBar->setNativeMenuBar(true);
558 #else
559  menuBar->setNativeMenuBar(false);
560 #endif
561 
562  QAction* fileOpenAction = new QmitkFileOpenAction(QIcon::fromTheme("document-open",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/document-open.svg")), window);
563  fileOpenAction->setShortcut(QKeySequence::Open);
564  QAction* fileSaveAction = new QmitkFileSaveAction(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"), window);
565  fileSaveAction->setShortcut(QKeySequence::Save);
566  fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
567  fileSaveProjectAction->setIcon(QIcon::fromTheme("document-save",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/document-save.svg")));
568  closeProjectAction = new QmitkCloseProjectAction(window);
569  closeProjectAction->setIcon(QIcon::fromTheme("edit-delete",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-delete.svg")));
570 
571  auto perspGroup = new QActionGroup(menuBar);
572  std::map<QString, berry::IViewDescriptor::Pointer> VDMap;
573 
574  // sort elements (converting vector to map...)
575  QList<berry::IViewDescriptor::Pointer>::const_iterator iter;
576 
577  berry::IViewRegistry* viewRegistry =
579  const QList<berry::IViewDescriptor::Pointer> viewDescriptors = viewRegistry->GetViews();
580 
581  bool skip = false;
582  for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
583  {
584  // if viewExcludeList is set, it contains the id-strings of view, which
585  // should not appear as an menu-entry in the menu
586  if (viewExcludeList.size() > 0)
587  {
588  for (int i=0; i<viewExcludeList.size(); i++)
589  {
590  if (viewExcludeList.at(i) == (*iter)->GetId())
591  {
592  skip = true;
593  break;
594  }
595  }
596  if (skip)
597  {
598  skip = false;
599  continue;
600  }
601  }
602 
603  if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
604  continue;
605  if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
606  continue;
607  if ((*iter)->GetId() == "org.mitk.views.viewnavigatorview")
608  continue;
609 
610  std::pair<QString, berry::IViewDescriptor::Pointer> p(
611  (*iter)->GetLabel(), (*iter));
612  VDMap.insert(p);
613  }
614 
615  std::map<QString, berry::IViewDescriptor::Pointer>::const_iterator
616  MapIter;
617  for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
618  {
619  berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window,
620  (*MapIter).second);
621  viewActions.push_back(viewAction);
622  }
623 
625  {
626  QMenu* fileMenu = menuBar->addMenu("&File");
627  fileMenu->setObjectName("FileMenu");
628  fileMenu->addAction(fileOpenAction);
629  fileMenu->addAction(fileSaveAction);
630  fileMenu->addAction(fileSaveProjectAction);
631  fileMenu->addAction(closeProjectAction);
632  fileMenu->addSeparator();
633 
634  QAction* fileExitAction = new QmitkFileExitAction(window);
635  fileExitAction->setIcon(QIcon::fromTheme("system-log-out",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/system-log-out.svg")));
636  fileExitAction->setShortcut(QKeySequence::Quit);
637  fileExitAction->setObjectName("QmitkFileExitAction");
638  fileMenu->addAction(fileExitAction);
639 
640  // another bad hack to get an edit/undo menu...
641  QMenu* editMenu = menuBar->addMenu("&Edit");
642  undoAction = editMenu->addAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
643  "&Undo",
644  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
645  QKeySequence("CTRL+Z"));
646  undoAction->setToolTip("Undo the last action (not supported by all modules)");
647  redoAction = editMenu->addAction(QIcon::fromTheme("edit-redo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg"))
648  , "&Redo",
649  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
650  QKeySequence("CTRL+Y"));
651  redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");
652 
653  // ==== Window Menu ==========================
654  QMenu* windowMenu = menuBar->addMenu("Window");
655  if (showNewWindowMenuItem)
656  {
657  windowMenu->addAction("&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
658  windowMenu->addSeparator();
659  }
660 
661  QMenu* perspMenu = windowMenu->addMenu("&Open Perspective");
662 
663  QMenu* viewMenu;
664  if (showViewMenuItem)
665  {
666  viewMenu = windowMenu->addMenu("Show &View");
667  viewMenu->setObjectName("Show View");
668  }
669  windowMenu->addSeparator();
670  resetPerspAction = windowMenu->addAction("&Reset Perspective",
671  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));
672 
673  if(showClosePerspectiveMenuItem)
674  closePerspAction = windowMenu->addAction("&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective()));
675 
676  windowMenu->addSeparator();
677  windowMenu->addAction("&Preferences...",
678  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()),
679  QKeySequence("CTRL+P"));
680 
681  // fill perspective menu
682  berry::IPerspectiveRegistry* perspRegistry =
683  window->GetWorkbench()->GetPerspectiveRegistry();
684 
685  QList<berry::IPerspectiveDescriptor::Pointer> perspectives(
686  perspRegistry->GetPerspectives());
687 
688  skip = false;
689  for (QList<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
690  perspectives.begin(); perspIt != perspectives.end(); ++perspIt)
691  {
692  // if perspectiveExcludeList is set, it contains the id-strings of perspectives, which
693  // should not appear as an menu-entry in the perspective menu
694  if (perspectiveExcludeList.size() > 0)
695  {
696  for (int i=0; i<perspectiveExcludeList.size(); i++)
697  {
698  if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
699  {
700  skip = true;
701  break;
702  }
703  }
704  if (skip)
705  {
706  skip = false;
707  continue;
708  }
709  }
710 
711  QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
712  *perspIt, perspGroup);
713  mapPerspIdToAction.insert((*perspIt)->GetId(), perspAction);
714  }
715  perspMenu->addActions(perspGroup->actions());
716 
717  if (showViewMenuItem)
718  {
719  for (auto viewAction : viewActions)
720  {
721  viewMenu->addAction(viewAction);
722  }
723  }
724 
725  // ===== Help menu ====================================
726  QMenu* helpMenu = menuBar->addMenu("&Help");
727  helpMenu->addAction("&Welcome",this, SLOT(onIntro()));
728  helpMenu->addAction("&Open Help Perspective", this, SLOT(onHelpOpenHelpPerspective()));
729  helpMenu->addAction("&Context Help",this, SLOT(onHelp()), QKeySequence("F1"));
730  helpMenu->addAction("&About",this, SLOT(onAbout()));
731  // =====================================================
732  }
733  else
734  {
735  //undoAction = new QAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
736  // "&Undo", nullptr);
737  undoAction = new QmitkUndoAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")), nullptr);
738  undoAction->setShortcut(QKeySequence::Undo);
739  redoAction = new QmitkRedoAction(QIcon::fromTheme("edit-redo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg")), nullptr);
740  redoAction->setShortcut(QKeySequence::Redo);
741  }
742 
743  // toolbar for showing file open, undo, redo and other main actions
744  auto mainActionsToolBar = new QToolBar;
745  mainActionsToolBar->setObjectName("mainActionsToolBar");
746  mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
747 #ifdef __APPLE__
748  mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
749 #else
750  mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
751 #endif
752 
753  imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", nullptr);
754  bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");
755 
756  if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor"))
757  {
758  openDicomEditorAction = new QmitkOpenDicomEditorAction(QIcon(":/org.mitk.gui.qt.ext/dcm-icon.png"),window);
759  }
760 
761  if (imageNavigatorViewFound)
762  {
763  QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
764  imageNavigatorAction->setCheckable(true);
765 
766  // add part listener for image navigator
767  imageNavigatorPartListener.reset(new PartListenerForImageNavigator(imageNavigatorAction));
768  window->GetPartService()->AddPartListener(imageNavigatorPartListener.data());
769  berry::IViewPart::Pointer imageNavigatorView =
770  window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
771  imageNavigatorAction->setChecked(false);
772  if (imageNavigatorView)
773  {
774  bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
775  if (isImageNavigatorVisible)
776  imageNavigatorAction->setChecked(true);
777  }
778  imageNavigatorAction->setToolTip("Toggle image navigator for navigating through image");
779  }
780 
781  viewNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/view-manager_48.png"),"&View Navigator", nullptr);
782  viewNavigatorFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.viewnavigatorview");
783  if (viewNavigatorFound)
784  {
785  QObject::connect(viewNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onViewNavigator()));
786  viewNavigatorAction->setCheckable(true);
787 
788  // add part listener for view navigator
789  viewNavigatorPartListener.reset(new PartListenerForViewNavigator(viewNavigatorAction));
790  window->GetPartService()->AddPartListener(viewNavigatorPartListener.data());
791  berry::IViewPart::Pointer viewnavigatorview =
792  window->GetActivePage()->FindView("org.mitk.views.viewnavigatorview");
793  viewNavigatorAction->setChecked(false);
794  if (viewnavigatorview)
795  {
796  bool isViewNavigatorVisible = window->GetActivePage()->IsPartVisible(viewnavigatorview);
797  if (isViewNavigatorVisible)
798  viewNavigatorAction->setChecked(true);
799  }
800  viewNavigatorAction->setToolTip("Toggle View Navigator");
801  }
802 
803  mainActionsToolBar->addAction(fileOpenAction);
804  mainActionsToolBar->addAction(fileSaveProjectAction);
805  mainActionsToolBar->addAction(closeProjectAction);
806  mainActionsToolBar->addAction(undoAction);
807  mainActionsToolBar->addAction(redoAction);
808  if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor"))
809  {
810  mainActionsToolBar->addAction(openDicomEditorAction);
811  }
812  if (imageNavigatorViewFound)
813  {
814  mainActionsToolBar->addAction(imageNavigatorAction);
815  }
816  if (viewNavigatorFound)
817  {
818  mainActionsToolBar->addAction(viewNavigatorAction);
819  }
820  mainWindow->addToolBar(mainActionsToolBar);
821 
822  // ==== Perspective Toolbar ==================================
823  auto qPerspectiveToolbar = new QToolBar;
824  qPerspectiveToolbar->setObjectName("perspectiveToolBar");
825 
826  if (showPerspectiveToolbar)
827  {
828  qPerspectiveToolbar->addActions(perspGroup->actions());
829  mainWindow->addToolBar(qPerspectiveToolbar);
830  }
831  else
832  delete qPerspectiveToolbar;
833 
834  // ==== View Toolbar ==================================
835  auto qToolbar = new QToolBar;
836  qToolbar->setObjectName("viewToolBar");
837 
838  if (showViewToolbar)
839  {
840  mainWindow->addToolBar(qToolbar);
841 
842  for (auto viewAction : viewActions)
843  {
844  qToolbar->addAction(viewAction);
845  }
846  }
847  else
848  delete qToolbar;
849 
850  QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
851  mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray());
852 
853  auto qStatusBar = new QStatusBar();
854 
855  //creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
856  auto statusBar = new QmitkStatusBar(qStatusBar);
857  //disabling the SizeGrip in the lower right corner
858  statusBar->SetSizeGripEnabled(false);
859 
860  auto progBar = new QmitkProgressBar();
861 
862  qStatusBar->addPermanentWidget(progBar, 0);
863  progBar->hide();
864  // progBar->AddStepsToDo(2);
865  // progBar->Progress(1);
866 
867  mainWindow->setStatusBar(qStatusBar);
868 
869  if (showMemoryIndicator)
870  {
871  auto memoryIndicator = new QmitkMemoryUsageIndicatorView();
872  qStatusBar->addPermanentWidget(memoryIndicator, 0);
873  }
874 }
875 
877 {
879 
880  // show the shortcut bar and progress indicator, which are hidden by
881  // default
882  //configurer->SetShowPerspectiveBar(true);
883  //configurer->SetShowFastViewBars(true);
884  //configurer->SetShowProgressIndicator(true);
885 
886  // // add the drag and drop support for the editor area
887  // configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
888  // configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
889  // configurer.addEditorAreaTransfer(FileTransfer.getInstance());
890  // configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
891  // configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
892  // configurer.getWindow()));
893 
894  this->HookTitleUpdateListeners(configurer);
895 
896  menuPerspectiveListener.reset(new PerspectiveListenerForMenu(this));
897  configurer->GetWindow()->AddPerspectiveListener(menuPerspectiveListener.data());
898 
899  configurer->AddEditorAreaTransfer(QStringList("text/uri-list"));
900  configurer->ConfigureEditorAreaDropListener(dropTargetListener.data());
901 }
902 
904 {
906  // Force Rendering Window Creation on startup.
908 
909  ctkPluginContext* context = QmitkCommonExtPlugin::getContext();
910  ctkServiceReference serviceRef = context->getServiceReference<mitk::IDataStorageService>();
911  if (serviceRef)
912  {
913  mitk::IDataStorageService *dsService = context->getService<mitk::IDataStorageService>(serviceRef);
914  if (dsService)
915  {
918  mitk::WorkbenchUtil::OpenEditor(configurer->GetWindow()->GetActivePage(),dsInput);
919  }
920  }
921 }
922 
924 {
925  QmitkExtWorkbenchWindowAdvisorHack::undohack->onIntro();
926 }
927 
929 {
930  QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelp();
931 }
932 
934 {
935  QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelpOpenHelpPerspective();
936 }
937 
939 {
940  QmitkExtWorkbenchWindowAdvisorHack::undohack->onAbout();
941 }
942 
943 //--------------------------------------------------------------------------------
944 // Ugly hack from here on. Feel free to delete when command framework
945 // and undo buttons are done.
946 //--------------------------------------------------------------------------------
947 
948 QmitkExtWorkbenchWindowAdvisorHack::QmitkExtWorkbenchWindowAdvisorHack() : QObject()
949 {
950 }
951 
952 QmitkExtWorkbenchWindowAdvisorHack::~QmitkExtWorkbenchWindowAdvisorHack()
953 {
954 }
955 
956 void QmitkExtWorkbenchWindowAdvisorHack::onUndo()
957 {
959  if (model)
960  {
961  if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast<mitk::VerboseLimitedLinearUndo*>( model ))
962  {
964  verboseundo->GetUndoDescriptions();
965  if (descriptions.size() >= 1)
966  {
967  MITK_INFO << "Undo " << descriptions.front().second;
968  }
969  }
970  model->Undo();
971  }
972  else
973  {
974  MITK_ERROR << "No undo model instantiated";
975  }
976 }
977 
978 void QmitkExtWorkbenchWindowAdvisorHack::onRedo()
979 {
981  if (model)
982  {
983  if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast<mitk::VerboseLimitedLinearUndo*>( model ))
984  {
986  verboseundo->GetRedoDescriptions();
987  if (descriptions.size() >= 1)
988  {
989  MITK_INFO << "Redo " << descriptions.front().second;
990  }
991  }
992  model->Redo();
993  }
994  else
995  {
996  MITK_ERROR << "No undo model instantiated";
997  }
998 }
999 
1000 // safe calls to the complete chain
1001 // berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->FindView("org.mitk.views.imagenavigator");
1002 // to cover for all possible cases of closed pages etc.
1003 static void SafeHandleNavigatorView(QString view_query_name)
1004 {
1006  if( wbench == nullptr )
1007  return;
1008 
1010  if( wbench_window.IsNull() )
1011  return;
1012 
1013  berry::IWorkbenchPage::Pointer wbench_page = wbench_window->GetActivePage();
1014  if( wbench_page.IsNull() )
1015  return;
1016 
1017  auto wbench_view = wbench_page->FindView( view_query_name );
1018 
1019  if( wbench_view.IsNotNull() )
1020  {
1021  bool isViewVisible = wbench_page->IsPartVisible( wbench_view );
1022  if( isViewVisible )
1023  {
1024  wbench_page->HideView( wbench_view );
1025  return;
1026  }
1027 
1028  }
1029 
1030  wbench_page->ShowView( view_query_name );
1031 }
1032 
1033 void QmitkExtWorkbenchWindowAdvisorHack::onImageNavigator()
1034 {
1035  // show/hide ImageNavigatorView
1036  SafeHandleNavigatorView("org.mitk.views.imagenavigator");
1037 }
1038 
1039 void QmitkExtWorkbenchWindowAdvisorHack::onViewNavigator()
1040 {
1041  // show/hide viewnavigatorView
1042  SafeHandleNavigatorView("org.mitk.views.viewnavigatorview");
1043 }
1044 
1045 void QmitkExtWorkbenchWindowAdvisorHack::onEditPreferences()
1046 {
1047  QmitkPreferencesDialog _PreferencesDialog(QApplication::activeWindow());
1048  _PreferencesDialog.exec();
1049 }
1050 
1051 void QmitkExtWorkbenchWindowAdvisorHack::onQuit()
1052 {
1054 }
1055 
1056 void QmitkExtWorkbenchWindowAdvisorHack::onResetPerspective()
1057 {
1058  berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective();
1059 }
1060 
1061 void QmitkExtWorkbenchWindowAdvisorHack::onClosePerspective()
1062 {
1064  page =
1066  page->ClosePerspective(page->GetPerspective(), true, true);
1067 }
1068 
1069 void QmitkExtWorkbenchWindowAdvisorHack::onNewWindow()
1070 {
1072 }
1073 
1074 void QmitkExtWorkbenchWindowAdvisorHack::onIntro()
1075 {
1076  bool hasIntro =
1078  if (!hasIntro)
1079  {
1080  QRegExp reg("(.*)<title>(\\n)*");
1081  QRegExp reg2("(\\n)*</title>(.*)");
1082  QFile file(":/org.mitk.gui.qt.ext/index.html");
1083  file.open(QIODevice::ReadOnly | QIODevice::Text); //text file only for reading
1084 
1085  QString text = QString(file.readAll());
1086 
1087  file.close();
1088 
1089  QString title = text;
1090  title.replace(reg, "");
1091  title.replace(reg2, "");
1092 
1093  std::cout << title.toStdString() << std::endl;
1094 
1095  QMessageBox::information(nullptr, title,
1096  text, "Close");
1097  }
1098  else
1099  {
1101  berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(), false);
1102  }
1103 }
1104 
1105 void QmitkExtWorkbenchWindowAdvisorHack::onHelp()
1106 {
1107  ctkPluginContext* context = QmitkCommonExtPlugin::getContext();
1108  if (context == nullptr)
1109  {
1110  MITK_WARN << "Plugin context not set, unable to open context help";
1111  return;
1112  }
1113 
1114  // Check if the org.blueberry.ui.qt.help plug-in is installed and started
1115  QList<QSharedPointer<ctkPlugin> > plugins = context->getPlugins();
1116  foreach(QSharedPointer<ctkPlugin> p, plugins)
1117  {
1118  if (p->getSymbolicName() == "org.blueberry.ui.qt.help")
1119  {
1120  if (p->getState() != ctkPlugin::ACTIVE)
1121  {
1122  // try to activate the plug-in explicitly
1123  try
1124  {
1125  p->start(ctkPlugin::START_TRANSIENT);
1126  }
1127  catch (const ctkPluginException& pe)
1128  {
1129  MITK_ERROR << "Activating org.blueberry.ui.qt.help failed: " << pe.what();
1130  return;
1131  }
1132  }
1133  }
1134  }
1135 
1136  ctkServiceReference eventAdminRef = context->getServiceReference<ctkEventAdmin>();
1137  ctkEventAdmin* eventAdmin = nullptr;
1138  if (eventAdminRef)
1139  {
1140  eventAdmin = context->getService<ctkEventAdmin>(eventAdminRef);
1141  }
1142  if (eventAdmin == nullptr)
1143  {
1144  MITK_WARN << "ctkEventAdmin service not found. Unable to open context help";
1145  }
1146  else
1147  {
1148  ctkEvent ev("org/blueberry/ui/help/CONTEXTHELP_REQUESTED");
1149  eventAdmin->postEvent(ev);
1150  }
1151 }
1152 
1153 void QmitkExtWorkbenchWindowAdvisorHack::onHelpOpenHelpPerspective()
1154 {
1155  berry::PlatformUI::GetWorkbench()->ShowPerspective("org.blueberry.perspectives.help",
1156  berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow());
1157 }
1158 
1159 void QmitkExtWorkbenchWindowAdvisorHack::onAbout()
1160 {
1161  auto aboutDialog = new QmitkAboutDialog(QApplication::activeWindow(),nullptr);
1162  aboutDialog->open();
1163 }
1164 
1165 void QmitkExtWorkbenchWindowAdvisor::HookTitleUpdateListeners(
1167 {
1168  // hook up the listeners to update the window title
1169  titlePartListener.reset(new PartListenerForTitle(this));
1170  titlePerspectiveListener.reset(new PerspectiveListenerForTitle(this));
1171  editorPropertyListener.reset(new berry::PropertyChangeIntAdapter<
1173  &QmitkExtWorkbenchWindowAdvisor::PropertyChange));
1174 
1175  // configurer.getWindow().addPageListener(new IPageListener() {
1176  // public void pageActivated(IWorkbenchPage page) {
1177  // updateTitle(false);
1178  // }
1179  //
1180  // public void pageClosed(IWorkbenchPage page) {
1181  // updateTitle(false);
1182  // }
1183  //
1184  // public void pageOpened(IWorkbenchPage page) {
1185  // // do nothing
1186  // }
1187  // });
1188 
1189  configurer->GetWindow()->AddPerspectiveListener(titlePerspectiveListener.data());
1190  configurer->GetWindow()->GetPartService()->AddPartListener(titlePartListener.data());
1191 }
1192 
1193 QString QmitkExtWorkbenchWindowAdvisor::ComputeTitle()
1194 {
1197  berry::IWorkbenchPage::Pointer currentPage =
1198  configurer->GetWindow()->GetActivePage();
1199  berry::IEditorPart::Pointer activeEditor;
1200  if (currentPage)
1201  {
1202  activeEditor = lastActiveEditor.Lock();
1203  }
1204 
1205  QString title;
1207  if (product.IsNotNull())
1208  {
1209  title = product->GetName();
1210  }
1211  if (title.isEmpty())
1212  {
1213  // instead of the product name, we use a custom variable for now
1214  title = productName;
1215  }
1216 
1217  if(showMitkVersionInfo)
1218  {
1219  title += QString(" ") + MITK_VERSION_STRING;
1220  }
1221 
1222  if (showVersionInfo)
1223  {
1224  // add version informatioin
1225  QString versions = QString(" (ITK %1.%2.%3 VTK %4.%5.%6 Qt %7 MITK %8)")
1226  .arg(ITK_VERSION_MAJOR).arg(ITK_VERSION_MINOR).arg(ITK_VERSION_PATCH)
1227  .arg(VTK_MAJOR_VERSION).arg(VTK_MINOR_VERSION).arg(VTK_BUILD_VERSION)
1228  .arg(QT_VERSION_STR)
1229  .arg(MITK_VERSION_STRING);
1230 
1231  title += versions;
1232  }
1233 
1234  if (currentPage)
1235  {
1236  if (activeEditor)
1237  {
1238  lastEditorTitle = activeEditor->GetTitleToolTip();
1239  if (!lastEditorTitle.isEmpty())
1240  title = lastEditorTitle + " - " + title;
1241  }
1243  currentPage->GetPerspective();
1244  QString label = "";
1245  if (persp)
1246  {
1247  label = persp->GetLabel();
1248  }
1249  berry::IAdaptable* input = currentPage->GetInput();
1250  if (input && input != wbAdvisor->GetDefaultPageInput())
1251  {
1252  label = currentPage->GetLabel();
1253  }
1254  if (!label.isEmpty())
1255  {
1256  title = label + " - " + title;
1257  }
1258  }
1259 
1260  title += " (Not for use in diagnosis or treatment of patients)";
1261 
1262  return title;
1263 }
1264 
1265 void QmitkExtWorkbenchWindowAdvisor::RecomputeTitle()
1266 {
1269  QString oldTitle = configurer->GetTitle();
1270  QString newTitle = ComputeTitle();
1271  if (newTitle != oldTitle)
1272  {
1273  configurer->SetTitle(newTitle);
1274  }
1275 }
1276 
1277 void QmitkExtWorkbenchWindowAdvisor::UpdateTitle(bool editorHidden)
1278 {
1281  berry::IWorkbenchWindow::Pointer window = configurer->GetWindow();
1282  berry::IEditorPart::Pointer activeEditor;
1283  berry::IWorkbenchPage::Pointer currentPage = window->GetActivePage();
1285  berry::IAdaptable* input = nullptr;
1286 
1287  if (currentPage)
1288  {
1289  activeEditor = currentPage->GetActiveEditor();
1290  persp = currentPage->GetPerspective();
1291  input = currentPage->GetInput();
1292  }
1293 
1294  if (editorHidden)
1295  {
1296  activeEditor = nullptr;
1297  }
1298 
1299  // Nothing to do if the editor hasn't changed
1300  if (activeEditor == lastActiveEditor.Lock() && currentPage == lastActivePage.Lock()
1301  && persp == lastPerspective.Lock() && input == lastInput)
1302  {
1303  return;
1304  }
1305 
1306  if (!lastActiveEditor.Expired())
1307  {
1308  lastActiveEditor.Lock()->RemovePropertyListener(editorPropertyListener.data());
1309  }
1310 
1311  lastActiveEditor = activeEditor;
1312  lastActivePage = currentPage;
1313  lastPerspective = persp;
1314  lastInput = input;
1315 
1316  if (activeEditor)
1317  {
1318  activeEditor->AddPropertyListener(editorPropertyListener.data());
1319  }
1320 
1321  RecomputeTitle();
1322 }
1323 
1324 void QmitkExtWorkbenchWindowAdvisor::PropertyChange(const berry::Object::Pointer& /*source*/, int propId)
1325 {
1327  {
1328  if (!lastActiveEditor.Expired())
1329  {
1330  QString newTitle = lastActiveEditor.Lock()->GetPartName();
1331  if (lastEditorTitle != newTitle)
1332  {
1333  RecomputeTitle();
1334  }
1335  }
1336  }
1337 }
1338 
1340 {
1341  this->perspectiveExcludeList = v;
1342 }
1343 
1345 {
1346  return this->perspectiveExcludeList;
1347 }
1348 
1350 {
1351  this->viewExcludeList = v;
1352 }
1353 
1355 {
1356  return this->viewExcludeList;
1357 }
1358 
1360 {
1361  berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow();
1362  QMainWindow* mainWindow = static_cast<QMainWindow*> (window->GetShell()->GetControl());
1363 
1364  QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
1365  settings.setValue("ToolbarPosition", mainWindow->saveState());
1366 }
1367 
1368 QString QmitkExtWorkbenchWindowAdvisor::GetQSettingsFile() const
1369 {
1370  QFileInfo settingsInfo = QmitkCommonExtPlugin::getContext()->getDataFile(QT_SETTINGS_FILENAME);
1371  return settingsInfo.canonicalFilePath();
1372 }
QWidget * CreateEmptyWindowContents(QWidget *parent) override
virtual void PartHidden(const IWorkbenchPartReference::Pointer &)
#define MITK_VERSION_STRING
Definition: mitkVersion.h:9
virtual bool Redo()=0
#define MITK_INFO
Definition: mitkLogMacros.h:22
#define MITK_ERROR
Definition: mitkLogMacros.h:24
virtual void PerspectiveActivated(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &perspective)
virtual void PerspectiveOpened(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &perspective)
berry::SmartPointer< berry::ActionBarAdvisor > CreateActionBarAdvisor(berry::SmartPointer< berry::IActionBarConfigurer > configurer) override
QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor *wbAdvisor, berry::IWorkbenchWindowConfigurer::Pointer configurer)
static const QString QT_ICON_THEME
virtual IDataStorageReference::Pointer GetDataStorage() const =0
virtual SmartPointer< ActionBarAdvisor > CreateActionBarAdvisor(SmartPointer< IActionBarConfigurer > configurer)
virtual SmartPointer< IPreferences > GetSystemPreferences()=0
virtual void PartOpened(const IWorkbenchPartReference::Pointer &)
virtual IIntroManager * GetIntroManager() const =0
virtual QList< IPerspectiveDescriptor::Pointer > GetPerspectives()=0
static bool USE_EXPERIMENTAL_COMMAND_CONTRIBUTIONS
QT-Toolkit/GUI dependent class that provides the QT's ProgressBar.
virtual bool Close()=0
An editor input based on a mitk::DataStorage.
virtual void PartActivated(const IWorkbenchPartReference::Pointer &)
virtual IIntroPart::Pointer ShowIntro(IWorkbenchWindow::Pointer preferredWindow, bool standby)=0
SmartPointer< IWorkbenchWindowConfigurer > GetWindowConfigurer()
void SetPerspectiveExcludeList(const QList< QString > &v)
virtual void PerspectiveClosed(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &perspective)
virtual bool HasIntro() const =0
virtual Events::Types GetPerspectiveEventTypes() const =0
#define MITK_WARN
Definition: mitkLogMacros.h:23
virtual QList< IViewDescriptor::Pointer > GetViews() const =0
QT-Toolkit/GUI dependent class that provides to send a Message to the QT's StatusBar.
virtual IWorkbenchWindow::Pointer OpenWorkbenchWindow(const QString &perspectiveId, IAdaptable *input)=0
virtual bool Undo()=0
static IWorkbench * GetWorkbench()
static const QString QT_STYLES_NODE
virtual IWorkbenchWindow::Pointer GetActiveWorkbenchWindow() const =0
virtual IAdaptable * GetDefaultPageInput()
The custom viewer plugin implements simple viewer functionality presented in a customized look and feel It was developed to demonstrate extensibility and customizability of the blueberry application framework As an example for the GUI customization capabilities provided by the BlueBerry application the custom viewer plugin was developed It features simple viewer functionality presented in a customized look and feel The custom viewer consists of two i e a viewer perspective and a DICOM perspective As part of the viewer perspective
static SmartPointer< IProduct > GetProduct()
superclass for all UndoModels
Definition: mitkUndoModel.h:36
A limited linear undo model providing GUI elements with stack status information. ...
virtual void PartClosed(const IWorkbenchPartReference::Pointer &)
virtual void PartVisible(const IWorkbenchPartReference::Pointer &)
The custom viewer plugin implements simple viewer functionality presented in a customized look and feel It was developed to demonstrate extensibility and customizability of the blueberry application framework As an example for the GUI customization capabilities provided by the BlueBerry application the custom viewer plugin was developed It features simple viewer functionality presented in a customized look and feel The custom viewer consists of two perspectives
virtual void PartBroughtToTop(const IWorkbenchPartReference::Pointer &)
static UndoModel * GetCurrentUndoModel()
gives access to the currently used UndoModel Introduced to access special functions of more specific ...
virtual IViewRegistry * GetViewRegistry() const =0
SmartPointer< Other > Cast() const
virtual void PerspectiveSavedAs(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &oldPerspective, const IPerspectiveDescriptor::Pointer &newPerspective)
static berry::IEditorPart::Pointer OpenEditor(berry::IWorkbenchPage::Pointer page, berry::IEditorInput::Pointer input, const QString &editorId, bool activate=false)
SmartPointer< ObjectType > Lock() const
bool Expired() const
virtual Events::Types GetPartEventTypes() const =0
std::vector< StackDescriptionItem > StackDescription
virtual SmartPointer< IWorkbenchPage > ShowPerspective(const QString &perspectiveId, IWorkbenchWindow::Pointer window)=0
void SetViewExcludeList(const QList< QString > &v)
static IPreferencesService * GetPreferencesService()
static void SafeHandleNavigatorView(QString view_query_name)
virtual void PerspectiveDeactivated(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &perspective)