Eclipse rcp 打开Eclipse欢迎页面,而不是“打开”;主页id“;

Eclipse rcp 打开Eclipse欢迎页面,而不是“打开”;主页id“;,eclipse-rcp,Eclipse Rcp,我有一个功能正常的EclipseRCP程序,它可以打开org.Eclipse.ui.intro扩展到root.xhtml的主页id。在root.xhtml主页内,有指向其他xhtml页面的链接,以提供帮助 我试图通过我的GUI创建按钮,当你点击它们时,它们会带你进入正确的XHTML文档页面。到目前为止,我只知道如何让按钮将我带到root.xhtml页面,但我不知道如何告诉简介页面导航到其他页面。下面是我现在用来打开简介页面的代码: help\u按钮。添加SelectionListener(新建S

我有一个功能正常的EclipseRCP程序,它可以打开org.Eclipse.ui.intro扩展到root.xhtml的主页id。在root.xhtml主页内,有指向其他xhtml页面的链接,以提供帮助

我试图通过我的GUI创建按钮,当你点击它们时,它们会带你进入正确的XHTML文档页面。到目前为止,我只知道如何让按钮将我带到root.xhtml页面,但我不知道如何告诉简介页面导航到其他页面。下面是我现在用来打开简介页面的代码:

help\u按钮。添加SelectionListener(新建SelectionAdapter()
{
公共无效widgetSelected(SelectionEvent事件)
{
ActionFactory.INTRO.create(DataStore.getInstance().getCurrentWorkbenchPage().getWorkbenchWindow()).run();
}
})

例如,我尝试这样做,引号中的超链接字符串与root.xhtml文件中的超链接完全相同:


我能够弄明白这一点,这是相当耗时和痛苦的,这样做-希望它能帮助别人。至少答案是几行代码

在更改URL之前,必须先显示intro站点getIntroSite(),否则IntroURL中将出现空指针异常。如果在调用createIntroURL()时出现空指针异常,则可能与GUI中尚未打开的介绍站点有关,而不一定是链接不正确。另外,如果简介已经打开,不要尝试重新打开它,因为它会将页面更改为主页,而不是用页面id标识的页面。因此,对于这个类,我将“帮助”按钮设置为切换按钮,这意味着如果简介窗口打开,则按下按钮。在某些情况下,如果按下按钮时介绍站点已经打开,我会关闭它(下面的示例),在其他情况下,我只是不更新介绍站点,这样它就不会进入主页(示例未显示,但只是省略if块的第一部分)

如果您尝试我问题中的ActionFactory run()代码,将在整个窗口中显示介绍站点。我希望intro站点是透视图中的一个子窗口,所以我使用下面的方法设置showIntro(null,true)-真正的意思是不占用整个窗口(他们称为布尔待机)

设置扩展点org.eclipse.ui.intro.config内容变量时,页面id对应于文档XML文件中设置的页面id

final IIntroPart intro = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). getWorkbenchWindow().getWorkbench().getIntroManager(). getIntro(); if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). getWorkbenchWindow().getWorkbench().getIntroManager(). isIntroStandby(intro)) { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). getWorkbenchWindow().getWorkbench().getIntroManager(). closeIntro(intro); help_button.setSelection(false); } else { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). getWorkbenchWindow().getWorkbench().getIntroManager(). showIntro(null, true).getIntroSite(); IIntroURL introURL = IntroURLFactory.createIntroURL( "http://org.eclipse.ui.intro/showPage?id=" + page_id); introURL.execute(); help_button.setSelection(true); }
最终进口 intro=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()。 getWorkbenchWindow().getWorkbench().getIntroManager()。 getIntro(); if(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()。 getWorkbenchWindow().getWorkbench().getIntroManager()。 isIntroStandby(简介)) { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()。 getWorkbenchWindow().getWorkbench().getIntroManager()。 closeIntro(intro); 帮助按钮。设置选择(错误); } 其他的 { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()。 getWorkbenchWindow().getWorkbench().getIntroManager()。 showIntro(null,true).getIntroSite(); 入口 introURL=IntroURLFactory.createIntroURL( "http://org.eclipse.ui.intro/showPage?id=“+页码号); introURL.execute(); 帮助按钮。设置选择(真); } final IIntroPart intro = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). getWorkbenchWindow().getWorkbench().getIntroManager(). getIntro(); if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). getWorkbenchWindow().getWorkbench().getIntroManager(). isIntroStandby(intro)) { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). getWorkbenchWindow().getWorkbench().getIntroManager(). closeIntro(intro); help_button.setSelection(false); } else { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(). getWorkbenchWindow().getWorkbench().getIntroManager(). showIntro(null, true).getIntroSite(); IIntroURL introURL = IntroURLFactory.createIntroURL( "http://org.eclipse.ui.intro/showPage?id=" + page_id); introURL.execute(); help_button.setSelection(true); }