[英]closing wizard and run dialogs
I have a Wizard
that have one page
. 我有一个
Wizard
,其中page
。 In the performFinish
methos of wizard class, I want to close the wizard and run some dialogs of another plugin. 在向导类的
performFinish
方法中,我想关闭向导并运行另一个插件的一些对话框。
When I write the below code, It is not closed, it is just non visible. 当我编写下面的代码时,它没有关闭,只是不可见。
getShell().setVisible(false);
When I wite getShell().close()
or dialog.close()
or wizard.dispose()
the dialogs not appeared. 当我等待
getShell().close()
或dialog.close()
或wizard.dispose()
,对话框未出现。 What should I do? 我该怎么办?
The dialogs are opened in another plugin with such a below code. 对话框在另一个具有以下代码的插件中打开。
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win =wb.getActiveWorkbenchWindow();
CreateDialog UD = new CreateDialog(win.getShell());
UD.open();
If you want your wizard to close before the new dialog opens you will have to arrange for the dialog to run asynchronously. 如果要在新对话框打开之前关闭向导,则必须安排该对话框异步运行。 You can do this using
Display.asyncExec
. 您可以使用
Display.asyncExec
进行此操作。 Something like: 就像是:
@Override
public boolean performFinish()
{
... other work ...
Display.getCurrent().asyncExec(() ->
{
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win =wb.getActiveWorkbenchWindow();
CreateDialog UD = new CreateDialog(win.getShell());
UD.open();
});
return true;
}
(this is Java 8, if you are using an earlier Java use a Runnable
). (这是Java 8,如果您使用的是较早的Java,请使用
Runnable
)。
The code in the asyncExec
block will not run until after the wizard has closed. 直到向导关闭后,
asyncExec
块中的代码才会运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.