E4Application.class有必要吗?
E4 Application.class necessary?
我现在正在迁移 Eclipse 3 应用程序,我想知道我是否还需要 Application.class。
我担心的原因是 Marc Teufel 的引述 "In the past on RCP 3.x we hooked into the Application*-Classes to popup things like login screens just before the main application came up. With e4 we don't have the Application-Classes anymore, instead there is a standard E4Application-Class which is responsible to create the Workbench Model and startup the GUI" (https://marcteufel.wordpress.com/2011/05/05/231/)
我的 Eclipse 3 Application.class 执行了 Workbench 并得到一个 RETURN 代码来决定是否重新启动,仅此而已...
int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IApplication.EXIT_RESTART;
}
return IApplication.EXIT_OK;
[...]
此行为是否包含在默认的 "org.eclipse.e4.ui.workbench.swt.E4Application"-Application Bundle 中?
我正在使用 Eclipse 4.5.1
是的,标准 E4Application 中包含类似的行为 class。您不应该使用自己的应用程序 class.
要在 e4 应用程序中重新启动,请注入 org.eclipse.e4.ui.workbench.IWorkbench
并调用 restart()
方法。请注意,这与 3.x org.eclipse.ui.IWorkbench
class(您不应使用)不同 IWorkbench
class。
我现在正在迁移 Eclipse 3 应用程序,我想知道我是否还需要 Application.class。
我担心的原因是 Marc Teufel 的引述 "In the past on RCP 3.x we hooked into the Application*-Classes to popup things like login screens just before the main application came up. With e4 we don't have the Application-Classes anymore, instead there is a standard E4Application-Class which is responsible to create the Workbench Model and startup the GUI" (https://marcteufel.wordpress.com/2011/05/05/231/)
我的 Eclipse 3 Application.class 执行了 Workbench 并得到一个 RETURN 代码来决定是否重新启动,仅此而已...
int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IApplication.EXIT_RESTART;
}
return IApplication.EXIT_OK;
[...]
此行为是否包含在默认的 "org.eclipse.e4.ui.workbench.swt.E4Application"-Application Bundle 中? 我正在使用 Eclipse 4.5.1
是的,标准 E4Application 中包含类似的行为 class。您不应该使用自己的应用程序 class.
要在 e4 应用程序中重新启动,请注入 org.eclipse.e4.ui.workbench.IWorkbench
并调用 restart()
方法。请注意,这与 3.x org.eclipse.ui.IWorkbench
class(您不应使用)不同 IWorkbench
class。