diff --git a/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.cpp b/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.cpp
index 262b7a99cf..537099f301 100755
--- a/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.cpp
+++ b/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.cpp
@@ -1,623 +1,623 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 //#define MBILOG_ENABLE_DEBUG 1
 
 #include <QmitkStyleManager.h>
 #include "QmitkToolSelectionBox.h"
 #include "QmitkToolGUI.h"
 #include "mitkBaseRenderer.h"
 
 #include <QList>
 #include <QApplication>
 #include <QLayout>
 #include <QMessageBox>
 #include <QToolButton>
 #include <QToolTip>
 #include <QRegularExpression>
 
 #include <queue>
 
 #include "usModuleResource.h"
 #include "usModuleResourceStream.h"
 
 #include "mitkToolManagerProvider.h"
 
 QmitkToolSelectionBox::QmitkToolSelectionBox(QWidget *parent, mitk::DataStorage *)
   : QWidget(parent),
     m_SelfCall(false),
     m_DisplayedGroups("default"),
     m_LayoutColumns(2),
     m_ShowNames(true),
     m_GenerateAccelerators(false),
     m_ToolGUIWidget(nullptr),
     m_LastToolGUI(nullptr),
     m_ToolButtonGroup(nullptr),
     m_ButtonLayout(nullptr)
 {
   QFont currentFont = QWidget::font();
   currentFont.setBold(true);
   QWidget::setFont(currentFont);
 
   m_ToolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
 
   // QButtonGroup
   m_ToolButtonGroup = new QButtonGroup(this);
   // some features of QButtonGroup
   m_ToolButtonGroup->setExclusive(false); // mutually exclusive toggle buttons
 
   RecreateButtons();
 
   QWidget::setContentsMargins(0, 0, 0, 0);
   if (layout() != nullptr)
   {
     layout()->setContentsMargins(0, 0, 0, 0);
   }
 
   // reactions to signals
   connect(m_ToolButtonGroup, &QButtonGroup::idClicked, this, &QmitkToolSelectionBox::toolButtonClicked);
 
   // reactions to ToolManager events
 
   m_ToolManager->ActiveToolChanged +=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerToolModified);
   m_ToolManager->ReferenceDataChanged +=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerReferenceDataModified);
   m_ToolManager->WorkingDataChanged +=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerWorkingDataModified);
 
   // show active tool
   SetOrUnsetButtonForActiveTool();
 
   QWidget::setEnabled(false);
 }
 
 QmitkToolSelectionBox::~QmitkToolSelectionBox()
 {
   m_ToolManager->ActiveToolChanged -=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerToolModified);
   m_ToolManager->ReferenceDataChanged -=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerReferenceDataModified);
   m_ToolManager->WorkingDataChanged -=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerWorkingDataModified);
 }
 
 mitk::ToolManager *QmitkToolSelectionBox::GetToolManager()
 {
   return m_ToolManager;
 }
 
 void QmitkToolSelectionBox::SetToolManager(
   mitk::ToolManager &newManager) // no nullptr pointer allowed here, a manager is required
 {
   // say bye to the old manager
   m_ToolManager->ActiveToolChanged -=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerToolModified);
   m_ToolManager->ReferenceDataChanged -=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerReferenceDataModified);
   m_ToolManager->WorkingDataChanged -=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerWorkingDataModified);
 
   if (QWidget::isEnabled())
   {
     m_ToolManager->UnregisterClient();
   }
 
   m_ToolManager = &newManager;
   RecreateButtons();
 
   // greet the new one
   m_ToolManager->ActiveToolChanged +=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerToolModified);
   m_ToolManager->ReferenceDataChanged +=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerReferenceDataModified);
   m_ToolManager->WorkingDataChanged +=
     mitk::MessageDelegate<QmitkToolSelectionBox>(this, &QmitkToolSelectionBox::OnToolManagerWorkingDataModified);
 
   if (QWidget::isEnabled())
   {
     m_ToolManager->RegisterClient();
   }
 
   // ask the new one what the situation is like
   SetOrUnsetButtonForActiveTool();
 }
 
 void QmitkToolSelectionBox::toolButtonClicked(int id)
 {
   if (!QWidget::isEnabled())
     return; // this method could be triggered from the constructor, when we are still disabled
 
   MITK_DEBUG << "toolButtonClicked(" << id << "): id translates to tool ID " << m_ToolIDForButtonID[id];
 
   QToolButton *toolButton = dynamic_cast<QToolButton *>(m_ToolButtonGroup->buttons().at(id));
   if (toolButton)
   {
     if ((m_ButtonIDForToolID.find(m_ToolManager->GetActiveToolID()) !=
          m_ButtonIDForToolID.end()) // if we have this tool in our box
         &&
         (m_ButtonIDForToolID[m_ToolManager->GetActiveToolID()] ==
          id)) // the tool corresponding to this button is already active
     {
       // disable this button, disable all tools
       toolButton->setChecked(false);
       m_ToolManager->ActivateTool(-1); // disable everything
     }
     else
     {
       // enable the corresponding tool
       m_SelfCall = true;
 
       m_ToolManager->ActivateTool(m_ToolIDForButtonID[id]);
 
       m_SelfCall = false;
     }
   }
 }
 
 void QmitkToolSelectionBox::OnToolManagerToolModified()
 {
   SetOrUnsetButtonForActiveTool();
 }
 
 void QmitkToolSelectionBox::SetOrUnsetButtonForActiveTool()
 {
   // we want to emit a signal in any case, whether we selected ourselves or somebody else changes "our" tool manager.
   // --> emit before check on m_SelfCall
   int id = m_ToolManager->GetActiveToolID();
 
   // don't emit signal for shape model tools
   bool emitSignal = true;
   mitk::Tool *tool = m_ToolManager->GetActiveTool();
   if (tool && std::string(tool->GetGroup()) == "organ_segmentation")
     emitSignal = false;
 
   if (emitSignal)
     emit ToolSelected(id);
 
   // delete old GUI (if any)
   if (m_LastToolGUI && m_ToolGUIWidget)
   {
     if (m_ToolGUIWidget->layout())
     {
       m_ToolGUIWidget->layout()->removeWidget(m_LastToolGUI);
     }
 
     m_LastToolGUI->setParent(nullptr);
     delete m_LastToolGUI; // will hopefully notify parent and layouts
     m_LastToolGUI = nullptr;
 
     QLayout *layout = m_ToolGUIWidget->layout();
     if (layout)
     {
       layout->activate();
     }
   }
 
   QToolButton *toolButton(nullptr);
 
   if (m_ButtonIDForToolID.find(id) != m_ButtonIDForToolID.end()) // if this tool is in our box
   {
     toolButton = dynamic_cast<QToolButton *>(m_ToolButtonGroup->buttons().at(m_ButtonIDForToolID[id]));
   }
 
   if (toolButton)
   {
     // mmueller
     // uncheck all other buttons
     QAbstractButton *tmpBtn = nullptr;
 
     for (int i = 0; i < m_ToolButtonGroup->buttons().size(); ++i)
     {
       tmpBtn = m_ToolButtonGroup->buttons().at(i);
       if (tmpBtn != toolButton)
         dynamic_cast<QToolButton *>(tmpBtn)->setChecked(false);
     }
 
     toolButton->setChecked(true);
 
     if (m_ToolGUIWidget && tool)
     {
       // create and reparent new GUI (if any)
       itk::Object::Pointer possibleGUI = tool->GetGUI("Qmitk", "GUI").GetPointer(); // prefix and postfix
 
       if (possibleGUI.IsNull())
         possibleGUI = tool->GetGUI("", "GUI").GetPointer();
 
       QmitkToolGUI *gui = dynamic_cast<QmitkToolGUI *>(possibleGUI.GetPointer());
 
       //!
       m_LastToolGUI = gui;
       if (gui)
       {
         gui->SetTool(tool);
 
         gui->setParent(m_ToolGUIWidget);
         gui->move(gui->geometry().topLeft());
         gui->show();
 
         QLayout *layout = m_ToolGUIWidget->layout();
         if (!layout)
         {
           layout = new QVBoxLayout(m_ToolGUIWidget);
         }
         if (layout)
         {
           layout->addWidget(gui);
           layout->activate();
         }
       }
     }
   }
   else
   {
     // disable all buttons
     QToolButton *selectedToolButton = dynamic_cast<QToolButton *>(m_ToolButtonGroup->checkedButton());
     if (selectedToolButton)
     {
       selectedToolButton->setChecked(false);
     }
   }
 }
 
 void QmitkToolSelectionBox::OnToolManagerReferenceDataModified()
 {
   if (m_SelfCall)
     return;
 
   MITK_DEBUG << "OnToolManagerReferenceDataModified()";
 
   this->UpdateButtonsEnabledState();
 }
 
 void QmitkToolSelectionBox::OnToolManagerWorkingDataModified()
 {
   if (m_SelfCall)
     return;
 
   MITK_DEBUG << "OnToolManagerWorkingDataModified()";
 
   this->UpdateButtonsEnabledState();
 }
 
 void QmitkToolSelectionBox::setEnabled(bool enable)
 {
   if (QWidget::isEnabled() == enable)
     return;
 
   QWidget::setEnabled(enable);
 
   if (enable)
   {
     m_ToolManager->RegisterClient();
 
     auto id = m_ToolManager->GetActiveToolID();
     emit ToolSelected(id);
   }
   else
   {
     m_ToolManager->ActivateTool(-1);
     m_ToolManager->UnregisterClient();
 
     emit ToolSelected(-1);
   }
 }
 
 void QmitkToolSelectionBox::UpdateButtonsEnabledState()
 {
   auto buttons = m_ToolButtonGroup->buttons();
 
   const auto refDataNode = m_ToolManager->GetReferenceData(0);
   const mitk::BaseData* refData = nullptr;
   if (nullptr != refDataNode)
   {
     refData = refDataNode->GetData();
   }
 
   const auto workingDataNode = m_ToolManager->GetWorkingData(0);
   const mitk::BaseData* workingData = nullptr;
   if (nullptr != workingDataNode)
   {
     workingData = workingDataNode->GetData();
   }
 
   for (const auto& button : qAsConst(buttons))
   {
     const auto buttonID = m_ToolButtonGroup->id(button);
     const auto toolID = m_ToolIDForButtonID[buttonID];
     const auto tool = m_ToolManager->GetToolById(toolID);
 
     button->setEnabled(tool->CanHandle(refData, workingData));
   }
 }
 
 void QmitkToolSelectionBox::RecreateButtons()
 {
   if (m_ToolManager.IsNull())
     return;
 
   QList<QAbstractButton *> l = m_ToolButtonGroup->buttons();
   // remove all buttons that are there
   QList<QAbstractButton *>::iterator it;
   QAbstractButton *btn;
 
   for (it = l.begin(); it != l.end(); ++it)
   {
     btn = *it;
     m_ToolButtonGroup->removeButton(btn);
     delete btn;
   }
 
   mitk::ToolManager::ToolVectorTypeConst allPossibleTools = m_ToolManager->GetTools();
   mitk::ToolManager::ToolVectorTypeConst allTools;
 
   typedef std::pair<std::string::size_type, const mitk::Tool *> SortPairType;
   typedef std::priority_queue<SortPairType> SortedToolQueueType;
   SortedToolQueueType toolPositions;
 
   // clear and sort all tools
   // step one: find name/group of all tools in m_DisplayedGroups string. remember these positions for all tools.
   for (mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allPossibleTools.begin();
        iter != allPossibleTools.end();
        ++iter)
   {
     const mitk::Tool *tool = *iter;
 
     std::string::size_type namePos = m_DisplayedGroups.find(std::string("'") + tool->GetName() + "'");
     std::string::size_type groupPos = m_DisplayedGroups.find(std::string("'") + tool->GetGroup() + "'");
 
     if (!m_DisplayedGroups.empty() && namePos == std::string::npos && groupPos == std::string::npos)
       continue; // skip
 
     if (m_DisplayedGroups.empty() && std::string(tool->GetName()).length() > 0)
     {
       namePos = static_cast<std::string::size_type>(tool->GetName()[0]);
     }
 
     SortPairType thisPair = std::make_pair(namePos < groupPos ? namePos : groupPos, *iter);
     toolPositions.push(thisPair);
   }
 
   // step two: sort tools according to previously found positions in m_DisplayedGroups
   MITK_DEBUG << "Sorting order of tools (lower number --> earlier in button group)";
   while (!toolPositions.empty())
   {
     SortPairType thisPair = toolPositions.top();
     MITK_DEBUG << "Position " << thisPair.first << " : " << thisPair.second->GetName();
 
     allTools.push_back(thisPair.second);
     toolPositions.pop();
   }
   std::reverse(allTools.begin(), allTools.end());
 
   MITK_DEBUG << "Sorted tools:";
   for (mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allTools.begin(); iter != allTools.end(); ++iter)
   {
     MITK_DEBUG << (*iter)->GetName();
   }
 
   if (m_ButtonLayout == nullptr)
     m_ButtonLayout = new QGridLayout;
 
   int row(0);
   int column(-1);
 
   int currentButtonID(0);
   m_ButtonIDForToolID.clear();
   m_ToolIDForButtonID.clear();
   QToolButton *button = nullptr;
 
   MITK_DEBUG << "Creating buttons for tools";
   // fill group box with buttons
   for (mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allTools.begin(); iter != allTools.end(); ++iter)
   {
     const mitk::Tool *tool = *iter;
     int currentToolID(m_ToolManager->GetToolID(tool));
 
     ++column;
     // new line if we are at the maximum columns
     if (column == m_LayoutColumns)
     {
       ++row;
       column = 0;
     }
 
     button = new QToolButton;
     button->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
     // add new button to the group
     MITK_DEBUG << "Adding button with ID " << currentToolID;
     m_ToolButtonGroup->addButton(button, currentButtonID);
     // ... and to the layout
     MITK_DEBUG << "Adding button in row/column " << row << "/" << column;
     m_ButtonLayout->addWidget(button, row, column);
 
     if (m_LayoutColumns == 1)
     {
       button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
     }
     else
     {
       button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
     }
 
     button->setCheckable(true);
 
     if (currentToolID == m_ToolManager->GetActiveToolID())
       button->setChecked(true);
 
     QString label;
     if (m_GenerateAccelerators)
     {
       label += "&";
     }
     label += tool->GetName();
     QString tooltip = tool->GetName();
     MITK_DEBUG << tool->GetName() << ", " << label.toLocal8Bit().constData() << ", '"
                << tooltip.toLocal8Bit().constData();
 
     if (m_ShowNames)
     {
       button->setText(label); // a label
       button->setToolTip(tooltip);
 
       QFont currentFont = button->font();
       currentFont.setBold(false);
       button->setFont(currentFont);
     }
 
     us::ModuleResource iconResource = tool->GetIconResource();
 
     if (!iconResource.IsValid())
     {
       button->setIcon(QIcon(QPixmap(tool->GetXPM())));
     }
     else
     {
       auto isSVG = "svg" == iconResource.GetSuffix();
       auto openmode = isSVG ? std::ios_base::in : std::ios_base::binary;
 
       us::ModuleResourceStream resourceStream(iconResource, openmode);
       resourceStream.seekg(0, std::ios::end);
       std::ios::pos_type length = resourceStream.tellg();
       resourceStream.seekg(0, std::ios::beg);
 
       char *data = new char[length];
       resourceStream.read(data, length);
 
       if (isSVG)
       {
         button->setIcon(QmitkStyleManager::ThemeIcon(QByteArray::fromRawData(data, length)));
       }
       else
       {
         QPixmap pixmap;
         pixmap.loadFromData(QByteArray::fromRawData(data, length));
         button->setIcon(QIcon(pixmap));
       }
 
       delete[] data;
 
       if (m_ShowNames)
       {
         if (m_LayoutColumns == 1)
           button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
         else
           button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
 
         button->setIconSize(QSize(24, 24));
       }
       else
       {
         button->setToolButtonStyle(Qt::ToolButtonIconOnly);
         button->setIconSize(QSize(32, 32));
         button->setToolTip(tooltip);
       }
     }
 
     if (m_GenerateAccelerators)
     {
       QString firstLetter = QString(tool->GetName());
       firstLetter.truncate(1);
       button->setShortcut(
         firstLetter); // a keyboard shortcut (just the first letter of the given name w/o any CTRL or something)
     }
 
     m_ButtonIDForToolID[currentToolID] = currentButtonID;
     m_ToolIDForButtonID[currentButtonID] = currentToolID;
 
     MITK_DEBUG << "m_ButtonIDForToolID[" << currentToolID << "] == " << currentButtonID;
     MITK_DEBUG << "m_ToolIDForButtonID[" << currentButtonID << "] == " << currentToolID;
 
     tool->GUIProcessEventsMessage += mitk::MessageDelegate<QmitkToolSelectionBox>(
       this, &QmitkToolSelectionBox::OnToolGUIProcessEventsMessage); // will never add a listener twice, so we don't have
                                                                     // to check here
     tool->ErrorMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>(
       this,
       &QmitkToolSelectionBox::OnToolErrorMessage); // will never add a listener twice, so we don't have to check here
     tool->GeneralMessage +=
       mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>(this, &QmitkToolSelectionBox::OnGeneralToolMessage);
 
     ++currentButtonID;
   }
   // setting grid layout for this groupbox
   this->setLayout(m_ButtonLayout);
 
   this->UpdateButtonsEnabledState();
   // this->update();
 }
 
 void QmitkToolSelectionBox::OnToolGUIProcessEventsMessage()
 {
   qApp->processEvents();
 }
 
 void QmitkToolSelectionBox::OnToolErrorMessage(std::string s)
 {
   QMessageBox::critical(
     this, "MITK", QString(s.c_str()), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
 }
 
 void QmitkToolSelectionBox::OnGeneralToolMessage(std::string s)
 {
   QMessageBox::information(
     this, "MITK", QString(s.c_str()), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
 }
 
 void QmitkToolSelectionBox::SetDisplayedToolGroups(const std::string &toolGroups)
 {
   if (m_DisplayedGroups != toolGroups)
   {
     QString q_DisplayedGroups = toolGroups.c_str();
     // quote all unquoted single words
-    q_DisplayedGroups = q_DisplayedGroups.replace(QRegExp("\\b(\\w+)\\b|'([^']+)'"), "'\\1\\2'");
+    q_DisplayedGroups = q_DisplayedGroups.replace(QRegularExpression("\\b(\\w+)\\b|'([^']+)'"), "'\\1\\2'");
     MITK_DEBUG << "m_DisplayedGroups was \"" << toolGroups << "\"";
 
     m_DisplayedGroups = q_DisplayedGroups.toLocal8Bit().constData();
     MITK_DEBUG << "m_DisplayedGroups is \"" << m_DisplayedGroups << "\"";
 
     RecreateButtons();
     SetOrUnsetButtonForActiveTool();
   }
 }
 
 void QmitkToolSelectionBox::SetLayoutColumns(int columns)
 {
   if (columns > 0 && columns != m_LayoutColumns)
   {
     m_LayoutColumns = columns;
     RecreateButtons();
   }
 }
 
 void QmitkToolSelectionBox::SetShowNames(bool show)
 {
   if (show != m_ShowNames)
   {
     m_ShowNames = show;
     RecreateButtons();
   }
 }
 
 void QmitkToolSelectionBox::SetGenerateAccelerators(bool accel)
 {
   if (accel != m_GenerateAccelerators)
   {
     m_GenerateAccelerators = accel;
     RecreateButtons();
   }
 }
 
 void QmitkToolSelectionBox::SetToolGUIArea(QWidget *parentWidget)
 {
   m_ToolGUIWidget = parentWidget;
 }
 
diff --git a/Plugins/org.blueberry.ui.qt/CMakeLists.txt b/Plugins/org.blueberry.ui.qt/CMakeLists.txt
index 21d4eea9cb..fd7b5e3956 100644
--- a/Plugins/org.blueberry.ui.qt/CMakeLists.txt
+++ b/Plugins/org.blueberry.ui.qt/CMakeLists.txt
@@ -1,42 +1,42 @@
 project(org_blueberry_ui_qt)
 
 set(PLUGIN_exported_include_suffixes
   src
   src/actions
   src/application
   src/commands
   src/guitk
   src/handlers
   src/intro
   src/model
   src/presentations
   src/services
   src/testing
   src/tweaklets
   src/util
 )
 
 if(MITK_USE_Qt6)
   set(PLUGIN_package_depends
-    PUBLIC Qt6|Widgets+Svg
+    PUBLIC Qt6|Widgets+PrintSupport+Svg
   )
 endif()
 
 mitk_create_plugin(
   EXPORT_DIRECTIVE BERRY_UI_QT
   EXPORTED_INCLUDE_SUFFIXES ${PLUGIN_exported_include_suffixes}
   MODULE_DEPENDS PUBLIC MitkCore
   PACKAGE_DEPENDS ${PLUGIN_package_depends}
 )
 
 if (TARGET ${PLUGIN_TARGET} AND MSVC)
   #[[ Compiler warnings/errors because of QList on Visual Studio 2022 version 17.8:
 
       'stdext::checked_array_iterator<const T *>': warning STL4043: stdext::checked_array_iterator,
       stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions
       and will be removed in the future. std::span (since C++20) and gsl::span can be used instead.
       You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS
       to suppress this warning.
    ]]
   target_compile_definitions(${PLUGIN_TARGET} PRIVATE _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)
 endif()
