Community
Participate
Working Groups
Build ID: I20080207-1530 It is currently not possible to pass startup parameters when restarting the workbench via PlatformUI.getWorkbench().restart(). This would be very helpful if you want to change the language of an RCP application at runtime but also for a lot of other use cases. The current workaround is to manually modify the <product>.ini file, but this works only when the application is deployed and not when launched from the Eclipse IDE.
The property eclipse.exitdata may be able to be used as a work around. I think this property is used by the workbench to restart with a different workspace by specifying another -data parameter. You could set this property before calling the restart() method.
(In reply to comment #1) > The property eclipse.exitdata may be able to be used as a work around. I think > this property is used by the workbench to restart with a different workspace by > specifying another -data parameter. You could set this property before calling > the restart() method. > Thanks Thomas, but for some unknown reason returning IApplication.EXIT_RELAUNCH in my application does actually not relaunch the application. Only EXIT_RESTART works fine, but eclipse.exitdata is only supposed to work with EXIT_RELAUNCH. Any hints?
Tom: in light of the last comment does this belong back in the Equinox bucket?
The EXIT_RELAUNCH return code works for me if I am not self-hosting from Eclipse (i.e. I deploy the application jar to an installation of eclipse and launch from there). If I launch from PDE this does not work. I suspect because PDE does not understand the relaunch exit code. See org.eclipse.ui.internal.ide.actions.OpenWorkspaceAction. This is how the workbench sets the eclipse.exitdata to relaunch with
By definition, EXIT_RESTART uses the same command line again. So I expect what this bug is really asking for is a IWorkbench.relaunch() (EXIT_RELAUNCH) method. The reason the relaunch does not work when self-hosting with PDE is that PDE has no way to get the value of the eclipse.exitdata property.
Changing language should not require a restart of the application in the first place. Is there already a bug for dynamically switching Locale? I've searched bugzilla but could not find any.
(In reply to comment #5) > By definition, EXIT_RESTART uses the same command line again. > So I expect what this bug is really asking for is a IWorkbench.relaunch() > (EXIT_RELAUNCH) method. > > The reason the relaunch does not work when self-hosting with PDE is that PDE > has no way to get the value of the eclipse.exitdata property. > But even in a deployed application EXIT_RELAUNCH with the "eclipse.exitdata" property set to "-nl <locale>" has no effect on both the splash screen and the application's locale after relaunch. But probably I did something wrong... Handler code: // locale is "de" or "en" System.getProperties().setProperty("eclipse.exitdata", "-nl " + locale); PlatformUI.getWorkbench().restart(); In my application: int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RELAUNCH; } ....
Look at OpenWorkspaceAction.buildCommandLine which builds the eclipse.exitdata for switch workspace. Arguments are separated by '\n'. Generally, the format for the exitdata should be: ${eclipse.vm}\n ${eclipse.vmargs}\n ${eclipse.commands} Those system properties contain the values for the currently running eclipse, I would suggest that you get eclipse.commands and modify it as appropriate As well, OpenWorkspaceAction.restart suggests a relaunch can be achieved with Workbench.restart by setting eclipse.exitcode to 24, this is dependent on the behaviour in IDEApplication.start
I've added bug 222706 for "dynamic change of locale" support. Has this already been considered for eclipse 4.0? Anyway, I'm adding language selection to a rcp application. The language selection will be added to a login dialog that is displayed before the workbench is started. Is it possible to avoid a restart in this scenario, e.g. by changing the osgi.nl or osgi.nl.user properties?
Even if we osgi.nl user properties as the required language, it doesn't effect on the workbench locale. So is there any current work around to set locale to workbench at runtime before this bug is fixed?
(In reply to comment #10) > Even if we osgi.nl user properties as the required language, it doesn't effect > on the workbench locale. So is there any current work around to set locale to > workbench at runtime before this bug is fixed? Are you restarting eclipse (that's the only work around AFAIK). Also, vote for bug 75320 PW