使用视图动态创建 Eclipse Perspective
我可以创建一个 Eclipse 透视图并使用plugin.xml 和声明性定义向其中添加视图部分。
但是,我需要以编程方式创建一个透视图,设置其名称/标题并在拆分视图中向其添加两个视图部分(一个视图部分在左侧,另一个视图部分在右侧)。
我已经在网上搜索并阅读了大量文档,但不知道如何做到这一点。有人有这方面的小例子吗?也许知道要搜索什么?
I can create an Eclipse perspective and add viewparts to it using plugin.xml and the declarative definitions.
However, I need to programatically create a perspective, set its name/title and add two viewparts to it in a split-view (one viewpart on the left and the other on the right).
I have searched the net and read through a lot of documentation but can't figure out how to do this. Does anyone have a small example of this? Maybe knows what to search for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该通过 IPerspectiveRegistry.clonePerspective(String id, String label, IPerspectiveDescriptor desc) 创建一个新的透视图。这里原始透视图
desc
可以为 null,但我还没有找到为新透视图设置图像的方法。您可以通过
IWorkbenchPage.showView(...)
添加所需的视图,但从未弄清楚如何在透视图中布置新视图...You should be to create a new perspective via
IPerspectiveRegistry.clonePerspective(String id, String label, IPerspectiveDescriptor desc)
. Here the original perspective,desc
, can be null, but I haven't found a way to set the image for the new perspective.You can add the needed views via
IWorkbenchPage.showView(...)
, but have never figured out how to lay out the new view in the perspective...