diff --git a/Plugins/org.blueberry.ui.qt/src/internal/berryCategory.txx b/Plugins/org.blueberry.ui.qt/src/internal/berryCategory.txx
index a0c0342af0..258799f40a 100644
--- a/Plugins/org.blueberry.ui.qt/src/internal/berryCategory.txx
+++ b/Plugins/org.blueberry.ui.qt/src/internal/berryCategory.txx
@@ -1,190 +1,190 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #ifndef __BERRY_CATEGORY_TXX__
 #define __BERRY_CATEGORY_TXX__
 
 #include "berryWorkbenchRegistryConstants.h"
 
 #include <berryIContributor.h>
 #include <berryUIException.h>
 
 #include <QStringList>
 
 namespace berry
 {
 
 template<class T>
 const QString Category<T>::MISC_NAME = "Other";
 
 template<class T>
 const QString Category<T>::MISC_ID =
     "org.blueberry.ui.internal.otherCategory";
 
 template<class T> Category<T>::Category()
 {
   this->id = MISC_ID;
   this->name = MISC_NAME;
   this->pluginId = MISC_ID;
 }
 
 template<class T> Category<T>::Category(const QString& ID,
     const QString& label)
  : id(ID), name(label)
 {
 }
 
 template<class T>
 Category<T>::Category(IConfigurationElement::Pointer configElement)
  : configurationElement(configElement) {
 
   id = configElement->GetAttribute(WorkbenchRegistryConstants::ATT_ID);
 
   if (id.isEmpty() || GetLabel().isEmpty())
   {
     throw WorkbenchException(QString("Invalid category: ") + id);
   }
 }
 
 template<class T>
 void Category<T>::AddElement(ElementType element)
 {
   elements.push_back(element);
 }
 
 template<class T>
 Object* Category<T>::GetAdapter(const QString& adapter) const
 {
   if (adapter == qobject_interface_iid<IConfigurationElement*>())
   {
     return configurationElement.GetPointer();
   }
   else
   {
     return nullptr;
   }
 }
 
 //template<class T>
 //ImageDescriptor Category<T>::GetImageDescriptor()
 //{
 //  return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
 //}
 
 template<class T>
 const QString& Category<T>::GetId() const
 {
   return id;
 }
 
 template<class T>
 QString Category<T>::GetLabel() const
 {
   if (configurationElement.IsNull())
     return name;
 
   return configurationElement->GetAttribute(WorkbenchRegistryConstants::ATT_NAME);
 }
 
 template<class T>
 QList<QString> Category<T>::GetParentPath()
 {
   if (parentPath.size() > 0)
   {
     return parentPath;
   }
 
   QString unparsedPath(this->GetRawParentPath());
-  foreach(QString token, unparsedPath.split('/', QString::SkipEmptyParts))
+  foreach(QString token, unparsedPath.split('/', Qt::SkipEmptyParts))
   {
     parentPath.push_back(token.trimmed());
   }
 
   return parentPath;
 }
 
 template<class T>
 QString Category<T>::GetRawParentPath() const
 {
   if (configurationElement.IsNull())
     return QString();
 
   return configurationElement->GetAttribute(WorkbenchRegistryConstants::ATT_PARENT_CATEGORY);
 }
 
 template<class T>
 QString Category<T>::GetRootPath()
 {
   if (this->GetParentPath().size() > 0)
   {
     return GetParentPath()[0];
   }
 
   return id;
 }
 
 template<class T>
 const QList<T>& Category<T>::GetElements() const
 {
   return elements;
 }
 
 template<class T>
 bool Category<T>::HasElement(const ElementType& o) const
 {
   if (elements.empty())
   {
     return false;
   }
 
   for (typename QList<ElementType>::const_iterator iter = elements.begin(); iter != elements.end(); ++iter)
   {
     if (*iter == o) return true;
   }
 
   return false;
 }
 
 template<class T>
 bool Category<T>::HasElements() const
 {
   return !elements.empty();
 }
 
 template<class T>
 T* Category<T>::GetParent(const ElementType& /*o*/)
 {
   return 0;
 }
 
 template<class T>
 QString Category<T>::GetLocalId() const
 {
   return id;
 }
 
 template<class T>
 QString Category<T>::GetPluginId() const
 {
   return configurationElement.IsNull() ?
         pluginId : configurationElement->GetContributor()->GetName();
 }
 
 template<class T>
 void Category<T>::Clear()
 {
   elements.clear();
 }
 
 } // namespace berry
 
 #endif // __BERRY_CATEGORY_TXX__
