以编程方式显示 Eclipse 插件中的视图
我有一个带有视图的 Eclipse RCP 应用程序插件。 RCP 应用程序中发生事件后,插件将被实例化,调用其方法来填充插件的模型,但我无法找到如何在不进入“显示视图...”菜单的情况下显示视图。
我认为工作台单例中会有一些东西可以处理这个问题,但我还没有在任何地方找到如何处理。
I have a plug-in to an Eclipse RCP application that has a view. After an event occurs in the RCP application, the plug-in is instantiated, its methods are called to populate the plug-in's model, but I cannot find how to make the view appear without going to the "Show View..." menu.
I would think that there would be something in the workbench singleton that could handle this, but I have not found out how anywhere.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可能正在寻找这个:
You are probably looking for this:
据我所知,如果从命令的处理程序调用
会更好。
If called from handler of a command
would be better, as I know.
我发现需要在视图打开并推到后台后将其带到前面。 activate 方法就可以解决这个问题。
注意:workbenchPartToActivate 是
IWorkbenchPart
的一个实例。I found the need to bring the view to the front after it had been opened and pushed to the background. The activate method does the trick.
NOTE: The workbenchPartToActivate is an instance of
IWorkbenchPart
.在e4中,EPartService负责打开Part。 这也可用于打开 e3 ViewParts。 通过 IEclipseContext 实例化以下类,调用 openPart-Method,您应该会看到 Eclipse 内部浏览器视图。
在这里您可以找到一个示例,说明它如何与您的应用程序一起使用。 e4xmi。
In e4, the EPartService is responsible for opening Parts. This can also be used to open e3 ViewParts. Instantiate the following class through your IEclipseContext, call the openPart-Method, and you should see the Eclipse internal browser view.
Here you can find an example of how this works together with your Application.e4xmi.