Ejemplo n.º 1
0
Object::Pointer SavePerspectiveHandler::Execute(const SmartPointer<const berry::ExecutionEvent>& event)
{

  IWorkbenchWindow::Pointer activeWorkbenchWindow = HandlerUtil::GetActiveWorkbenchWindow(event);
  if (activeWorkbenchWindow.IsNotNull())
  {
    IWorkbenchPage::Pointer page = activeWorkbenchWindow->GetActivePage();
    if (page.IsNotNull())
    {
      PerspectiveDescriptor::Pointer descriptor(page->GetPerspective().Cast<PerspectiveDescriptor>());
      if (descriptor.IsNotNull())
      {
        if (descriptor->IsSingleton())
        {
          SaveSingleton(page);
        }
        else
        {
          SaveNonSingleton(page, descriptor);
        }
      }
    }
  }
  return Object::Pointer();
}
Ejemplo n.º 2
0
QVariant DescriptorTreeItem::data(int role)
{
  if (role == Qt::DisplayRole)
  {
    return m_descriptor->GetLabel();
  }
  else if (role == Qt::DecorationRole)
  {
    return m_descriptor->GetImageDescriptor();
  }
  else if (role == Qt::ForegroundRole)
  {
    IWorkbenchPage::Pointer page = this->m_model->GetWorkbenchWindow()->GetActivePage();
    if (page.IsNotNull())
    {
      if (page->FindViewReference(m_descriptor->GetId()).IsNotNull())
      {
        return QBrush(QColor(Qt::gray));
      }
    }
  }
  else if (role == ViewTreeModel::Description)
  {
    return m_descriptor->GetDescription();
  }
  else if (role == ViewTreeModel::Id)
  {
    return m_descriptor->GetId();
  }
  return ViewTreeItem::data(role);
}