diff --git a/Plugins/org.blueberry.ui.qt/src/internal/berryChangeToPerspectiveMenu.cpp b/Plugins/org.blueberry.ui.qt/src/internal/berryChangeToPerspectiveMenu.cpp
index 1b04186751..f4657ee302 100644
--- a/Plugins/org.blueberry.ui.qt/src/internal/berryChangeToPerspectiveMenu.cpp
+++ b/Plugins/org.blueberry.ui.qt/src/internal/berryChangeToPerspectiveMenu.cpp
@@ -1,251 +1,251 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include "berryChangeToPerspectiveMenu.h"
 
 #include <berryMenuManager.h>
 #include <berryIWorkbenchWindow.h>
 #include <berryIWorkbenchPage.h>
 #include <berryCommandContributionItem.h>
 #include <berrySeparator.h>
 #include <berryIPluginContribution.h>
 #include <berryIPerspectiveRegistry.h>
 #include <berryIWorkbenchCommandConstants.h>
 #include <berryObjectString.h>
 #include <berryObjects.h>
 
 #include "berryCommandContributionItemParameter.h"
 #include "berryWorkbenchPlugin.h"
 #include "berryWorkbenchPreferenceConstants.h"
 #include "berryPreferenceConstants.h"
 
 #include <QMenu>
 
 #include <mitkIPreferences.h>
 
 namespace  berry {
 
 const QString ChangeToPerspectiveMenu::NO_TARGETS_MSG = "<No Applicable Perspectives>";
 
 bool PerspectiveComparator(const IPerspectiveDescriptor::Pointer& d1,
                            const IPerspectiveDescriptor::Pointer& d2)
 {
   return d1->GetLabel() < d2->GetLabel();
 }
 
 ChangeToPerspectiveMenu::ChangeToPerspectiveMenu(IWorkbenchWindow* window, const QString& id)
   : ContributionItem(id)
   , window(window)
   , reg(window->GetWorkbench()->GetPerspectiveRegistry())
   , showActive(true)
   , dirty(true)
 {
 
   CommandContributionItemParameter::Pointer showDlgItemParms(
         new CommandContributionItemParameter(
-          window, QString::null, IWorkbenchCommandConstants::PERSPECTIVES_SHOW_PERSPECTIVE,
+          window, QString(), IWorkbenchCommandConstants::PERSPECTIVES_SHOW_PERSPECTIVE,
           CommandContributionItem::STYLE_PUSH));
   showDlgItemParms->label = "&Other...";
   showDlgItem = new CommandContributionItem(showDlgItemParms);
 
   // indicate that a open perspectives submenu has been created
   /*
   if (WorkbenchWindow* window = dynamic_cast<WorkbenchWindow*>(window))
   {
     window->AddSubmenu(WorkbenchWindow::OPEN_PERSPECTIVE_SUBMENU);
   }
   */
 }
 
 void ChangeToPerspectiveMenu::Fill(QMenu* menu, QAction* before)
 {
   if (MenuManager* mm = dynamic_cast<MenuManager*>(GetParent()))
   {
     this->connect(mm, SIGNAL(AboutToShow(IMenuManager*)), SLOT(AboutToShow(IMenuManager*)));
   }
 
   if (!dirty)
   {
     return;
   }
 
   MenuManager::Pointer manager(new MenuManager(""));
   FillMenu(manager.GetPointer());
 
   QList<IContributionItem::Pointer> items = manager->GetItems();
   if (items.isEmpty())
   {
     auto   action = new QAction(NO_TARGETS_MSG, menu);
     action->setEnabled(false);
     menu->insertAction(before, action);
   }
   else
   {
     foreach (IContributionItem::Pointer item, items)
     {
       item->Fill(menu, before);
     }
   }
   dirty = false;
 }
 
 bool ChangeToPerspectiveMenu::IsDirty() const
 {
   return dirty;
 }
 
 bool ChangeToPerspectiveMenu::IsDynamic() const
 {
   return true;
 }
 
 void ChangeToPerspectiveMenu::AboutToShow(IMenuManager* manager)
 {
   manager->MarkDirty();
   dirty = true;
 }
 
 void ChangeToPerspectiveMenu::FillMenu(IMenuManager* manager)
 {
   // Clear out the manager so that we have a blank slate.
   manager->RemoveAll();
 
   // Collect and sort perspective descriptors.
   QList<IPerspectiveDescriptor::Pointer> persps = GetPerspectiveShortcuts();
   std::sort(persps.begin(), persps.end(), PerspectiveComparator);
 
   /*
    * Convert the perspective descriptors to command parameters, and filter
    * using the activity/capability mechanism.
    */
   for (const IPerspectiveDescriptor::Pointer &descriptor : qAsConst(persps))
   {
     CommandContributionItemParameter::Pointer ccip = GetItem(descriptor);
 
     //    if (WorkbenchActivityHelper.filterItem(ccip)) {
     //      continue;
     //    }
     CommandContributionItem::Pointer item(new CommandContributionItem(ccip));
     manager->Add(item);
   }
 
   auto* prefs = WorkbenchPlugin::GetDefault()->GetPreferences();
   bool showOther = prefs->GetBool(WorkbenchPreferenceConstants::SHOW_OTHER_IN_PERSPECTIVE_MENU, true);
   if (showOther)
   {
     // Add a separator and then "Other..."
     if (!manager->IsEmpty())
     {
       IContributionItem::Pointer separator(new Separator());
       manager->Add(separator);
     }
     manager->Add(showDlgItem);
   }
 }
 
 SmartPointer<CommandContributionItemParameter> ChangeToPerspectiveMenu::GetItem(const IPerspectiveDescriptor::Pointer& desc) const
 {
   auto* prefs = WorkbenchPlugin::GetDefault()->GetPreferences();
   int mode = prefs->GetInt(PreferenceConstants::OPEN_PERSP_MODE, PreferenceConstants::OPM_ACTIVE_PAGE);
   IWorkbenchPage::Pointer page = window->GetActivePage();
   IPerspectiveDescriptor::Pointer persp;
   if (page.IsNotNull())
   {
     persp = page->GetPerspective();
   }
 
   QString perspId = desc->GetId();
 
   class PluginCCIP : public CommandContributionItemParameter, public IPluginContribution
   {
     QString localId;
     QString pluginId;
 
   public:
 
     typedef PluginCCIP Self;
     static const char* GetStaticClassName() { return "PluginCCIP"; }
     berryObjectTypeInfo(CommandContributionItemParameter, IPluginContribution)
 
     PluginCCIP(const IPerspectiveDescriptor::Pointer& v, IServiceLocator* serviceLocator,
                const QString& id, const QString& commandId, CommandContributionItem::Style style)
       : CommandContributionItemParameter(serviceLocator, id, commandId, style)
     {
 
 
       PerspectiveDescriptor::Pointer vd = v.Cast<PerspectiveDescriptor>();
       localId = vd->GetLocalId();
       pluginId = vd->GetPluginId();
     }
 
     QString GetLocalId() const override
     {
       return localId;
     }
 
     QString GetPluginId() const override
     {
       return pluginId;
     }
   };
 
   CommandContributionItemParameter::Pointer parms(new PluginCCIP(desc,
       window, perspId, IWorkbenchCommandConstants::PERSPECTIVES_SHOW_PERSPECTIVE,
       CommandContributionItem::STYLE_PUSH));
   parms->label = desc->GetLabel();
   parms->icon = desc->GetImageDescriptor();
 
   Object::Pointer strId(new ObjectString(perspId));
   parms->parameters.insert(IWorkbenchCommandConstants::PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID, strId);
 
   // Only open a new window if user preference is set and the window
   // has an active perspective.
   if (PreferenceConstants::OPM_NEW_WINDOW == mode && persp.IsNotNull())
   {
     Object::Pointer bNewWnd(new ObjectBool(true));
     parms->parameters.insert(IWorkbenchCommandConstants::PERSPECTIVES_SHOW_PERSPECTIVE_PARM_NEWWINDOW,
                              bNewWnd);
   }
 
   return parms;
 }
 
 QList<SmartPointer<IPerspectiveDescriptor> > ChangeToPerspectiveMenu::GetPerspectiveShortcuts() const
 {
   QList<IPerspectiveDescriptor::Pointer> list;
 
   IWorkbenchPage::Pointer page = window->GetActivePage();
   if (page.IsNull())
   {
     return list;
   }
 
   QList<QString> ids = page->GetPerspectiveShortcuts();
   for (int i = 0; i < ids.size(); i++)
   {
     IPerspectiveDescriptor::Pointer desc = reg->FindPerspectiveWithId(ids[i]);
     if (desc.IsNotNull() && !list.contains(desc))
     {
       /*
       if (WorkbenchActivityHelper::FilterItem(desc))
       {
         continue;
       }
       */
       list.push_back(desc);
     }
   }
 
   return list;
 }
 
 }
