Mirko Raner - 2011-08-08

It turns out that the Mwe2LaunchDelegate sets up an IDebugEventSetListener that listens for a DebugEvent.TERMINATE of the IProcess that is associated with the MWE2 launch configuration:
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.emf/org.eclipse.emf.mwe/plugins/org.eclipse.emf.mwe2.launch/src/org/eclipse/emf/mwe2/launch/shortcut/Mwe2LaunchDelegate.java?view=markup&revision=1.4&root=Modeling_Project#l26

This is a fairly custom way of triggering a refresh after the MWE2 build terminates. Most likely, waiting for the refresh job can only be achieved by specifically waiting for the job with the name "Refreshing after mwe2 launch." Additionally, it might not be deterministic whether the DebugEvent.TERMINATE used by the Mwe2LaunchDelegate is sent before or after the ILaunchesListener used by ebuilder is called. Also, as job scheduling is done asynchronously there may be a gap between the terminating the build and launching of the refresh job.
For now, it looks like the only viable solution is to make ebuilder aware of MWE2 launches (can be done by looking at the builder name/ID) and synchronize those builds by waiting for the refresh job (instead of waiting for the ILaunchesListener, which is currently done in the SynchronizedLaunch class).