Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties32
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml194
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/AbstractDebugActionDelegate.java123
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackIntoActionDelegate.java18
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackOverActionDelegate.java18
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeActionDelegate.java18
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java125
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackReturnActionDelegate.java18
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java152
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java9
10 files changed, 459 insertions, 248 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties
index d635b2bd3..3aafd31e7 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.properties
@@ -16,12 +16,28 @@ debugCallStack = Debug Call Stack
DebuggerActionSet.label = TCF Debugger
-SignalsCommand.label = Signals...
-MemoryMapCommand.label = Memory Map...
+Signals.label = Signals...
+MemoryMap.label = Memory Map...
-CastToTypeAction.label=Cast To Type...
-CastToTypeAction.tooltip=Cast Expression To Type
-RestoreDefaultTypeAction.label=Restore Original Type
-RestoreDefaultTypeAction.tooltip=Restore Original Type Of Expression
-CastToArrayAction.label=Display As Array...
-CastToArrayAction.tooltip=Display Expression As Array
+CastToType.label=Cast To Type...
+CastToType.tooltip=Cast Expression To Type
+RestoreDefaultType.label=Restore Original Type
+RestoreDefaultType.tooltip=Restore Original Type Of Expression
+CastToArray.label=Display As Array...
+CastToArray.tooltip=Display Expression As Array
+
+ReverseExecutionCategory.name=Reverse execution
+ReverseExecutionCategory.description=Reverse execution control commands
+
+BackInto.label=Back Into
+BackInto.tooltip=Back Into
+BackInto.description=Step back into
+BackOver.label=Back Over
+BackOver.tooltip=Back Over
+BackOver.description=Step back over
+BackReturn.label=Back Return
+BackReturn.tooltip=Back Return
+BackReturn.description=Run backwards until return
+BackResume.label=Run Backwards
+BackResume.tooltip=Run Backwards
+BackResume.description=Run backwards
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml
index 01beb9d2b..6c5a39225 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml
@@ -205,9 +205,9 @@
objectClass="org.eclipse.tm.internal.tcf.debug.model.TCFLaunch">
<action
id="org.eclipse.tm.tcf.debug.ui.actions.Signals"
- class="org.eclipse.tm.internal.tcf.debug.ui.commands.SignalsCommand"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.Signals"
icon="icons/signals.gif"
- label="%SignalsCommand.label"
+ label="%Signals.label"
menubarPath="additions">
</action>
</objectContribution>
@@ -218,16 +218,16 @@
objectClass="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode">
<action
id="org.eclipse.tm.tcf.debug.ui.actions.Signals"
- class="org.eclipse.tm.internal.tcf.debug.ui.commands.SignalsCommand"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.Signals"
icon="icons/signals.gif"
- label="%SignalsCommand.label"
+ label="%Signals.label"
menubarPath="additions">
</action>
<action
id="org.eclipse.tm.tcf.debug.ui.actions.MemoryMap"
- class="org.eclipse.tm.internal.tcf.debug.ui.commands.MemoryMapCommand"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.MemoryMap"
icon="icons/memory-map.gif"
- label="%MemoryMapCommand.label"
+ label="%MemoryMap.label"
menubarPath="additions">
</action>
</objectContribution>
@@ -237,10 +237,10 @@
id="org.eclipse.tm.tcf.debug.ui.CastToType"
objectClass="org.eclipse.tm.internal.tcf.debug.ui.model.ICastToType">
<action
- label="%RestoreDefaultTypeAction.label"
+ label="%RestoreDefaultType.label"
helpContextId="restore_default_type_action_context"
- tooltip="%RestoreDefaultTypeAction.tooltip"
- class="org.eclipse.tm.internal.tcf.debug.ui.commands.RestoreDefaultTypeCommand"
+ tooltip="%RestoreDefaultType.tooltip"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.RestoreDefaultType"
menubarPath="variableGroup"
enablesFor="1"
id="org.eclipse.tm.tcf.debug.ui.commands.RestoreDefaultType">
@@ -252,11 +252,11 @@
</enablement>
</action>
<action
- label="%CastToTypeAction.label"
+ label="%CastToType.label"
icon="icons/casttotype_co.gif"
helpContextId="cast_to_type_action_context"
- tooltip="%CastToTypeAction.tooltip"
- class="org.eclipse.tm.internal.tcf.debug.ui.commands.CastToTypeCommand"
+ tooltip="%CastToType.tooltip"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.CastToType"
menubarPath="variableGroup"
enablesFor="1"
id="org.eclipse.tm.tcf.debug.ui.commands.CastToType">
@@ -268,11 +268,11 @@
</enablement>
</action>
<action
- label="%CastToArrayAction.label"
+ label="%CastToArray.label"
icon="icons/showasarray_co.gif"
helpContextId="cast_to_array_action_context"
- tooltip="%CastToArrayAction.tooltip"
- class="org.eclipse.tm.internal.tcf.debug.ui.commands.CastToArrayCommand"
+ tooltip="%CastToArray.tooltip"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.CastToArray"
menubarPath="variableGroup"
enablesFor="1"
id="org.eclipse.tm.tcf.debug.ui.commands.CastToArray">
@@ -284,9 +284,173 @@
</enablement>
</action>
</objectContribution>
+
+ <!-- Reverse run control popup menu contributions -->
+ <objectContribution
+ id="org.eclipse.tm.tcf.debug.ui.TCFNode"
+ objectClass="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode">
+ <action
+ id="org.eclipse.tm.tcf.debug.ui.actions.BackInto"
+ definitionId="org.eclipse.tm.tcf.debug.ui.commands.BackInto"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.BackIntoActionDelegate"
+ icon="icons/e16/back_into.gif"
+ label="%BackInto.label"
+ menubarPath="stepIntoGroup">
+ </action>
+ <action
+ id="org.eclipse.tm.tcf.debug.ui.actions.BackOver"
+ definitionId="org.eclipse.tm.tcf.debug.ui.commands.BackOver"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.BackOverActionDelegate"
+ icon="icons/e16/back_over.gif"
+ label="%BackOver.label"
+ menubarPath="stepOverGroup">
+ </action>
+ <action
+ id="org.eclipse.tm.tcf.debug.ui.actions.BackReturn"
+ definitionId="org.eclipse.tm.tcf.debug.ui.commands.BackReturn"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.BackReturnActionDelegate"
+ icon="icons/e16/back_out.gif"
+ label="%BackReturn.label"
+ menubarPath="stepReturnGroup">
+ </action>
+ <action
+ id="org.eclipse.tm.tcf.debug.ui.actions.BackResume"
+ definitionId="org.eclipse.tm.tcf.debug.ui.commands.BackResume"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.BackResumeActionDelegate"
+ icon="icons/e16/back_run.gif"
+ label="%BackResume.label"
+ menubarPath="threadGroup">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <!-- TODO: Reverse run control UI contributions need to be placed in a shared plugin -->
+ <!-- Reverse run control actions -->
+ <extension
+ point="org.eclipse.ui.viewActions">
+ <viewContribution
+ targetID="org.eclipse.debug.ui.DebugView"
+ id="org.eclipse.tm.tcf.debug.ui.DebugView">
+ <action
+ id="org.eclipse.tm.tcf.debug.ui.actions.BackInto"
+ definitionId="org.eclipse.tm.tcf.debug.ui.commands.BackInto"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.BackIntoActionDelegate"
+ icon="icons/e16/back_into.gif"
+ disabledIcon="icons/d16/back_into.gif"
+ toolbarPath="stepIntoGroup"
+ label="%BackInto.label"
+ tooltip="%BackInto.tooltip"
+ enablesFor="+"
+ >
+ <selection
+ class="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode">
+ </selection>
+ </action>
+ <action
+ id="org.eclipse.tm.tcf.debug.ui.actions.BackOver"
+ definitionId="org.eclipse.tm.tcf.debug.ui.commands.BackOver"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.BackOverActionDelegate"
+ icon="icons/e16/back_over.gif"
+ disabledIcon="icons/d16/back_over.gif"
+ toolbarPath="stepOverGroup"
+ label="%BackOver.label"
+ tooltip="%BackOver.tooltip"
+ enablesFor="+"
+ >
+ <selection
+ class="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode">
+ </selection>
+ </action>
+ <action
+ id="org.eclipse.tm.tcf.debug.ui.actions.BackReturn"
+ definitionId="org.eclipse.tm.tcf.debug.ui.commands.BackReturn"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.BackReturnActionDelegate"
+ icon="icons/e16/back_out.gif"
+ disabledIcon="icons/d16/back_out.gif"
+ toolbarPath="stepReturnGroup"
+ label="%BackReturn.label"
+ tooltip="%BackReturn.tooltip"
+ enablesFor="+"
+ >
+ <selection
+ class="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode">
+ </selection>
+ </action>
+ <action
+ id="org.eclipse.tm.tcf.debug.ui.actions.BackResume"
+ definitionId="org.eclipse.tm.tcf.debug.ui.commands.BackResume"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.BackResumeActionDelegate"
+ icon="icons/e16/back_run.gif"
+ disabledIcon="icons/d16/back_run.gif"
+ toolbarPath="threadGroup"
+ label="%BackResume.label"
+ tooltip="%BackResume.tooltip"
+ enablesFor="+"
+ >
+ <selection
+ class="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode">
+ </selection>
+ </action>
+ </viewContribution>
</extension>
<extension
+ point="org.eclipse.ui.commands">
+ <category
+ name="%ReverseExecutionCategory.name"
+ description="%ReverseExecutionCategory.description"
+ id="org.eclipse.tm.tcf.debug.ui.ReverseExecution">
+ </category>
+ <command
+ name="%BackInto.label"
+ categoryId="org.eclipse.tm.tcf.debug.ui.ReverseExecution"
+ description="%BackInto.description"
+ id="org.eclipse.tm.tcf.debug.ui.commands.BackInto">
+ </command>
+ <command
+ name="%BackOver.label"
+ categoryId="org.eclipse.tm.tcf.debug.ui.ReverseExecution"
+ description="%BackOver.description"
+ id="org.eclipse.tm.tcf.debug.ui.commands.BackOver">
+ </command>
+ <command
+ name="%BackReturn.label"
+ categoryId="org.eclipse.tm.tcf.debug.ui.ReverseExecution"
+ description="%BackReturn.description"
+ id="org.eclipse.tm.tcf.debug.ui.commands.BackReturn">
+ </command>
+ <command
+ name="%BackResume.label"
+ categoryId="org.eclipse.tm.tcf.debug.ui.ReverseExecution"
+ description="%BackResume.description"
+ id="org.eclipse.tm.tcf.debug.ui.commands.BackResume">
+ </command>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings">
+ <key
+ sequence="M2+F5"
+ contextId="org.eclipse.debug.ui.debugging"
+ commandId="org.eclipse.tm.tcf.debug.ui.commands.BackInto"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
+ sequence="M2+F6"
+ contextId="org.eclipse.debug.ui.debugging"
+ commandId="org.eclipse.tm.tcf.debug.ui.commands.BackOver"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
+ sequence="M2+F7"
+ contextId="org.eclipse.debug.ui.debugging"
+ commandId="org.eclipse.tm.tcf.debug.ui.commands.BackReturn"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
+ sequence="M2+F8"
+ contextId="org.eclipse.debug.ui.debugging"
+ commandId="org.eclipse.tm.tcf.debug.ui.commands.BackResume"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ </extension>
+
+ <extension
point="org.eclipse.debug.ui.memoryRenderings">
<renderingBindings
defaultIds="org.eclipse.debug.ui.rendering.raw_memory"
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/AbstractDebugActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/AbstractDebugActionDelegate.java
new file mode 100644
index 000000000..717e1cdac
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/AbstractDebugActionDelegate.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.commands;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.commands.IDebugCommandHandler;
+import org.eclipse.debug.core.commands.IDebugCommandRequest;
+import org.eclipse.debug.core.commands.IEnabledStateRequest;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
+
+public abstract class AbstractDebugActionDelegate extends AbstractActionDelegate {
+
+ private final Class<?> cmd_class;
+
+ protected AbstractDebugActionDelegate(Class<?> cmd_class) {
+ this.cmd_class = cmd_class;
+ }
+
+ @Override
+ protected void selectionChanged() {
+ TCFNode n = getSelectedNode();
+ if (n == null) {
+ getAction().setEnabled(false);
+ return;
+ }
+ IDebugCommandHandler cmd = (IDebugCommandHandler)n.getAdapter(cmd_class);
+ if (cmd == null) {
+ getAction().setEnabled(false);
+ return;
+ }
+ final Object[] selection = new Object[]{ n };
+ cmd.canExecute(new IEnabledStateRequest() {
+
+ IStatus status;
+ boolean enabled = false;
+
+ public void setStatus(IStatus status) {
+ this.status = status;
+ }
+
+ public boolean isCanceled() {
+ return false;
+ }
+
+ public IStatus getStatus() {
+ return status;
+ }
+
+ public void done() {
+ getAction().setEnabled(enabled);
+ }
+
+ public void cancel() {
+ }
+
+ public Object[] getElements() {
+ return selection;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+ });
+ }
+
+ @Override
+ protected void run() {
+ TCFNode n = getSelectedNode();
+ if (n == null) return;
+ IDebugCommandHandler cmd = (IDebugCommandHandler)n.getAdapter(cmd_class);
+ if (cmd == null) return;
+ final Object[] selection = new Object[]{ n };
+ cmd.execute(new IDebugCommandRequest() {
+
+ IStatus status;
+
+ public void setStatus(IStatus status) {
+ this.status = status;
+ }
+
+ public IStatus getStatus() {
+ return status;
+ }
+
+ public void done() {
+ if (status != null && !status.isOK()) {
+ final Shell shell = getWindow().getShell();
+ shell.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
+ mb.setText("Cannot execute debugger command");
+ mb.setMessage(TCFModel.getErrorMessage(status.getException(), true));
+ mb.open();
+ }
+ });
+ }
+ }
+
+ public void cancel() {
+ }
+
+ public boolean isCanceled() {
+ return false;
+ }
+
+ public Object[] getElements() {
+ return selection;
+ }
+ });
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackIntoActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackIntoActionDelegate.java
new file mode 100644
index 000000000..1e3fe9451
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackIntoActionDelegate.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.commands;
+
+public class BackIntoActionDelegate extends AbstractDebugActionDelegate {
+
+ public BackIntoActionDelegate() {
+ super(BackIntoCommand.class);
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackOverActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackOverActionDelegate.java
new file mode 100644
index 000000000..0e42892a9
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackOverActionDelegate.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.commands;
+
+public class BackOverActionDelegate extends AbstractDebugActionDelegate {
+
+ public BackOverActionDelegate() {
+ super(BackOverCommand.class);
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeActionDelegate.java
new file mode 100644
index 000000000..0bc7bcc3f
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeActionDelegate.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.commands;
+
+public class BackResumeActionDelegate extends AbstractDebugActionDelegate{
+
+ public BackResumeActionDelegate() {
+ super(BackResumeCommand.class);
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java
index 1257bb8b2..14c397fe9 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackResumeCommand.java
@@ -1,115 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
package org.eclipse.tm.internal.tcf.debug.ui.commands;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.commands.IDebugCommandRequest;
-import org.eclipse.debug.core.commands.IEnabledStateRequest;
-import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
import org.eclipse.tm.internal.tcf.debug.ui.Activator;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFRunnable;
import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IErrorReport;
import org.eclipse.tm.tcf.protocol.IToken;
import org.eclipse.tm.tcf.services.IRunControl;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-
-public class BackResumeCommand {
- private final TCFModel model;
+public class BackResumeCommand extends StepCommand {
public BackResumeCommand(TCFModel model) {
- this.model = model;
+ super(model);
}
- public void canExecute(final IEnabledStateRequest monitor) {
- new TCFRunnable(monitor) {
- public void run() {
- if (done) return;
- Object[] elements = monitor.getElements();
- boolean res = false;
- for (int i = 0; i < elements.length; i++) {
- TCFNode node = null;
- if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i];
- else node = model.getRootNode();
- while (node != null && !node.isDisposed()) {
- IRunControl.RunControlContext ctx = null;
- if (node instanceof TCFNodeExecContext) {
- TCFDataCache<IRunControl.RunControlContext> cache = ((TCFNodeExecContext)node).getRunContext();
- if (!cache.validate(this)) return;
- ctx = cache.getData();
- }
- if (ctx == null) {
- node = node.getParent();
- }
- else if (ctx.isContainer()) {
- if (ctx.canResume(IRunControl.RM_REVERSE_RESUME)) res = true;
- break;
- }
- else {
- TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)node).getState();
- if (!state_cache.validate(this)) return;
- TCFContextState state_data = state_cache.getData();
- if (state_data != null && state_data.is_suspended && ctx.canResume(IRunControl.RM_REVERSE_RESUME)) res = true;
- break;
- }
- }
- }
- monitor.setEnabled(res);
- monitor.setStatus(Status.OK_STATUS);
- done();
- }
- };
+ @Override
+ protected boolean canExecute(IRunControl.RunControlContext ctx) {
+ if (ctx == null) return false;
+ if (ctx.canResume(IRunControl.RM_REVERSE_RESUME)) return true;
+ return false;
}
- public boolean execute(final IDebugCommandRequest monitor) {
- new TCFRunnable(monitor) {
- public void run() {
- if (done) return;
- Object[] elements = monitor.getElements();
- Set<IRunControl.RunControlContext> set = new HashSet<IRunControl.RunControlContext>();
- for (int i = 0; i < elements.length; i++) {
- TCFNode node = null;
- if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i];
- else node = model.getRootNode();
- while (node != null && !node.isDisposed()) {
- IRunControl.RunControlContext ctx = null;
- if (node instanceof TCFNodeExecContext) {
- TCFDataCache<IRunControl.RunControlContext> cache = ((TCFNodeExecContext)node).getRunContext();
- if (!cache.validate(this)) return;
- ctx = cache.getData();
- }
- if (ctx == null) {
- node = node.getParent();
- }
- else {
- set.add(ctx);
- break;
+ @Override
+ protected void execute(final IDebugCommandRequest monitor,
+ IRunControl.RunControlContext ctx, boolean src_step, final Runnable done) {
+ ctx.resume(IRunControl.RM_REVERSE_RESUME, 1, new IRunControl.DoneCommand() {
+ public void doneCommand(IToken token, Exception error) {
+ if (error != null && model.getChannel().getState() == IChannel.STATE_OPEN) {
+ if (error instanceof IErrorReport) {
+ IErrorReport r = (IErrorReport)error;
+ if (r.getErrorCode() == IErrorReport.TCF_ERROR_ALREADY_RUNNING) {
+ done.run();
+ return;
}
}
+ monitor.setStatus(new Status(IStatus.ERROR,
+ Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error));
}
- final Set<IToken> cmds = new HashSet<IToken>();
- for (Iterator<IRunControl.RunControlContext> i = set.iterator(); i.hasNext();) {
- IRunControl.RunControlContext ctx = i.next();
- cmds.add(ctx.resume(IRunControl.RM_REVERSE_RESUME, 1, new IRunControl.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- assert cmds.contains(token);
- cmds.remove(token);
- if (error != null && model.getChannel().getState() == IChannel.STATE_OPEN) {
- monitor.setStatus(new Status(IStatus.ERROR,
- Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error));
- }
- if (cmds.isEmpty()) done();
- }
- }));
- }
+ done.run();
}
- };
- return true;
+ });
}
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackReturnActionDelegate.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackReturnActionDelegate.java
new file mode 100644
index 000000000..834cfe529
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/BackReturnActionDelegate.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.commands;
+
+public class BackReturnActionDelegate extends AbstractDebugActionDelegate {
+
+ public BackReturnActionDelegate() {
+ super(BackReturnCommand.class);
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java
index 93ad2d6c8..c4bfaf791 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ResumeCommand.java
@@ -10,155 +10,49 @@
*******************************************************************************/
package org.eclipse.tm.internal.tcf.debug.ui.commands;
-import java.util.HashSet;
-import java.util.Set;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.commands.IDebugCommandRequest;
-import org.eclipse.debug.core.commands.IEnabledStateRequest;
import org.eclipse.debug.core.commands.IResumeHandler;
-import org.eclipse.tm.internal.tcf.debug.actions.TCFAction;
-import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
import org.eclipse.tm.internal.tcf.debug.ui.Activator;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFRunnable;
import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IErrorReport;
import org.eclipse.tm.tcf.protocol.IToken;
import org.eclipse.tm.tcf.services.IRunControl;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-
-
-public class ResumeCommand implements IResumeHandler {
- private static final int MAX_ACTION_CNT = 4;
- private final TCFModel model;
+public class ResumeCommand extends StepCommand implements IResumeHandler {
public ResumeCommand(TCFModel model) {
- this.model = model;
+ super(model);
}
- public void canExecute(final IEnabledStateRequest monitor) {
- new TCFRunnable(monitor) {
- public void run() {
- if (done) return;
- Object[] elements = monitor.getElements();
- boolean res = false;
- if (model.getLaunch().getContextActionsCount() < MAX_ACTION_CNT) {
- for (int i = 0; i < elements.length; i++) {
- TCFNode node = null;
- if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i];
- else node = model.getRootNode();
- while (node != null && !node.isDisposed()) {
- IRunControl.RunControlContext ctx = null;
- if (node instanceof TCFNodeExecContext) {
- TCFDataCache<IRunControl.RunControlContext> cache = ((TCFNodeExecContext)node).getRunContext();
- if (!cache.validate(this)) return;
- ctx = cache.getData();
- }
- if (ctx == null) {
- node = node.getParent();
- }
- else if (ctx.isContainer()) {
- if (ctx.canResume(IRunControl.RM_RESUME)) res = true;
- break;
- }
- else {
- TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)node).getState();
- if (!state_cache.validate(this)) return;
- TCFContextState state_data = state_cache.getData();
- if (state_data != null && state_data.is_suspended && ctx.canResume(IRunControl.RM_RESUME)) res = true;
- break;
- }
- }
- }
- }
- monitor.setEnabled(res);
- monitor.setStatus(Status.OK_STATUS);
- done();
- }
- };
+ @Override
+ protected boolean canExecute(IRunControl.RunControlContext ctx) {
+ if (ctx == null) return false;
+ if (ctx.canResume(IRunControl.RM_RESUME)) return true;
+ return false;
}
- public boolean execute(final IDebugCommandRequest monitor) {
- new TCFRunnable(monitor) {
- public void run() {
- if (done) return;
- Object[] elements = monitor.getElements();
- Set<IRunControl.RunControlContext> set = new HashSet<IRunControl.RunControlContext>();
- if (model.getLaunch().getContextActionsCount() < MAX_ACTION_CNT) {
- for (int i = 0; i < elements.length; i++) {
- TCFNode node = null;
- if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i];
- else node = model.getRootNode();
- while (node != null && !node.isDisposed()) {
- IRunControl.RunControlContext ctx = null;
- if (node instanceof TCFNodeExecContext) {
- TCFDataCache<IRunControl.RunControlContext> cache = ((TCFNodeExecContext)node).getRunContext();
- if (!cache.validate(this)) return;
- ctx = cache.getData();
- }
- if (ctx == null) {
- node = node.getParent();
- }
- else {
- set.add(ctx);
- break;
- }
+ @Override
+ protected void execute(final IDebugCommandRequest monitor,
+ IRunControl.RunControlContext ctx, boolean src_step, final Runnable done) {
+ ctx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
+ public void doneCommand(IToken token, Exception error) {
+ if (error != null && model.getChannel().getState() == IChannel.STATE_OPEN) {
+ if (error instanceof IErrorReport) {
+ IErrorReport r = (IErrorReport)error;
+ if (r.getErrorCode() == IErrorReport.TCF_ERROR_ALREADY_RUNNING) {
+ done.run();
+ return;
}
}
+ monitor.setStatus(new Status(IStatus.ERROR,
+ Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error));
}
- if (set.size() == 0) {
- monitor.setStatus(Status.OK_STATUS);
- monitor.done();
- }
- else {
- final Set<TCFAction> wait_list = new HashSet<TCFAction>();
- for (final IRunControl.RunControlContext ctx : set) {
- TCFAction done = new TCFAction(model.getLaunch()) {
- public void run() {
- TCFNodeExecContext node = (TCFNodeExecContext)model.getNode(ctx.getID());
- if (node == null || node.isDisposed()) {
- done();
- return;
- }
- TCFDataCache<TCFContextState> state = node.getState();
- if (!state.validate(this)) return;
- if (state.getData() == null || !state.getData().is_suspended) {
- Throwable error = state.getError();
- if (error != null) {
- monitor.setStatus(new Status(IStatus.ERROR,
- Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error));
- }
- done();
- return;
- }
- final TCFAction done = this;
- ctx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- if (error != null && model.getChannel().getState() == IChannel.STATE_OPEN) {
- monitor.setStatus(new Status(IStatus.ERROR,
- Activator.PLUGIN_ID, IStatus.OK, "Cannot resume: " + error.getLocalizedMessage(), error));
- }
- done.done();
- }
- });
- }
- @Override
- public void done() {
- super.done();
- wait_list.remove(this);
- if (wait_list.isEmpty()) monitor.done();
- }
- };
- wait_list.add(done);
- }
- }
+ done.run();
}
- };
- return true;
+ });
}
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java
index ce3f62064..a64cd086e 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/StepCommand.java
@@ -28,7 +28,7 @@ import org.eclipse.tm.tcf.util.TCFDataCache;
// TODO: implement Instruction Stepping Mode user action
abstract class StepCommand implements IDebugCommandHandler {
- private static final int MAX_ACTION_CNT = 8;
+ private static final int MAX_ACTION_CNT = 4;
protected final TCFModel model;
@@ -42,6 +42,8 @@ abstract class StepCommand implements IDebugCommandHandler {
IRunControl.RunControlContext ctx, boolean src_step, Runnable done);
private boolean getContextSet(Object[] elements, Set<IRunControl.RunControlContext> set, Runnable done) {
+ int action_cnt = model.getLaunch().getContextActionsCount();
+ if (action_cnt >= MAX_ACTION_CNT) return true;
for (int i = 0; i < elements.length; i++) {
TCFNode node = null;
if (elements[i] instanceof TCFNode) node = (TCFNode)elements[i];
@@ -57,14 +59,13 @@ abstract class StepCommand implements IDebugCommandHandler {
node = node.getParent();
}
else {
- int cnt = model.getLaunch().getContextActionsCount();
- if (cnt == 0) {
+ if (action_cnt == 0) {
TCFDataCache<TCFContextState> state_cache = ((TCFNodeExecContext)node).getState();
if (!state_cache.validate(done)) return false;
TCFContextState state_data = state_cache.getData();
if (state_data != null && state_data.is_suspended) set.add(ctx);
}
- else if (cnt < MAX_ACTION_CNT) {
+ else {
set.add(ctx);
}
break;

Back to the top