diff --git a/Plugins/org.blueberry.ui.qt/src/internal/berryWorkbenchMenuService.cpp b/Plugins/org.blueberry.ui.qt/src/internal/berryWorkbenchMenuService.cpp
index eab4111d2f..64a04d471b 100644
--- a/Plugins/org.blueberry.ui.qt/src/internal/berryWorkbenchMenuService.cpp
+++ b/Plugins/org.blueberry.ui.qt/src/internal/berryWorkbenchMenuService.cpp
@@ -1,1059 +1,1059 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 
 #include "berryWorkbenchMenuService.h"
 
 #include <berryIPropertyChangeListener.h>
 #include <berryIServiceLocator.h>
 #include <berryIEvaluationService.h>
 #include <berryIEvaluationReference.h>
 #include <berryIEvaluationContext.h>
 #include <berrySafeRunner.h>
 #include <berryAbstractContributionFactory.h>
 #include <berryObjects.h>
 #include <berryMenuUtil.h>
 #include <berryWorkbenchActionConstants.h>
 
 #include "berryAbstractGroupMarker.h"
 #include "berryAbstractMenuAdditionCacheEntry.h"
 #include "berryAlwaysEnabledExpression.h"
 #include "berryContributionItem.h"
 #include "berryContributionRoot.h"
 #include "berryMenuManager.h"
 #include "berryWorkbenchPlugin.h"
 #include "berryWorkbenchWindow.h"
 
 #include <QUrlQuery>
 
 namespace berry {
 
 const QString WorkbenchMenuService::INDEX_AFTER_ADDITIONS_QK = "after";
 const QString WorkbenchMenuService::INDEX_AFTER_ADDITIONS_QV = "additions";
 const QString WorkbenchMenuService::PROP_VISIBLE = "visible";
 
 
 /**
  * A combined property and activity listener that updates the visibility of
  * contribution items in the new menu system.
  */
 class ContributionItemUpdater : public IPropertyChangeListener //, public IIdentifierListener
 {
 
 private:
 
   const IContributionItem::Pointer item;
   //IIdentifier identifier;
   bool lastExpressionResult;
 
   WorkbenchMenuService* wms;
 
   void UpdateVisibility()
   {
     //bool visible = identifier.IsNotNull() ? (identifier->IsEnabled() && lastExpressionResult)
     //                                      : lastExpressionResult;
     bool visible = lastExpressionResult;
     item->SetVisible(visible);
 
     IContributionManager* parent = nullptr;
     if (ContributionItem::Pointer ci = item.Cast<ContributionItem>())
     {
       parent = ci->GetParent();
     }
     else if (MenuManager::Pointer mm = item.Cast<MenuManager>())
     {
       parent = mm->GetParent();
     }
     if (parent != nullptr)
     {
       parent->MarkDirty();
       wms->managersAwaitingUpdates.insert(parent);
     }
   }
 
 public:
 
   ContributionItemUpdater(WorkbenchMenuService* wms, const IContributionItem::Pointer& item) //, IIdentifier identifier)
     : item(item), lastExpressionResult(true), wms(wms)
   {
 //    if (identifier.IsNotNull())
 //    {
 //      this->identifier = identifier;
 //      this->identifier->AddIdentifierListener(this);
 //      UpdateVisibility(); // force initial visibility to fall in line
 //      // with activity enablement
 //    }
   }
 
   /**
    * Dispose of this updater
    */
   ~ContributionItemUpdater() override
   {
 //    if (identifier.IsNotNull())
 //      identifier->RemoveIdentifierListener(this);
   }
 
   using IPropertyChangeListener::PropertyChange;
 
   /*
    * @see IPropertyChangeListener#PropertyChange(PropertyChangeEvent)
    */
   void PropertyChange(const PropertyChangeEvent::Pointer& event) override
   {
     if (event->GetProperty() == WorkbenchMenuService::PROP_VISIBLE)
     {
       if (event->GetNewValue().IsNotNull())
       {
         lastExpressionResult = event->GetNewValue();
       }
       else
       {
         lastExpressionResult = false;
       }
       UpdateVisibility();
     }
   }
 
   /*
    * @see IIdentifierListener#IdentifierChanged(IdentifierEvent)
    */
 //  void identifierChanged(IdentifierEvent identifierEvent)
 //  {
 //    UpdateVisibility();
 //  }
 
 };
 
 WorkbenchMenuService::ManagerPopulationRecord::ManagerPopulationRecord()
   : wms(nullptr), serviceLocatorToUse(nullptr), recurse(false)
 {
 }
 
 WorkbenchMenuService::ManagerPopulationRecord::
 ManagerPopulationRecord(WorkbenchMenuService* wms, IServiceLocator* serviceLocatorToUse, const QSet<SmartPointer<IEvaluationReference> >& restriction,
                         const QString& uri, bool recurse)
   : wms(wms), serviceLocatorToUse(serviceLocatorToUse), restriction(restriction),
     uri(uri), recurse(recurse)
 {
 }
 
 void WorkbenchMenuService::ManagerPopulationRecord::
 AddFactoryContribution(const SmartPointer<AbstractContributionFactory>& factory,
                        const SmartPointer<ContributionRoot>& ciList)
 {
   // Remove any existing cache info for this factory
   RemoveFactoryContribution(factory);
   // save the new info
   factoryToItems.insert(factory, ciList);
 }
 
 void WorkbenchMenuService::ManagerPopulationRecord::
 RemoveFactoryContribution(const SmartPointer<AbstractContributionFactory>& factory)
 {
   ContributionRoot::Pointer items = factoryToItems.take(factory);
   if (items.IsNotNull())
   {
     wms->ReleaseContributions(items.GetPointer());
   }
 }
 
 SmartPointer<ContributionRoot> WorkbenchMenuService::ManagerPopulationRecord::
 GetContributions(const SmartPointer<AbstractContributionFactory>& factory) const
 {
   if (factoryToItems.contains(factory))
     return factoryToItems[factory];
   return ContributionRoot::Pointer(nullptr);
 }
 
 void WorkbenchMenuService::ManagerPopulationRecord::
 ReleaseContributions()
 {
   foreach (ContributionRoot::Pointer items, factoryToItems.values())
   {
     wms->ReleaseContributions(items.GetPointer());
   }
   factoryToItems.clear();
 }
 
 WorkbenchMenuService::WorkbenchMenuService(IServiceLocator* serviceLocator)
   : evaluationService(nullptr), serviceLocator(serviceLocator)
 {
   //this.menuPersistence = new MenuPersistence(this);
   evaluationService = serviceLocator->GetService<IEvaluationService>();
   evaluationService->AddServiceListener(GetServiceListener());
 //  IWorkbenchLocationService wls = (IWorkbenchLocationService) serviceLocator
 //    .getService(IWorkbenchLocationService.class);
 //  wls.getWorkbench()
 //      .getActivitySupport().getActivityManager()
 //      .addActivityManagerListener(getActivityManagerListener());
 
 //  final IExtensionRegistry registry = Platform.getExtensionRegistry();
 //  registryChangeListener = new IRegistryChangeListener() {
 //    public void registryChanged(final IRegistryChangeEvent event) {
 //      final Display display = PlatformUI.getWorkbench().getDisplay();
 //      if (display.isDisposed()) {
 //        return;
 //      }
 //      display.syncExec(new Runnable() {
 //        public void run() {
 //          handleRegistryChanges(event);
 //        }
 //      });
 //    }
 //  };
 //  registry.addRegistryChangeListener(registryChangeListener);
 }
 
 WorkbenchMenuService::~WorkbenchMenuService()
 {
   this->Dispose();
 }
 
 void WorkbenchMenuService::Dispose()
 {
   //menuPersistence.dispose();
 //  if (registryChangeListener != null)
 //  {
 //    final IExtensionRegistry registry = Platform.getExtensionRegistry();
 //    registry.removeRegistryChangeListener(registryChangeListener);
 //    registryChangeListener = null;
 //  }
   foreach (IEvaluationReference::Pointer ref, evaluationsByItem.values())
   {
     evaluationService->RemoveEvaluationListener(ref);
   }
   evaluationsByItem.clear();
 
   managersAwaitingUpdates.clear();
   evaluationService->RemoveServiceListener(GetServiceListener());
 
 //  if (activityManagerListener != null)
 //  {
 //    IWorkbenchLocationService wls = (IWorkbenchLocationService) serviceLocator
 //        .getService(IWorkbenchLocationService.class);
 //    IWorkbench workbench = wls.getWorkbench();
 //    if (workbench != null)
 //    {
 //      workbench.getActivitySupport().getActivityManager()
 //          .removeActivityManagerListener(activityManagerListener);
 //    }
 //  }
 }
 
 void WorkbenchMenuService::AddSourceProvider(const SmartPointer<ISourceProvider>& /*provider*/)
 {
   // no-op
 }
 
 void WorkbenchMenuService::ReadRegistry()
 {
   //menuPersistence.read();
 }
 
 void WorkbenchMenuService::RemoveSourceProvider(const SmartPointer<ISourceProvider>& /*provider*/)
 {
   // no-op
 }
 
 void WorkbenchMenuService::UpdateManagers()
 {
-  QList<IContributionManager*> managers = managersAwaitingUpdates.toList();
+  QList<IContributionManager*> managers = managersAwaitingUpdates.values();
   managersAwaitingUpdates.clear();
   foreach (IContributionManager* mgr, managers)
   {
     mgr->Update(true);
 //    if (ToolBarManager* tbMgr = dynamic_cast<ToolBarManager*>(mgr))
 //    {
 //      if (!UpdateToolBar(tbMgr))
 //      {
 //        //UpdateTrim((ToolBarManager) mgr);
 //      }
 //    }
 //    else
     if (MenuManager* mMgr = dynamic_cast<MenuManager*>(mgr))
     {
       IContributionManager* parent = mMgr->GetParent();
       if (parent != nullptr)
       {
         parent->Update(true);
       }
     }
   }
 }
 
 WorkbenchMenuService::FactoryListType WorkbenchMenuService::GetAdditionsForURI(const QUrl& uri)
 {
   if (uri.isEmpty())
     return FactoryListType();
 
   return uriToFactories[GetIdFromURI(uri)];
 }
 
 void WorkbenchMenuService::AddContributionFactory(const SmartPointer<AbstractContributionFactory>& factory)
 {
   if (factory.IsNull() || factory->GetLocation().isNull())
     return;
 
   QUrl uri(factory->GetLocation());
   QString factoryId = GetIdFromURI(uri);
   FactoryListType& factories = uriToFactories[factoryId];
 
   {
 //    MenuAdditionCacheEntry::Pointer mace = factory.Cast<MenuAdditionCacheEntry>();
 //    if (mace && mace->HasAdditions())
 //    {
 //      factories.push_front(factory);
 //    }
 //    else
     {
       factories.push_back(factory);
     }
   }
 
   // OK, now update any managers that use this uri
   FactoryListType factoryList;
   factoryList.push_back(factory);
   foreach (IContributionManager* mgr, GetManagersFor(factoryId))
   {
     const ManagerPopulationRecord& mpr = populatedManagers[mgr];
     AddContributionsToManager(mpr.serviceLocatorToUse, mpr.restriction,
                               dynamic_cast<ContributionManager*>(mgr), mpr.uri, mpr.recurse, factoryList);
     mgr->Update(true);
   }
 }
 
 void WorkbenchMenuService::RemoveContributionFactory(const SmartPointer<AbstractContributionFactory>& factory)
 {
   if (factory.IsNull() || factory->GetLocation().isNull())
     return;
 
   QUrl uri(factory->GetLocation());
   QString factoryId = GetIdFromURI(uri);
   if (uriToFactories.contains(factoryId))
   {
     FactoryListType& factories = uriToFactories[factoryId];
 //    // Before we remove the top-level cache we recursively
 //    // remove any sub-caches created by this one
 //    if (MenuAdditionCacheEntry::Pointer mace = factory.Cast<MenuAdditionCacheEntry>())
 //    {
 //      QList<AbstractMenuAdditionCacheEntry::Pointer> subCaches = mace->GetSubCaches();
 //      foreach (AbstractMenuAdditionCacheEntry::Pointer amace, subCaches)
 //      {
 //        RemoveContributionFactory(amace);
 //      }
 //    }
     factories.removeAll(factory);
   }
 
   // OK, now update any managers that use this uri
   FactoryListType factoryList;
   factoryList.push_back(factory);
   foreach (IContributionManager* mgr, GetManagersFor(factoryId))
   {
     RemoveContributionsForFactory(mgr, factory);
     mgr->Update(true);
   }
 }
 
 void WorkbenchMenuService::PopulateContributionManager(ContributionManager* mgr, const QString& uri)
 {
   PopulateContributionManager(serviceLocator, QSet<SmartPointer<IEvaluationReference> >(), mgr, uri, true);
 }
 
 void WorkbenchMenuService::PopulateContributionManager(IServiceLocator* serviceLocatorToUse,
                                  const QSet<SmartPointer<IEvaluationReference> >& restriction,
                                  ContributionManager* mgr,
                                  const QString& uri, bool recurse)
 {
   // Track this attempt to populate the menu, remembering all the parameters
   if (!populatedManagers.contains(mgr))
   {
     populatedManagers.insert(mgr, ManagerPopulationRecord(this, serviceLocatorToUse,
                                                           restriction, uri, recurse));
   }
 
   QUrl contributionLocation(uri);
   FactoryListType factories = GetAdditionsForURI(contributionLocation);
   AddContributionsToManager(serviceLocatorToUse, restriction, mgr, uri, recurse, factories);
 }
 
 void WorkbenchMenuService::AddContributionsToManager(IServiceLocator* serviceLocatorToUse,
                                const QSet<SmartPointer<IEvaluationReference> >& restriction,
                                ContributionManager* mgr,
                                const QString& uri, bool recurse,
                                const QList<SmartPointer<AbstractContributionFactory> >& factories)
 {
   QUrl contributionLocation(uri);
 
   QList<AbstractContributionFactory::Pointer> retryList;
   QSet<QString> itemsAdded;
   foreach (AbstractContributionFactory::Pointer cache, factories)
   {
     if (!ProcessAdditions(serviceLocatorToUse, restriction, mgr,
                           cache, itemsAdded))
     {
       retryList.push_back(cache);
     }
   }
 
   // OK, iteratively loop through entries whose URI's could not
   // be resolved until we either run out of entries or the list
   // doesn't change size (indicating that the remaining entries
   // can never be resolved).
   bool done = retryList.isEmpty();
   while (!done)
   {
     // Clone the retry list and clear it
     QList<AbstractContributionFactory::Pointer> curRetry = retryList;
     int retryCount = retryList.size();
     retryList.clear();
 
     // Walk the current list seeing if any entries can now be resolved
     foreach (AbstractContributionFactory::Pointer cache, curRetry)
     {
       if (!ProcessAdditions(serviceLocatorToUse, restriction, mgr,
                             cache, itemsAdded))
       {
         retryList.push_back(cache);
       }
     }
 
     // We're done if the retryList is now empty (everything done) or
     // if the list hasn't changed at all (no hope)
     done = retryList.isEmpty() || (retryList.size() == retryCount);
   }
 
   // Now, recurse through any sub-menus
   foreach (IContributionItem::Pointer curItem, mgr->GetItems())
   {
     if (ContributionManager::Pointer cm = curItem.Cast<ContributionManager>())
     {
       QString id = curItem->GetId();
       if (!id.isEmpty() && (recurse || itemsAdded.contains(id)))
       {
         PopulateContributionManager(serviceLocatorToUse,
                                     restriction, cm.GetPointer(),
                                     contributionLocation.scheme() + ":" + id, true);
       }
     }
 //    else if (IToolBarContributionItem::Pointer tbci = curItem.Cast<IToolBarContributionItem>())
 //    {
 //      if (!(tbci->GetId().isEmpty()) && (recurse || itemsAdded.contains(tbci->GetId())))
 //      {
 //        PopulateContributionManager(serviceLocatorToUse,
 //                                    restriction, dynamic_cast<ContributionManager*>(tbci->GetToolBarManager()),
 //                                    contributionLocation.scheme() + ":" + tbci->GetId(), true);
 //      }
 //    }
   }
 }
 
 SmartPointer<IEvaluationContext> WorkbenchMenuService::GetCurrentState() const
 {
   return evaluationService->GetCurrentState();
 }
 
 void WorkbenchMenuService::RegisterVisibleWhen(const SmartPointer<IContributionItem>& item,
                          const SmartPointer<Expression>& visibleWhen,
                          QSet<SmartPointer<IEvaluationReference> >& /*restriction*/,
                          const QString& /*identifierID*/)
 {
   if (item.IsNull())
   {
     throw std::invalid_argument("item cannot be null");
   }
   if (visibleWhen.IsNull())
   {
     throw std::invalid_argument("visibleWhen expression cannot be null");
   }
 
   if (evaluationsByItem.contains(item))
   {
     QString id = item->GetId();
     WorkbenchPlugin::Log(QString("item is already registered: ") + (id.isEmpty() ? QString("no id") : id));
     return;
   }
 
   // TODO activity support
 //  IIdentifier identifier = null;
 //  if (identifierID != null) {
 //    identifier = PlatformUI.getWorkbench().getActivitySupport()
 //        .getActivityManager().getIdentifier(identifierID);
 //  }
 //  ContributionItemUpdater* listener =
 //      new ContributionItemUpdater(item, identifier);
 
 //  if (visibleWhen != AlwaysEnabledExpression::INSTANCE)
 //  {
 //    IEvaluationReference::Pointer ref = evaluationService->AddEvaluationListener(
 //          visibleWhen, listener, PROP_VISIBLE);
 //    restriction.insert(ref);
 //    evaluationsByItem.insert(item, ref);
 //  }
 //  activityListenersByItem.put(item, listener);
 }
 
 void WorkbenchMenuService::UnregisterVisibleWhen(const SmartPointer<IContributionItem>& item,
                                                  QSet<SmartPointer<IEvaluationReference> >& restriction)
 {
   // TODO activity support
 //  ContributionItemUpdater identifierListener = (ContributionItemUpdater) activityListenersByItem
 //      .remove(item);
 //  if (identifierListener != null) {
 //    identifierListener.dispose();
 //  }
 
   IEvaluationReference::Pointer ref = evaluationsByItem.take(item);
   if (ref.IsNull())
   {
     return;
   }
 
   evaluationService->RemoveEvaluationListener(ref);
   restriction.remove(ref);
 }
 
 void WorkbenchMenuService::ReleaseContributions(ContributionManager* mgr)
 {
   if (mgr == nullptr)
     return;
 
   // Recursively remove any contributions from sub-menus
   foreach (IContributionItem::Pointer item, mgr->GetItems())
   {
     if (ContributionManager::Pointer cm = item.Cast<ContributionManager>())
     {
       ReleaseContributions(cm.GetPointer());
     }
 //    else if (IToolBarContributionItem::Pointer tbci = item.Cast<IToolBarContributionItem>())
 //    {
 //      ReleaseContributions(tbci->GetToolBarManager());
 //    }
   }
 
   // Now remove any cached information
   if (populatedManagers.contains(mgr))
   {
     populatedManagers[mgr].ReleaseContributions();
     populatedManagers.remove(mgr);
   }
   managersAwaitingUpdates.remove(mgr);
 }
 
 //void WorkbenchMenuService::HandleDynamicAdditions(const QList<SmartPointer<IConfigurationElement> >& menuAdditions)
 //{
 //  for (Iterator additionsIter = menuAdditions.iterator(); additionsIter.hasNext();) {
 //    AbstractContributionFactory newFactory = null;
 //    final IConfigurationElement menuAddition = (IConfigurationElement) additionsIter.next();
 //    if (isProgramaticContribution(menuAddition))
 //      newFactory = new ProxyMenuAdditionCacheEntry(
 //          menuAddition
 //              .getAttribute(IWorkbenchRegistryConstants.TAG_LOCATION_URI),
 //          menuAddition.getNamespaceIdentifier(), menuAddition);
 
 //    else
 //      newFactory = new MenuAdditionCacheEntry(
 //          this,
 //          menuAddition,
 //          menuAddition
 //              .getAttribute(IWorkbenchRegistryConstants.TAG_LOCATION_URI),
 //          menuAddition.getNamespaceIdentifier());
 
 //    if (newFactory != null)
 //      addContributionFactory(newFactory);
 //  }
 //}
 
 //void WorkbenchMenuService::HandleDynamicRemovals(const QList<SmartPointer<IConfigurationElement> >& menuRemovals)
 //{
 //  for (Iterator additionsIter = menuRemovals.iterator(); additionsIter.hasNext();) {
 //    IConfigurationElement ceToRemove = (IConfigurationElement) additionsIter.next();
 //    AbstractMenuAdditionCacheEntry factoryToRemove = findFactory(ceToRemove);
 //    removeContributionFactory(factoryToRemove);
 //  }
 //}
 
 //void WorkbenchMenuService::HandleRegistryChanges(const SmartPointer<IRegistryChangeEvent>& event)
 //{
 //  // HACK!! determine if this is an addition or deletion from the first delta
 //  IExtensionDelta[] deltas = event.getExtensionDeltas();
 //  if (deltas.length == 0)
 //    return;
 //  boolean isAddition = deltas[0].getKind() == IExtensionDelta.ADDED;
 
 //  // access all the necessary service persistence handlers
 //  HandlerService handlerSvc = (HandlerService) serviceLocator.getService(IHandlerService.class);
 //  HandlerPersistence handlerPersistence = handlerSvc.getHandlerPersistence();
 
 //  CommandService cmdSvc = (CommandService) serviceLocator.getService(ICommandService.class);
 //  CommandPersistence cmdPersistence = cmdSvc.getCommandPersistence();
 
 //  BindingService bindingSvc = (BindingService) serviceLocator.getService(IBindingService.class);
 //  BindingPersistence bindingPersistence = bindingSvc.getBindingPersistence();
 
 //  boolean needsUpdate = false;
 
 //  // determine order from the type of delta
 //  if (isAddition) {
 //    // additions order: Commands, Handlers, Bindings, Menus
 //    if (cmdPersistence.commandsNeedUpdating(event)) {
 //      cmdPersistence.reRead();
 //      needsUpdate = true;
 //    }
 //    if (handlerPersistence.handlersNeedUpdating(event)) {
 //      handlerPersistence.reRead();
 //      needsUpdate = true;
 //    }
 //    if (bindingPersistence.bindingsNeedUpdating(event)) {
 //      bindingPersistence.reRead();
 //      needsUpdate = true;
 //    }
 //    if (menuPersistence.menusNeedUpdating(event)) {
 //      handleMenuChanges(event);
 //      needsUpdate = true;
 //    }
 //  }
 //  else {
 //    // Removal order: Menus, Bindings, Handlers, Commands
 //    if (menuPersistence.menusNeedUpdating(event)) {
 //      handleMenuChanges(event);
 //      needsUpdate = true;
 //    }
 //    if (bindingPersistence.bindingsNeedUpdating(event)) {
 //      bindingPersistence.reRead();
 //      needsUpdate = true;
 //    }
 //    if (handlerPersistence.handlersNeedUpdating(event)) {
 //      final IExtensionDelta[] handlerDeltas = event.getExtensionDeltas(
 //          PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_HANDLERS);
 //      for (int i = 0; i < handlerDeltas.length; i++) {
 //        IConfigurationElement[] ices = handlerDeltas[i].getExtension().getConfigurationElements();
 //        HandlerProxy.updateStaleCEs(ices);
 //      }
 
 //      handlerPersistence.reRead();
 //      needsUpdate = true;
 //    }
 //    if (cmdPersistence.commandsNeedUpdating(event)) {
 //      cmdPersistence.reRead();
 //      needsUpdate = true;
 //    }
 //  }
 
 //  if (needsUpdate) {
 //    ContributionManager[] managers = (ContributionManager[]) populatedManagers
 //        .keySet().toArray(
 //            new ContributionManager[populatedManagers.keySet()
 //                .size()]);
 //    for (int i = 0; i < managers.length; i++) {
 //      ContributionManager mgr = managers[i];
 //      mgr.update(false);
 //    }
 //  }
 //}
 
 //MenuPersistence* WorkbenchMenuService::GetMenuPersistence()
 //{
 //  return menuPersistence;
 //}
 
 void WorkbenchMenuService::PopulateContributionManager(ContributionManager* mgr,
                                  const QString& uri, bool recurse)
 {
   PopulateContributionManager(serviceLocator, QSet<IEvaluationReference::Pointer>(), mgr, uri, recurse);
 }
 
 void WorkbenchMenuService::RemoveContributionsForFactory(IContributionManager* manager,
                                                          const SmartPointer<AbstractContributionFactory>& factory)
 {
   populatedManagers[manager].RemoveFactoryContribution(factory); // automatically cleans its caches
 }
 
 void WorkbenchMenuService::ReleaseContributions(ContributionRoot* items)
 {
   ContributionManager* mgr = items->GetManager();
   foreach(IContributionItem::Pointer item, items->GetItems())
   {
     ReleaseItem(item, items->restriction);
     mgr->Remove(item);
   }
   ReleaseCache(items);
 }
 
 void WorkbenchMenuService::PropertyChange(const PropertyChangeEvent::Pointer& event)
 {
   if (event->GetProperty() == IEvaluationService::PROP_NOTIFYING)
   {
     if (!(event->GetNewValue().Cast<ObjectBool>()->GetValue()))
     {
       // if it's false, the evaluation service has
       // finished with its latest round of updates
       this->UpdateManagers();
     }
   }
 }
 
 //SmartPointer<IActivityManagerListener> WorkbenchMenuService::GetActivityManagerListener()
 //{
 //  if (activityManagerListener == null) {
 //    activityManagerListener = new IActivityManagerListener() {
 
 //      public void activityManagerChanged(
 //          ActivityManagerEvent activityManagerEvent) {
 //        if (activityManagerEvent.haveEnabledActivityIdsChanged()) {
 //          updateManagers(); // called after all identifiers have
 //          // been update - now update the
 //          // managers
 //        }
 
 //      }
 //    };
 //  }
 //  return activityManagerListener;
 //}
 
 IPropertyChangeListener* WorkbenchMenuService::GetServiceListener()
 {
   return this;
 }
 
 //void WorkbenchMenuService::UpdateTrim(ToolBarManager* mgr)
 //{
 //  Control control = mgr.getControl();
 //  if (control == null || control.isDisposed()) {
 //    return;
 //  }
 //  LayoutUtil.resize(control);
 //}
 
 bool WorkbenchMenuService::UpdateToolBar(ToolBarManager* /*mgr*/)
 {
 //  QList<IWorkbenchWindow::Pointer> windows = PlatformUI::GetWorkbench()->GetWorkbenchWindows();
 //  QList<IWorkbenchWindow::Pointer>::iterator wend = windows.end();
 //  for (QList<IWorkbenchWindow::Pointer>::iterator i = windows.begin(); i != wend; ++i)
 //  {
 //    WorkbenchWindow::Pointer window = i->Cast<WorkbenchWindow>();
 //    IToolBarManager* tb = window->GetToolBarManager();
 //    if (tb != 0)
 //    {
 //      foreach (IContributionItem::Pointer item, tb->GetItems())
 //      {
 //        if (ToolBarContributionItem::Pointer tbci = item.Cast<ToolBarContributionItem>())
 //        {
 //          IToolBarManager* tbm = tbci->GetToolBarManager();
 //          if (mgr == tbm)
 //          {
 //            tb->Update(true);
 //            return true;
 //          }
 //        }
 //      }
 //    }
 //  }
   return false;
 }
 
 QString WorkbenchMenuService::GetIdFromURI(const QUrl& uri)
 {
   return uri.scheme() + ":" + uri.path();
 }
 
 QList<IContributionManager*> WorkbenchMenuService::GetManagersFor(const QString& factoryId)
 {
   QList<IContributionManager*> mgrs;
 
   QHashIterator<IContributionManager*,ManagerPopulationRecord> mgrIter(populatedManagers);
   while(mgrIter.hasNext())
   {
     if (factoryId == mgrIter.value().uri)
     {
       mgrs.push_back(mgrIter.key());
     }
   }
 
   return mgrs;
 }
 
 bool WorkbenchMenuService::ProcessAdditions(IServiceLocator* serviceLocatorToUse,
                       const QSet<SmartPointer<IEvaluationReference> >& restriction,
                       ContributionManager* mgr,
                       const AbstractContributionFactory::Pointer& cache,
                       QSet<QString>& itemsAdded)
 {
 
   if (!ProcessFactory(mgr, cache))
     return true;
 
   const int idx = GetInsertionIndex(mgr, cache->GetLocation());
   if (idx == -1)
     return false; // can't process (yet)
 
   struct _SafeRunnable : public ISafeRunnable
   {
     WorkbenchMenuService* wms;
     int insertionIndex;
     IServiceLocator* serviceLocatorToUse;
     QSet<SmartPointer<IEvaluationReference> > restriction;
     ContributionManager* mgr;
     AbstractContributionFactory::Pointer cache;
     QSet<QString>& itemsAdded;
 
     _SafeRunnable(WorkbenchMenuService* wms, int idx, IServiceLocator* serviceLocatorToUse,
                   const QSet<SmartPointer<IEvaluationReference> >& restriction,
                   ContributionManager* mgr, AbstractContributionFactory::Pointer cache,
                   QSet<QString>& itemsAdded)
       : wms(wms), insertionIndex(idx), serviceLocatorToUse(serviceLocatorToUse),
         restriction(restriction), mgr(mgr), cache(cache), itemsAdded(itemsAdded)
     {}
 
     void HandleException(const ctkException&) override
     {}
 
     void Run() override
     {
       // Get the additions
       ContributionRoot::Pointer ciList(new ContributionRoot(wms, restriction,
                                                             mgr, cache.GetPointer()));
 
       cache->CreateContributionItems(serviceLocatorToUse, ciList);
 
       // If we have any then add them at the correct location
       if (!ciList->GetItems().isEmpty())
       {
         // Cache the items for future cleanup
         ManagerPopulationRecord& mpr = wms->populatedManagers[mgr];
         ContributionRoot::Pointer contributions = mpr.GetContributions(cache);
         if (contributions.IsNotNull())
         {
           // Existing contributions in the mgr will be released.
           // Adjust the insertionIndex
           foreach (IContributionItem::Pointer item, contributions->GetItems())
           {
             if (item == mgr->Find(item->GetId()))
               insertionIndex--;
           }
         }
 
         mpr.AddFactoryContribution(cache, ciList);
 
         foreach (IContributionItem::Pointer ici, ciList->GetItems())
         {
           if ((ici.Cast<ContributionManager>() ||
                //ici.Cast<IToolBarContributionItem> ||
                ici.Cast<AbstractGroupMarker>())
               && !(ici->GetId().isEmpty()))
           {
             IContributionItem::Pointer foundIci = mgr->Find(ici->GetId());
             // really, this is a very specific scenario that
             // allows merging but, if it is a contribution manager that also
             // contains items, then we would be throwing stuff away.
             if (ContributionManager::Pointer cm = foundIci.Cast<ContributionManager>())
             {
               if (cm->GetSize() > 0)
               {
 //                IStatus status = new Status(
 //                    IStatus.WARNING,
 //                    WorkbenchPlugin.PI_WORKBENCH,
 //                    "Menu contribution id collision: "
 //                        + ici.getId());
 //                StatusManager.getManager().handle(status);
                 BERRY_WARN << "Menu contribution id collision: " << ici->GetId().toStdString();
               }
               continue;
             }
 //            else if (IToolBarContributionItem::Pointer tbci = foundIci.Cast<IToolBarContributionItem>())
 //            {
 //              IToolBarManager* toolBarManager = tbci->GetToolBarManager();
 //              if (ContributionManager::Pointer tbcm = dynamic_cast<ContributionManager*>(toolBarManager)
 //                  && tbcm->GetSize() > 0)
 //              {
 ////                IStatus status = new Status(
 ////                    IStatus.WARNING,
 ////                    WorkbenchPlugin.PI_WORKBENCH,
 ////                    "Toolbar contribution id collision: " //$NON-NLS-1$
 ////                        + ici.getId());
 ////                StatusManager.getManager().handle(status);
 //                BERRY_WARN << "Toolbar contribution id collision: " << ici->GetId().toStdString();
 //              }
 //              continue;
 //            }
             else if (foundIci.Cast<AbstractGroupMarker>())
             {
               continue;
             }
           }
           const int oldSize = mgr->GetSize();
           mgr->Insert(insertionIndex, ici);
           if (!ici->GetId().isEmpty())
           {
             itemsAdded.insert(ici->GetId());
           }
           if (mgr->GetSize() > oldSize)
             insertionIndex++;
         }
       }
     }
   };
 
   ISafeRunnable::Pointer run (new _SafeRunnable(this, idx, serviceLocatorToUse, restriction,
                                                 mgr, cache, itemsAdded));
   SafeRunner::Run(run);
 
   return true;
 }
 
 bool WorkbenchMenuService::ProcessFactory(ContributionManager* mgr,
                                           const AbstractContributionFactory::Pointer& factory)
 {
   QUrl uri(factory->GetLocation());
   if (MenuUtil::ANY_POPUP == (uri.scheme() + ':' + uri.path()))
   {
     // its any popup. check whether manager has additions
     if (mgr->IndexOf(WorkbenchActionConstants::MB_ADDITIONS) == -1)
     {
 //      // menu has no additions. Add only if allPopups = true
 //      if (MenuAdditionCacheEntry::Pointer menuEntry = factory.Cast<MenuAdditionCacheEntry>())
 //      {
 //        return menuEntry->ContributeToAllPopups();
 //      }
     }
   }
 
   return true;
 }
 
 void WorkbenchMenuService::ReleaseCache(ContributionRoot* items)
 {
   items->Release();
 }
 
 int WorkbenchMenuService::GetInsertionIndex(ContributionManager* mgr, const QString& location)
 {
   QUrl uri(location);
   QUrlQuery query(uri);
   QList<QPair<QString,QString> > queryParts = query.queryItems();
   bool indexAfterAdditions = query.queryItemValue(INDEX_AFTER_ADDITIONS_QK) == INDEX_AFTER_ADDITIONS_QV;
   int additionsIndex = -1;
 
   // No Query means 'after=additions' (if there) or
   // the end of the menu
   if (queryParts.isEmpty() || indexAfterAdditions)
   {
     additionsIndex = mgr->IndexOf(WorkbenchActionConstants::MB_ADDITIONS);
     if (additionsIndex == -1)
       additionsIndex = mgr->GetItems().size();
     else
       ++additionsIndex;
   }
   else
   {
     // Should be in the form "[before|after|endof]=id"
     if (queryParts.size() > 0 && !(queryParts[0].second.isEmpty()))
     {
       QString modifier = queryParts[0].first;
       QString id = queryParts[0].second;
       additionsIndex = mgr->IndexOf(id);
       if (additionsIndex != -1)
       {
         if (MenuUtil::QUERY_BEFORE == modifier)
         {
           // this is OK, the additionsIndex will either be correct
           // or -1 (which is a no-op)
         }
         else if (MenuUtil::QUERY_AFTER == modifier)
         {
           additionsIndex++;
         }
         else if (MenuUtil::QUERY_ENDOF == modifier)
         {
           // OK, this one is exciting
           QList<IContributionItem::Pointer> items = mgr->GetItems();
           for (additionsIndex++; additionsIndex < items.size(); additionsIndex++)
           {
             if (items[additionsIndex]->IsGroupMarker())
             {
               break;
             }
           }
         }
       }
     }
   }
 
   return additionsIndex;
 }
 
 void WorkbenchMenuService::ReleaseItem(const SmartPointer<IContributionItem>& item, QSet<SmartPointer<IEvaluationReference> >& restriction)
 {
   UnregisterVisibleWhen(item, restriction);
   if (ContributionManager::Pointer cm = item.Cast<ContributionManager>())
   {
     ReleaseContributions(cm.GetPointer());
   }
 //  else if (IToolBarContributionItem::Pointer tbci = item.Cast<IToolBarContributionItem>())
 //  {
 //    ReleaseContributions(dynamic_cast<ContributionManager*>(tbci->GetToolBarManager()));
 //  }
 }
 
 bool WorkbenchMenuService::IsProgramaticContribution(const SmartPointer<IConfigurationElement>& menuAddition) const
 {
   return !menuAddition->GetAttribute(WorkbenchRegistryConstants::ATT_CLASS).isEmpty();
 }
 
 SmartPointer<AbstractMenuAdditionCacheEntry> WorkbenchMenuService::FindFactory(const SmartPointer<IConfigurationElement>& ceToRemove)
 {
   QUrl uri = ceToRemove->GetAttribute(WorkbenchRegistryConstants::TAG_LOCATION_URI);
   FactoryListType factories = GetAdditionsForURI(uri);
   foreach (AbstractContributionFactory::Pointer factory, GetAdditionsForURI(uri))
   {
     if (AbstractMenuAdditionCacheEntry::Pointer mace = factory.Cast<AbstractMenuAdditionCacheEntry>())
     {
       if (mace->GetConfigElement() == ceToRemove)
         return mace;
     }
   }
   return AbstractMenuAdditionCacheEntry::Pointer(nullptr);
 }
 
 //void WorkbenchMenuService::HandleMenuChanges(const SmartPointer<IRegistryChangeEvent>& event)
 //{
 //  final IExtensionDelta[] menuDeltas = event.getExtensionDeltas(
 //      PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_MENUS);
 //  final List menuAdditions = new ArrayList();
 //  final List menuRemovals = new ArrayList();
 //  for (int i = 0; i < menuDeltas.length; i++) {
 //    IConfigurationElement[] ices = menuDeltas[i].getExtension().getConfigurationElements();
 
 //    for (int j = 0; j < ices.length; j++) {
 //      if (IWorkbenchRegistryConstants.PL_MENU_CONTRIBUTION.equals(ices[j].getName())) {
 //        if (menuDeltas[i].getKind() == IExtensionDelta.ADDED)
 //          menuAdditions.add(ices[j]);
 //        else
 //          menuRemovals.add(ices[j]);
 //      }
 //    }
 //  }
 
 //  // Handle additions
 //  if (menuAdditions.size() > 0) {
 //    handleDynamicAdditions(menuAdditions);
 //  }
 
 //  // Handle Removals
 //  if (menuRemovals.size() > 0) {
 //    handleDynamicRemovals(menuRemovals);
 //  }
 //}
 
 }
