StandaloneView 的 RCP 占位符
我对 RCP 很陌生,我想构建一个窗口,其中 TreeViewer 作为左侧的菜单和右侧的视图。 单击 TreeItem 时,当前视图应替换为新页面。 视图不得移动或关闭。
到目前为止,菜单工作正常,但我无法让视图按照我想要的方式工作。
我尝试在我的视角中使用占位符:
layout.addStandaloneViewPlaceholder("gui.page:*", IPageLayout.TOP, 0.5f, editorArea, false);
视图的 ID 均以 gui.page 开头... 当我将其中一个页面作为独立视图添加到透视图中时,它看起来就像我想要的那样。 来添加视图时
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(pageID);
但是,当我通过调用 TreeViewer 的侦听器
,页面会被选项卡化,并且可以移动和关闭。我想要的一个很好的例子是 Eclipse 的首选项对话框。我在 eclipse 源代码中搜索,但找不到他们的制作方法。
关于如何做到这一点有什么建议吗?
I'm very new to RCP and I want to build a window with a TreeViewer as a menu on the left and views on the right.
When clicking on a TreeItem the current view should be replaced with the new page.
The Views shall not be moveable or closeable.
The menu works fine so far but I can't get the views to act like I want.
I tried using a Placeholder within my perspective:
layout.addStandaloneViewPlaceholder("gui.page:*", IPageLayout.TOP, 0.5f, editorArea, false);
The IDs of the views all start with gui.page...
When I add one of the pages as standaloneView to the perspective it looks just as I want it.
But when I add a View by calling
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(pageID);
in the listener of the TreeViewer, the Pages get tabbed and are move- and closeable.
A good example of what I want to have is the preferences dialog of eclipse. I searched in the eclipse source but I couldn't find the way they made it.
Any suggestions on how to make this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
视图不会被替换。所以你必须通过调用 IWorkbenchPage.hideView() 来隐藏以前的视图
Views won't get replaced. So you have to hide the previous view by calling IWorkbenchPage.hideView()