Eclipse restart using 'PlatformUI.getWorkbench().restart()' is not restarting the RCP product

不想你离开。 提交于 2019-12-06 14:42:55

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

The simplest is:

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;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!