简体   繁体   English

Eclipse RCP:如何确定是否将编辑器页面置于最前面

[英]Eclipse RCP: how to determine whether an editor page was brought to front

I have a FormEditor with a FormPage and I want to start some action when the page was brought to front (so that it is visible for the user). 我有一个带有FormPageFormEditor ,并且我想在页面显示在最前面时开始执行一些操作(以便用户可见)。

The problem is that the editor is opened in a wizard and setActive() is called before the page is visible. 问题在于,在向导中打开了编辑器,并在页面可见之前调用了setActive()

I want to start a IRunnableWithProgress when the page is visible via ModalContext.run() and display some results on the page that are created in another thread. 当页面通过ModalContext.run()可见时,我想启动IRunnableWithProgress ,并在页面上显示在另一个线程中创建的结果。 But currently this is done when the wizard is still visible. 但是当前在向导仍然可见时完成此操作。

Many thanks for help, 非常感谢您的帮助,

Michael 麦可

The first few options that comes to mind is to override setActivePage or pageChange on the FormEditor , or use addPageChangedListener . 浮现在脑海的第一个几个选项是覆盖setActivePagepageChangeFormEditor ,或使用addPageChangedListener You can always have some kind of flag to control your task if you don't want it to run every time the page becomes visible. 如果您不希望每次页面可见时都运行该任务,则始终可以使用某种标志来控制您的任务。

Another option (based on your question it sounds like you want to run this task specifically after the wizard is done), you could use Display.getDefault().asyncExec to start your task when the stack unwinds after the wizard is complete. 另一个选项(根据您的问题,听起来您想特别在向导完成后运行此任务),可以在向导完成后堆栈展开时使用Display.getDefault().asyncExec启动任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM