Eclipse RCP 通过 ID 获取元素
我还不太了解 RCP,但我已经阅读了很多文档。我不知道我的问题是否有意义;如果没有,我深表歉意,并请求您尝试理解我的意思并给出某种答案。
我有一个树视图元素,上面有一个双击侦听器。在窗口的另一部分有一个布局文件夹,其中包含应该是双击项目的检查器的视图。
我知道让另一个检查器出现的唯一方法是:
getActivePage().showView(Inspector.ID).
showView()
没有提供任何将额外信息传递给视图的机会,因此它可以知道要检查哪个元素吗?
不同方向的指针表示赞赏。沃格尔教程好像没有讲这个,或者说我没看懂。
I don't know RCP very well yet, but I've been reading a lot of the docs. I don't know if my question makes sense; I apologize if not and beg that you try to work out what I mean and come up with some kind of answer.
I have a tree view element, which has a double click listener on it. In another part of the window there is a layout folder which contains views that are supposed to be inspectors for the items double-clicked on.
The only way I know to make another inspector appear is:
getActivePage().showView(Inspector.ID).
showView()
doesn't give any opportunity to pass extra information to the view, so can it know which element to inspect?
Pointers in different directions appreciated. The Vogel tutorial doesn't seem to cover this, or I don't understand it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以检查文章是否“链接到编辑器 “可以在这里为您提供帮助。
也就是说,不要尝试访问正确的视图,而是为编辑器定义一个侦听器:
这样,您可以返回正确的编辑器,并要求该编辑器进行视图相应更新所需的一切。
You could check if the article "Link to Editor" can help you here.
That is, instead of trying to access the right view, define a Listener for the Editors:
That way, you can get back the right Editor, and ask that Editor all you need for your View to update accordingly.
您可以使用选择服务。 Inspector 视图应该注册为 SelectionListener。具有树的另一个视图应该注册一个 SelectionProvider。该视图应该侦听树中的双击,然后更新选择
You can use the SelectionService. The Inspector view should register as a SelectionListener. And the other view with the tree should register a SelectionProvider. This view should listen for the double click in the tree and then update the selection