eclipse-rcpe4

Howto restart an e4 RCP application


A 3.* based RCP application will be restarted if IApplication.start returns IApplication.EXIT_RESTART. The class E4Application seems to always return EXIT_OK.

org.eclipse.ui.IWorkbench also has a restart method, org.eclipse.e4.ui.workbench.IWorkbench does not.

So how can I restart an e4 RCP application?


Solution

  • The current implementation in Eclipse 4.2 leads to a command with id org.eclipse.ui.file.restartWorkbench which ultimately leads to the handler class RestartWorkbenchHandler. This class is implemented as follows

    public Object execute(ExecutionEvent event){
    
        PlatformUI.getWorkbench().restart();
        return null;
    }
    

    Which means, that it is Eclipse 3.x dependent, as the PlatformUI class is not available in a pure Eclipse 4 based application anymore. So if you want to solve this task in your e4 Application, create a command, implement the handler and currently you will have some E3 code dependency!