diff --git a/Plugins/org.blueberry.ui.qt/src/internal/berryWorkbenchWindowConfigurer.cpp b/Plugins/org.blueberry.ui.qt/src/internal/berryWorkbenchWindowConfigurer.cpp
index f51891885b..effc5969d1 100644
--- a/Plugins/org.blueberry.ui.qt/src/internal/berryWorkbenchWindowConfigurer.cpp
+++ b/Plugins/org.blueberry.ui.qt/src/internal/berryWorkbenchWindowConfigurer.cpp
@@ -1,291 +1,291 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include "berryWorkbenchWindowConfigurer.h"
 
 #include "berryWorkbenchWindow.h"
 #include "berryWorkbench.h"
 #include "berryWorkbenchPage.h"
 #include "berryEditorSashContainer.h"
 #include "berryWorkbenchPlugin.h"
 #include "berryMenuManager.h"
 
 #include "berryQtDnDControlWidget.h"
 
 namespace berry
 {
 
 WorkbenchWindowConfigurer::WindowActionBarConfigurer::WindowActionBarConfigurer(WorkbenchWindow::WeakPtr wnd)
 : window(wnd)
 {
 
 }
 
 void WorkbenchWindowConfigurer::WindowActionBarConfigurer::SetProxy(IActionBarConfigurer::Pointer proxy)
 {
   this->proxy = proxy;
 }
 
 IWorkbenchWindowConfigurer::Pointer WorkbenchWindowConfigurer::WindowActionBarConfigurer::GetWindowConfigurer()
 {
   return WorkbenchWindow::Pointer(window)->GetWindowConfigurer();
 }
 
 IMenuManager* WorkbenchWindowConfigurer::WindowActionBarConfigurer::GetMenuManager()
 {
   if (proxy.IsNotNull())
   {
     return proxy->GetMenuManager();
   }
   return window.Lock()->GetMenuManager();
 }
 
 IToolBarManager* WorkbenchWindowConfigurer::WindowActionBarConfigurer::GetToolBarManager()
 {
   if (proxy.IsNotNull())
   {
     return proxy->GetToolBarManager();
   }
   //return window.Lock()->GetToolBarManager();
   return nullptr;
 }
 
 WorkbenchWindowConfigurer::WorkbenchWindowConfigurer(const WorkbenchWindow::Pointer& window)
- : shellStyle(nullptr)
+ : shellStyle({})
  , showPerspectiveBar(false)
  , showStatusLine(true)
  , showToolBar(true)
  , showMenuBar(true)
  , showProgressIndicator(false)
  , dropTargetListener(nullptr)
  , initialSize(1632, 918) // 85% of 1920 x 1080 (FullHD, 1080p)
 {
   if (window.IsNull())
   {
     throw Poco::InvalidArgumentException();
   }
   this->window = window;
   windowTitle = "BlueBerry Application";
 }
 
 IWorkbenchWindow::Pointer WorkbenchWindowConfigurer::GetWindow()
 {
   return IWorkbenchWindow::Pointer(window);
 }
 
 IWorkbenchConfigurer::Pointer WorkbenchWindowConfigurer::GetWorkbenchConfigurer()
 {
   return dynamic_cast<Workbench*>(PlatformUI::GetWorkbench())->GetWorkbenchConfigurer();
 }
 
 QString WorkbenchWindowConfigurer::BasicGetTitle()
 {
   return windowTitle;
 }
 
 QString WorkbenchWindowConfigurer::GetTitle()
 {
   Shell::Pointer shell = window.Lock()->GetShell();
   if (shell)
   {
     // update the cached title
     windowTitle = shell->GetText();
   }
   return windowTitle;
 }
 
 void WorkbenchWindowConfigurer::SetTitle(const QString &title)
 {
   windowTitle = title;
   Shell::Pointer shell = window.Lock()->GetShell();
   if (shell)
   {
     shell->SetText(title);
   }
 }
 
 bool WorkbenchWindowConfigurer::GetShowMenuBar() const
 {
   return showMenuBar;
 }
 
 void WorkbenchWindowConfigurer::SetShowMenuBar(bool show)
 {
   showMenuBar = show;
 //  WorkbenchWindow win = (WorkbenchWindow) getWindow();
 //  Shell shell = win.getShell();
 //  if (shell != null)
 //  {
 //    boolean showing = shell.getMenuBar() != null;
 //    if (show != showing)
 //    {
 //      if (show)
 //      {
 //        shell.setMenuBar(win.getMenuBarManager().getMenu());
 //      }
 //      else
 //      {
 //        shell.setMenuBar(null);
 //      }
 //    }
 //  }
 }
 
 bool WorkbenchWindowConfigurer::GetShowToolBar() const
 {
   return showToolBar;
 }
 
 void WorkbenchWindowConfigurer::SetShowToolBar(bool show)
 {
   showToolBar = show;
   //window.setCoolBarVisible(show);
   // @issue need to be able to reconfigure after window's controls created
 }
 
 bool WorkbenchWindowConfigurer::GetShowPerspectiveBar() const
 {
   return showPerspectiveBar;
 }
 
 void WorkbenchWindowConfigurer::SetShowPerspectiveBar(bool show)
 {
   showPerspectiveBar = show;
   //window.setPerspectiveBarVisible(show);
   // @issue need to be able to reconfigure after window's controls created
 }
 
 bool WorkbenchWindowConfigurer::GetShowStatusLine() const
 {
   return showStatusLine;
 }
 
 void WorkbenchWindowConfigurer::SetShowStatusLine(bool show)
 {
   showStatusLine = show;
   // @issue need to be able to reconfigure after window's controls created
 }
 
 bool WorkbenchWindowConfigurer::GetShowProgressIndicator() const
 {
   return showProgressIndicator;
 }
 
 void WorkbenchWindowConfigurer::SetShowProgressIndicator(bool show)
 {
   showProgressIndicator = show;
   // @issue need to be able to reconfigure after window's controls created
 }
 
 void WorkbenchWindowConfigurer::AddEditorAreaTransfer(const QStringList& transfers)
 {
   if (transfers.isEmpty()) return;
 
   int oldSize = transferTypes.size();
-  transferTypes.unite(QSet<QString>::fromList(transfers));
+  transferTypes.unite(QSet<QString>(transfers.begin(), transfers.end()));
 
   if (transferTypes.size() == oldSize) return;
 
   WorkbenchPage::Pointer page = window.Lock()->GetActivePage().Cast<WorkbenchPage>();
   if (page)
   {
     QtDnDControlWidget* dropTarget =
         static_cast<QtDnDControlWidget*>(page->GetEditorPresentation()->GetLayoutPart().Cast<EditorSashContainer>()->GetParent());
     dropTarget->SetTransferTypes(transferTypes.values());
   }
 }
 
 void WorkbenchWindowConfigurer::ConfigureEditorAreaDropListener(IDropTargetListener* listener)
 {
   if (listener == nullptr) return;
   dropTargetListener = listener;
 
   WorkbenchPage::Pointer page = window.Lock()->GetActivePage().Cast<WorkbenchPage>();
   if (page)
   {
     QtDnDControlWidget* dropTarget =
         static_cast<QtDnDControlWidget*>(page->GetEditorPresentation()->GetLayoutPart().Cast<EditorSashContainer>()->GetParent());
     dropTarget->AddDropListener(listener);
   }
 }
 
 QStringList WorkbenchWindowConfigurer::GetTransfers() const
 {
   return transferTypes.values();
 }
 
 IDropTargetListener* WorkbenchWindowConfigurer::GetDropTargetListener() const
 {
   return dropTargetListener;
 }
 
 IActionBarConfigurer::Pointer WorkbenchWindowConfigurer::GetActionBarConfigurer()
 {
   if (actionBarConfigurer.IsNull())
   {
     // lazily initialize
     actionBarConfigurer = new WindowActionBarConfigurer(window);
   }
   return actionBarConfigurer;
 }
 
 Qt::WindowFlags WorkbenchWindowConfigurer::GetWindowFlags() const
 {
   return shellStyle;
 }
 
 void WorkbenchWindowConfigurer::SetWindowFlags(Qt::WindowFlags shellStyle)
 {
   this->shellStyle = shellStyle;
 }
 
 QPoint WorkbenchWindowConfigurer::GetInitialSize() const
 {
   return initialSize;
 }
 
 void WorkbenchWindowConfigurer::SetInitialSize(QPoint size)
 {
   initialSize = size;
 }
 
 void WorkbenchWindowConfigurer::CreateDefaultContents(Shell::Pointer shell)
 {
   WorkbenchWindow::Pointer(window)->CreateDefaultContents(shell);
 }
 
 QMenuBar* WorkbenchWindowConfigurer::CreateMenuBar()
 {
   return window.Lock()->GetMenuManager()->CreateMenuBar(window.Lock()->GetShell()->GetControl());
 }
 
 QWidget* WorkbenchWindowConfigurer::CreateToolBar(QWidget* /*parent*/)
 {
 //  IToolBarManager* toolBarManager = window->GetToolBarManager();
 //  if (toolBarManager)
 //  {
 //    return toolBarManager->CreateControl(parent);
 //  }
   return nullptr;
 }
 
 QWidget *WorkbenchWindowConfigurer::CreatePageComposite(QWidget *parent)
 {
   return WorkbenchWindow::Pointer(window)->CreatePageComposite(parent);
 }
 
 bool WorkbenchWindowConfigurer::SaveState(IMemento::Pointer memento)
 {
   return WorkbenchWindow::Pointer(window)->SaveState(memento);
 }
 
 }
