void QmitkFunctionalityCoordinator::PartClosed( berry::IWorkbenchPartReference::Pointer partRef )
{
  // check for multiwidget and inform views that it not available any more
  if ( partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID )
  {

    QmitkStdMultiWidgetEditor::Pointer stdMultiWidgetEditor = partRef->GetPart(false).Cast<QmitkStdMultiWidgetEditor>();
    for (std::set<QmitkFunctionality*>::iterator it = m_Functionalities.begin()
      ; it != m_Functionalities.end(); it++)
    {
      (*it)->StdMultiWidgetClosed(*(stdMultiWidgetEditor->GetStdMultiWidget()));
      (*it)->StdMultiWidgetNotAvailable(); // deprecated call, provided for consistence
    }
  }
  else
  {
    // check for functionality
    QmitkFunctionality::Pointer _QmitkFunctionality = partRef->GetPart(false).Cast<QmitkFunctionality>();
    if(_QmitkFunctionality.IsNotNull())
    {
      // deactivate on close ( the standalone functionality may still be activated  )
      this->DeactivateStandaloneFunctionality(partRef.GetPointer(), 0);

      // and set pointer to 0
      if(m_StandaloneFuntionality == partRef.GetPointer())
        m_StandaloneFuntionality = 0;

      m_Functionalities.erase(_QmitkFunctionality.GetPointer()); // remove as opened functionality

      // call PartClosed on the QmitkFunctionality
      _QmitkFunctionality->ClosePartProxy();
      //m_VisibleStandaloneFunctionalities.erase(_QmitkFunctionality.GetPointer()); // remove if necessary (should be done before in PartHidden()
    }
  }
}
 void PerspectiveChanged(const berry::IWorkbenchPage::Pointer&,
                         const berry::IPerspectiveDescriptor::Pointer&,
                         const berry::IWorkbenchPartReference::Pointer& partRef, const std::string& changeId)
 {
     if (changeId=="viewHide" && partRef->GetId()=="org.mitk.views.viewnavigatorview")
         berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->RemovePerspectiveListener(parentWidget->m_PerspectiveListener.data());
     else
         parentWidget->UpdateTreeList(nullptr, partRef.GetPointer(), changeId);
 }
void QmitkFunctionalityCoordinator::PartHidden( berry::IWorkbenchPartReference::Pointer partRef )
{
  // Check for QmitkFunctionality
  QmitkFunctionality::Pointer _QmitkFunctionality = partRef->GetPart(false).Cast<QmitkFunctionality>();
  if(_QmitkFunctionality != 0)
  {
    _QmitkFunctionality->SetVisible(false);
    _QmitkFunctionality->Hidden();

    // tracking of Visible Standalone Functionalities
    m_VisibleStandaloneFunctionalities.erase(partRef.GetPointer());

    // activate Functionality if just one Standalone Functionality is visible
    if( m_VisibleStandaloneFunctionalities.size() == 1 )
      this->ActivateStandaloneFunctionality( *m_VisibleStandaloneFunctionalities.begin() );
  }
}
void QmitkFunctionalityCoordinator::PartVisible( berry::IWorkbenchPartReference::Pointer partRef )
{
  // Check for QmitkFunctionality
  QmitkFunctionality::Pointer _QmitkFunctionality = partRef->GetPart(false).Cast<QmitkFunctionality>();
  if(_QmitkFunctionality.IsNotNull())
  {
    _QmitkFunctionality->SetVisible(true);
    _QmitkFunctionality->Visible();

    // tracking of Visible Standalone Functionalities
    if( _QmitkFunctionality->IsExclusiveFunctionality() )
    {
      m_VisibleStandaloneFunctionalities.insert(partRef.GetPointer());

      // activate Functionality if just one Standalone Functionality is visible
      if( m_VisibleStandaloneFunctionalities.size() == 1 )
        this->ActivateStandaloneFunctionality( *m_VisibleStandaloneFunctionalities.begin() );
    }
  }
}
void QmitkFunctionalityCoordinator::PartActivated( berry::IWorkbenchPartReference::Pointer partRef )
{
  // change the active standalone functionality
  this->ActivateStandaloneFunctionality(partRef.GetPointer());
}