void QmitkFunctionalityCoordinator::Start()
{
  berry::PlatformUI::GetWorkbench()->AddWindowListener(berry::IWindowListener::Pointer(this));
  std::vector<berry::IWorkbenchWindow::Pointer> wnds(berry::PlatformUI::GetWorkbench()->GetWorkbenchWindows());
  for (std::vector<berry::IWorkbenchWindow::Pointer>::iterator i = wnds.begin();
       i != wnds.end(); ++i)
  {
    (*i)->GetPartService()->AddPartListener(berry::IPartListener::Pointer(this));
  }
}
void QmitkViewCoordinator::Start()
{
  berry::PlatformUI::GetWorkbench()->AddWindowListener(this);
  QList<berry::IWorkbenchWindow::Pointer> wnds(berry::PlatformUI::GetWorkbench()->GetWorkbenchWindows());
  for (QList<berry::IWorkbenchWindow::Pointer>::iterator i = wnds.begin();
       i != wnds.end(); ++i)
  {
    (*i)->GetPartService()->AddPartListener(this);
  }
}
void QmitkFunctionalityCoordinator::Stop()
{
  if (!berry::PlatformUI::IsWorkbenchRunning()) return;

  berry::PlatformUI::GetWorkbench()->RemoveWindowListener(berry::IWindowListener::Pointer(this));
  std::vector<berry::IWorkbenchWindow::Pointer> wnds(berry::PlatformUI::GetWorkbench()->GetWorkbenchWindows());
  for (std::vector<berry::IWorkbenchWindow::Pointer>::iterator i = wnds.begin();
       i != wnds.end(); ++i)
  {
    (*i)->GetPartService()->RemovePartListener(berry::IPartListener::Pointer(this));
  }
}