diff --git a/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp b/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp
index 76ec2d1e06..ec20534007 100755
--- a/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp
+++ b/Plugins/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp
@@ -1,89 +1,89 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 
 #include "QmitkStatusBar.h"
 
 #include <QMainWindow>
 #include <QScreen>
 #include <QStatusBar>
 #include <QGuiApplication>
 
 #include <mitkStatusBar.h>
 
 #include <itkObjectFactory.h>
 
 
 /**
  * Display the text in the statusbar of the application
  */
 void QmitkStatusBar::DisplayText(const char* t)
 {
   m_StatusBar->showMessage(t);
   // TODO bug #1357
   //qApp->processEvents(); // produces crashes!
 }
 
 /**
  * Display the text in the statusbar of the application for ms seconds
  */
 void QmitkStatusBar::DisplayText(const char* t, int ms)
 {
   m_StatusBar->showMessage(t, ms);
   // TODO bug #1357
   //qApp->processEvents(); // produces crashes!
 }
 /**
  * Show the grey value text in the statusbar
  */
 void QmitkStatusBar::DisplayGreyValueText(const char* t)
 {
   QString text(t);
   m_GreyValueLabel->setText(text);
 }
 /**
  * Clear the text in the StatusBar
  */
 void QmitkStatusBar::Clear()
 {
   if (m_StatusBar != nullptr)
     m_StatusBar->clearMessage();
   // TODO bug #1357
   //qApp->processEvents(); // produces crashes!
 }
 
 /**
  * enable or disable the QSizeGrip
  */
 void QmitkStatusBar::SetSizeGripEnabled(bool enable)
 {
   if (m_StatusBar != nullptr)
     m_StatusBar->setSizeGripEnabled(enable);
 }
 
 
 QmitkStatusBar::QmitkStatusBar(QStatusBar* instance)
 :StatusBarImplementation()
 {
     m_StatusBar = instance;
-    m_GreyValueLabel = new QLabel(m_StatusBar,nullptr);
+    m_GreyValueLabel = new QLabel(m_StatusBar);
     int xResolution = QGuiApplication::primaryScreen()->geometry().width()-100;
     m_GreyValueLabel->setMaximumSize(QSize(xResolution,50));
     m_GreyValueLabel->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Fixed);
     m_StatusBar->addPermanentWidget(m_GreyValueLabel);
     mitk::StatusBar::SetImplementation(this);
 }
 
 QmitkStatusBar::~QmitkStatusBar()
 {
 }