使用'PlatformUI.getWorkbench()。restart()'重启Eclipse不会重启RCP产品 [英] Eclipse restart using 'PlatformUI.getWorkbench().restart()' is not restarting the RCP product

查看:521
本文介绍了使用'PlatformUI.getWorkbench()。restart()'重启Eclipse不会重启RCP产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调用方法 PlatformUI.getWorkbench()。restart()时,应用程序只是关闭并拒绝重新启动产品。

Upon invoking the method PlatformUI.getWorkbench().restart() the application is simply closing and refusing to restart the product.

推荐答案

您的 IApplication 需要检查<$ c的返回码$ c> PlatformUI.createAndRunWorkbench 在 start 方法中:

Your IApplication needs to check the return code from PlatformUI.createAndRunWorkbench in the start method:

最简单的是:

int returnCode = PlatformUI.createAndRunWorkbench(display, advisor);
if (returnCode == PlatformUI.RETURN_RESTART)
   return IApplication.EXIT_RESTART;

return IApplication.EXIT_OK;

更近期的应用似乎使用此:

More recent applications seem to use this:

private static final String SYSTEM_PROPERTY_EXIT_CODE = "eclipse.exitcode";

int returnCode = PlatformUI.createAndRunWorkbench(display, advisor);

if (returnCode == PlatformUI.RETURN_RESTART)
 {
   // eclipse.exitcode system property may be set to re-launch
   if (IApplication.EXIT_RELAUNCH.equals(Integer.getInteger(SYSTEM_PROPERTY_EXIT_CODE)))
      return IApplication.EXIT_RELAUNCH;

   return IApplication.EXIT_RESTART;
 }

return IApplication.EXIT_OK;

这篇关于使用'PlatformUI.getWorkbench()。restart()'重启Eclipse不会重启RCP产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