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); } }
bool DefaultSaveable::Show(IWorkbenchPage::Pointer page) { IWorkbenchPart::Pointer _part(part); IWorkbenchPartReference::Pointer reference = page->GetReference(_part); if (reference != 0) { page->Activate(_part); return true; } if (_part.Cast<IViewPart> () != 0) { IViewPart::Pointer viewPart = _part.Cast<IViewPart> (); try { page->ShowView(viewPart->GetViewSite()->GetId(), viewPart->GetViewSite()->GetSecondaryId(), IWorkbenchPage::VIEW_ACTIVATE); } catch (const PartInitException& /*e*/) { return false; } return true; } return false; }
void ShowViewHandler::OpenView(const QString& viewId, const QString& secondaryId, IWorkbenchWindow::Pointer activeWorkbenchWindow) { const IWorkbenchPage::Pointer activePage = activeWorkbenchWindow->GetActivePage(); if (activePage.IsNull()) { return; } activePage->ShowView(viewId, secondaryId, IWorkbenchPage::VIEW_ACTIVATE); }
void ShowViewHandler::OpenView(const std::string& viewId, IWorkbenchWindow::Pointer activeWorkbenchWindow) { const IWorkbenchPage::Pointer activePage = activeWorkbenchWindow->GetActivePage(); if (activePage.IsNull()) { return; } activePage->ShowView(viewId); }
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; }