Exemplo n.º 1
0
void WorkbenchIntroManager::CreateIntro(
    SmartPointer<IWorkbenchWindow> preferredWindow)
{
  IIntroDescriptor::Pointer descr = this->workbench->GetIntroDescriptor();
  if (!descr)
  {
    return;
  }

  IWorkbenchPage::Pointer workbenchPage = preferredWindow->GetActivePage();
  if (!workbenchPage)
  {
    return;
  }
  try
  {
    if (IntroIsView())
    {
      workbenchPage->ShowView(IntroConstants::INTRO_VIEW_ID);
    }
    else
    {
      IEditorInput::Pointer input(new NullEditorInput());
      workbenchPage->OpenEditor(input, IntroConstants::INTRO_EDITOR_ID);
    }
  } catch (PartInitException& e)
  {
    //TODO IStatus
//    WorkbenchPlugin::Log(IntroMessages.Intro_could_not_create_part, new Status(
//        IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR,
//        IntroMessages.Intro_could_not_create_part, e));
    WorkbenchPlugin::Log("Could not create intro part.", e);
  }
}
Exemplo n.º 2
0
IIntroPart::Pointer WorkbenchIntroManager::ShowIntro(SmartPointer<
    IWorkbenchWindow> preferredWindow, bool standby)
{
  if (!preferredWindow)
  {
    preferredWindow = this->workbench->GetActiveWorkbenchWindow();
  }

  if (!preferredWindow)
  {
    return IIntroPart::Pointer(nullptr);
  }

  IWorkbenchPart::Pointer part = GetIntroAdapterPart();
  if (!part)
  {
    CreateIntro(preferredWindow);
  }
  else
  {
    try
    {
      IWorkbenchPage::Pointer page = part->GetSite()->GetPage();
      IWorkbenchWindow::Pointer window = page->GetWorkbenchWindow();
      if (window != preferredWindow)
      {
        window->GetShell()->SetActive();
      }

      if (IntroIsView())
      {
        page->ShowView(IntroConstants::INTRO_VIEW_ID);
      }
      else
      {
        IEditorInput::Pointer input(new NullEditorInput());
        page->OpenEditor(input, IntroConstants::INTRO_EDITOR_ID);
      }
    } catch (PartInitException& e)
    {
      //TODO IStatus
//      WorkbenchPlugin::Log("Could not open intro", new Status(IStatus.ERROR,
//          WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "Could not open intro",
//          e)); //$NON-NLS-1$ //$NON-NLS-2$
      WorkbenchPlugin::Log("Could not open intro", e);
    }
  }
  SetIntroStandby(introPart, standby);
  return introPart;
}