From 51eb66bb5a1ea21b4ff3f240b43043241e0e6254 Mon Sep 17 00:00:00 2001 From: Uwe Stieber Date: Tue, 1 Oct 2013 17:54:21 +0200 Subject: Target Explorer: Fix debug service returning to early --- .../launch/ui/internal/services/DebugService.java | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'target_explorer') diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java index c461a4b5b..69b91bc93 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java @@ -18,6 +18,7 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchListener; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.ILaunchesListener; import org.eclipse.debug.ui.DebugUITools; @@ -114,14 +115,34 @@ public class DebugService extends AbstractService implements IDebugService { } if (!skip) { - config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(config, launchSpec); + final ILaunchConfiguration finConfig = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(config, launchSpec); - delegate.validate(ILaunchManager.DEBUG_MODE, config); - DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); + delegate.validate(ILaunchManager.DEBUG_MODE, finConfig); + + DebugPlugin.getDefault().getLaunchManager().addLaunchListener(new ILaunchListener() { + @Override + public void launchAdded(ILaunch launch) { + if (launch != null && finConfig.equals(launch.getLaunchConfiguration())) { + DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); + callback.done(this, Status.OK_STATUS); + } + } + + @Override + public void launchChanged(ILaunch launch) { + } + + @Override + public void launchRemoved(ILaunch launch) { + } + }); + + DebugUITools.launch(finConfig, ILaunchManager.DEBUG_MODE); + } else { + callback.done(this, Status.OK_STATUS); } } } - callback.done(this, Status.OK_STATUS); } catch (Exception e) { callback.done(this, StatusHelper.getStatus(e)); -- cgit v1.2.3