Community
Participate
Working Groups
It is possible to stop the start of the application by returning false in @PostContextCreate. It is also possible to use the key e4.osgi.exit.code in the application context to set a return value if the application gets shut down normaly. Combining these features, you would expect the following to restart the application. @PostContextCreate Boolean postContextCreate(IEclipseContext context) { context.set(Constants.EXIT_CODE, IApplication.EXIT_RESTART); return false; } To solve the issue I would like to: - change E4Application so the return value is also calculated after @PostContextCreate retuns false - make the constant EXIT_CODE public API In addition to this, I would also like to make the RestartPreferenceUtil public, so that it is possible to use it like this: @PostContextCreate Boolean postContextCreate(IEclipseContext context, RestartPreferenceUtil restartPref) { restartPref.setClearPersistedStateOnRestart(true); context.set(Constants.EXIT_CODE, IApplication.EXIT_RESTART); return false; } This is similar to Bug 421153, as it adresses the same need, but has a different approach to the solution.
implementation proposal: https://git.eclipse.org/r/34096
I like the solution proposed in Bug 421153 better than this. Tom: If you agree I would mark this bug as a duplicate and abandon the changeset.
*** This bug has been marked as a duplicate of bug 421153 ***