I have an RCP app which exposes the menu contribution for OpenWorkspaceAction
which launches the workspace chooser dialog. I launch it as a stand-alone app (i.e. not from the IDE), use the workspace switcher to select another workspace, and the app exits and does not restart again.
My app runs application org.eclispe.ui.ide.workbench
, which uses IDEApplication
for its IApplication
implementation. To see what's going on, I created my application with an IApplication
instance that simply extends IDEApplication
and duplicates the code from IDEApplication#start
in the subclass. I verify that when restarting after selecting a new workspace, it returns exit code EXIT_RELAUNCH
. I also verified that the system property eclipse.exitdata
is set as expected, i.e. it has the original launch args with the value of -data
replaced with the new workspace location. I also see that system property eclipse.exitcode
is set to 24. This is all done in OpenWorkspaceAction
, and I'm just verifying it before the app exits.
This seems to indicate that the launcher executable is defective. It comes from the eclipse IDE, I presume, as I selected the box to use native launcher artifacts in the product editor, and then I build the product in tycho using the tycho-p2-director
plug-in. But I tried replacing the launcher executable with the launcher from my IDE (which handles relaunch properly), and also with the launcher executable from an RCP app made by someone else, which also handles relaunch properly.
I don't know where to go from here. All the system properties are being set properly to cause the launcher to re-launch, so it really seems to be a problem with the launcher. But then replacing the launcher with one that works in other apps doesn't help. I also tried replacing the launcher and native GTK launcher plug-ins with ones from the IDE and working RCP app. Nothing I do makes it relaunch.
I modified the exit code in IDEApplication.start()
to return EXIT_RESTART
, and the app does re-start. But then it doesn't respect the exit data, because it re-starts with the same args used originally, without replacing the -data
value.
My app is based on Luna, and I tried replacing the launcher artifacts with files from from Luna as well as Mars installations. I'm running on CentOS 6.7
EDIT: to clarify what's happening, the launcher executable exits when IDEApplication
returns EXIT_RELAUNCH
from the start()
method. The launcher program is supposed to invoke the JVM again with the args found in system property eclipse.exitdata
, but it terminates execution instead. If start()
returns EXIT_RESTART
, the launcher invokes the JVM again, but with the original command arguments, without a new value for -data
, as it's designed to do when it sees that exit status. So the problem is that the launcher terminates instead of re-launching the JVM when exit status is EXIT_RELAUNCH
.