[英]Eclipse RCP: How to bring existing WorkbenchWindow to the top?
In my RCP application, I created multiple WorkbenchWindow. 在我的RCP应用程序中,我创建了多个WorkbenchWindow。 Once multiple windows are opened, I would like to bring one of them on top programmatically.
打开多个窗口后,我想以编程方式将其中一个打开。 In my code, I can find out "
theWindow
" (type of IWorkbenchWindow
) that I want to do that, but I'm not sure how to bring it to top (set it active?) 在我的代码,我可以找出“
theWindow
”(类型IWorkbenchWindow
),我想这样做,但我不知道如何把它顶部(设置活跃?)
Can you try the following : 你能尝试以下方法吗?
theWindow.getShell().setFocus();
If that doesn't work , try calling the forceFocus()
on the same shell. 如果这不起作用,请尝试在同一个shell上调用
forceFocus()
。
感谢Rambler提供forceFocus()的提示,实现这个技巧的实际功能是:
theWindow.getShell().forceActive();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.