如何从现有工作台窗口打开新的工作台窗口(带有其自己的 WorkbenchWindowAdvisor)?
我有一个 RCP 应用程序,我需要在模式“对话框”中显示 GEF 编辑器。但由于编辑器框架似乎与工作台窗口等的使用紧密耦合,我需要找到为什么打开一个新的工作台窗口(带有它自己的 WorkbenchWindowAdvisor 等),以便我可以在这个工作台窗口中打开我的 GEF 编辑器。打开此工作台窗口后,我会将工作台窗口外壳的样式设置为应用程序模式。
I have a RCP applicaton from which I need to show a GEF Editor in a modal "dialog". But since the editor framework seems to be tightly coupled to the use of a workbench window etc I need to find a why to open a new workbench window (with its own WorkbenchWindowAdvisor etc) so that I can open my GEF editor within this workbench window. Once I get this workbenchWindow opened I will set the style of the WorkbenchWindow's shell to be application modal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在客户项目中使用以下组件完成了此操作:
openNewWindow(String type, ...)
的静态类。这是您打开新窗口时调用的方法。 type 参数指定所需的窗口类型。IWorkbench.openWorkbenchWindow(perspectiveID, ...)
ApplicationWorkbenchAdvisor.createWorkbenchWindowAdvisor(...)
中,创建一个新的 Advisor保存的ILocalWorkbenchWindowAdvisor
- 返回的顾问程序基本上将所有postWindowCreate(...)
等委托给中的相同方法ILocalWorkbenchWindowAdvisor
...ILocalWorkbenchWindowAdvisor
(这是第一个打开的窗口的情况),则会查找并使用类型“mainWindow”...它工作得很好,可以让项目的所有部分根据需要添加新窗口。
I have done this in a customer project using the following components:
openNewWindow(String type, ...)
. This is the method you call to open a new window. The type argument specifies the wanted type of window.ILocalWorkbenchWindowAdvisor
and the initial perspective ID.IWorkbench.openWorkbenchWindow(perspectiveID, ...)
ApplicationWorkbenchAdvisor.createWorkbenchWindowAdvisor(...)
a new advisor is create based on the savedILocalWorkbenchWindowAdvisor
- the returned advisor basically delegates all thepostWindowCreate(...)
, etc to the same methods inILocalWorkbenchWindowAdvisor
...ILocalWorkbenchWindowAdvisor
is saved - which is the case for the very first window to be opened - the type "mainWindow" is looked up and used...It works pretty well and let all parts of the project add new windows as needed.
使用命令“org.eclipse.ui.window.newWindow”打开一个新窗口。在 WorkbenchWindowAdvisor.preWindowOpen() 中,将 IWorkbenchWindowConfigurer 上的 shell 样式设置为应用程序模式。您还可以隐藏酷栏、菜单和状态栏,因此它看起来更像是对话框而不是窗口。
Use the command "org.eclipse.ui.window.newWindow" to open a new window. In your WorkbenchWindowAdvisor.preWindowOpen(), set the shell style on the IWorkbenchWindowConfigurer to be application modal. You can also hide the coolbar, menu and status bars, so it looks more like a dialog than a window.