Eclipse has 2 modes for restarting: "restart" using the previous command line, or "relaunch" using a new command line. The launcher itself will remember the previous command line, so in order to add a new system property, you will need to do the relaunch.
The restart/relaunch is part of the IApplication API, the Workbench.restart() will cause the IDEApplication to return relaunch if you set the system property eclipse.exitcode=24
.
For the relaunch, you need to put the new command line in the eclipse.exitdata
system property. You will need to reconstruct the command line using the eclipse.commands
and eclipse.vmargs
system properties, and add a -Declipse.refreshBundles=true
vm argument. For an example of this, take a look at OpenWorkspaceAction
in org.eclipse.ui.ide which uses the relaunch to switch workspaces.
Note that in the restarted eclipse, the eclipse.refreshBundles will be part of the command line, and will remain there for further restarts unless you modify the system properties. It will be gone if you exit fully and start again.