diff options
3 files changed, 38 insertions, 11 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml index b2a53dbb5..0f9a4a653 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml @@ -218,7 +218,13 @@ id="org.eclipse.tcf.te.tcf.locator.startDebuggerStepGroup" iterator="org.eclipse.tcf.te.tcf.locator.iterators.StartDebuggerIterator"> <references> - <reference id="org.eclipse.tcf.te.tcf.locator.startDebuggerStep"/> + <reference + id="org.eclipse.tcf.te.tcf.locator.startDebuggerStep"> + <parameter + name="autoAttachAll" + value="true"> + </parameter> + </reference> </references> </stepGroup> </extension> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java index 891aac276..b4111c087 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java @@ -48,12 +48,10 @@ public class StartDebuggerStep extends AbstractPeerModelStep { * Called once the debugger has been attached. * * @param node The peer model node. Must not be <code>null</code>. - * @param data The data giving object. Must not be <code>null</code>. - * @param fullQualifiedId The full qualified id for this step. Must not be <code>null</code>. * @param monitor The progress monitor. Must not be <code>null</code>. * @param callback The callback to invoke if finished. Must not be <code>null</code>. */ - public void postAttachDebugger(IPeerModel node, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback); + public void postAttachDebugger(IPeerModel node, IProgressMonitor monitor, ICallback callback); } /** @@ -76,6 +74,8 @@ public class StartDebuggerStep extends AbstractPeerModelStep { public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) { final IPeerModel node = getActivePeerModelContext(context, data, fullQualifiedId); Assert.isNotNull(node); + String value = getParameters().get("autoAttachAll"); //$NON-NLS-1$ + final boolean autoAttachAll = value != null ? Boolean.parseBoolean(value) : false; if (StepperAttributeUtil.getBooleanProperty(IStepAttributes.ATTR_START_DEBUGGER, fullQualifiedId, data)) { Runnable runnable = new Runnable() { @@ -112,12 +112,16 @@ public class StartDebuggerStep extends AbstractPeerModelStep { dbgService.attach(node, props, monitor, new Callback() { @Override protected void internalDone(Object caller, IStatus status) { - // Check if there is a delegate registered - IUIService uiService = ServiceManager.getInstance().getService(node, IUIService.class, false); - IDelegate delegate = uiService != null ? uiService.getDelegate(node, IDelegate.class) : null; + if (autoAttachAll) { + // Check if there is a delegate registered + IUIService uiService = ServiceManager.getInstance().getService(node, IUIService.class, false); + IDelegate delegate = uiService != null ? uiService.getDelegate(node, IDelegate.class) : null; - if (delegate != null) { - delegate.postAttachDebugger(node, data, fullQualifiedId, monitor, callback); + if (delegate != null) { + delegate.postAttachDebugger(node, monitor, callback); + } else { + callback(data, fullQualifiedId, callback, status, null); + } } else { callback(data, fullQualifiedId, callback, status, null); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java index 3be1f4fd7..ae58ac288 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java @@ -16,7 +16,9 @@ import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; @@ -27,7 +29,9 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService; +import org.eclipse.tcf.te.runtime.services.interfaces.IUIService; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.steps.StartDebuggerStep.IDelegate; import org.eclipse.tcf.te.ui.async.UICallbackInvocationDelegate; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IWorkbenchPart; @@ -98,9 +102,22 @@ public class StartDebugCommandHandler extends AbstractHandler { IDebugService dbgService = ServiceManager.getInstance().getService(peerModel, IDebugService.class, false); if (dbgService != null) { - // Attach the debugger and all cores (OCDDevices) + final IProgressMonitor monitor = new NullProgressMonitor(); IPropertiesContainer props = new PropertiesContainer(); - dbgService.attach(peerModel, props, null, callback); + dbgService.attach(peerModel, props, monitor, new Callback() { + @Override + protected void internalDone(Object caller, IStatus status) { + // Check if there is a delegate registered + IUIService uiService = ServiceManager.getInstance().getService(peerModel, IUIService.class, false); + IDelegate delegate = uiService != null ? uiService.getDelegate(peerModel, IDelegate.class) : null; + + if (delegate != null) { + delegate.postAttachDebugger(peerModel, monitor, callback); + } else { + callback.done(caller, status); + } + } + }); } } } |