Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2011-08-24 14:00:15 -0400
committereutarass2011-08-24 14:00:15 -0400
commite700f95ef3e620abe727358760aa371eefc55d8b (patch)
tree51feee991f47c5c55fb189b213ea10a8f2e8f600 /plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse
parentd7d00b7a3853e6c3a98441ba2ccb6054f9e2d742 (diff)
downloadorg.eclipse.tcf-e700f95ef3e620abe727358760aa371eefc55d8b.tar.gz
org.eclipse.tcf-e700f95ef3e620abe727358760aa371eefc55d8b.tar.xz
org.eclipse.tcf-e700f95ef3e620abe727358760aa371eefc55d8b.zip
TCF Debugger: added handling of Expressions view commands: "Disable", "Enable" and "Edit Watch Expression".
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java14
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java2
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExpressions.java2
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java257
4 files changed, 167 insertions, 108 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java
index a463a1acd..5bf8edcb7 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/WatchInExpressionsCommand.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.tm.internal.tcf.debug.ui.commands;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IExpressionManager;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -32,7 +33,7 @@ public class WatchInExpressionsCommand extends AbstractActionDelegate {
try {
IWorkbenchPage page = getWindow().getActivePage();
page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW, null, IWorkbenchPage.VIEW_ACTIVATE);
- for (final TCFNode node : getSelectedNodes()) {
+ for (final TCFNode node : getNodes()) {
final IExpressionManager manager = node.getModel().getExpressionManager();
IExpression e = new TCFTask<IExpression>(node.getChannel()) {
public void run() {
@@ -62,7 +63,16 @@ public class WatchInExpressionsCommand extends AbstractActionDelegate {
private TCFNode[] getNodes() {
TCFNode[] arr = getSelectedNodes();
for (TCFNode n : arr) {
- if (n instanceof IWatchInExpressions) continue;
+ if (n instanceof IWatchInExpressions) {
+ String script = ((IWatchInExpressions)n).getScript();
+ if (script != null) {
+ IExpressionManager m = DebugPlugin.getDefault().getExpressionManager();
+ for (final IExpression e : m.getExpressions()) {
+ if (script.equals(e.getExpressionText())) return new TCFNode[0];
+ }
+ }
+ continue;
+ }
return new TCFNode[0];
}
return arr;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java
index 9fee2ceb9..a512c749f 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IWatchInExpressions.java
@@ -14,5 +14,7 @@ import org.eclipse.tm.tcf.util.TCFDataCache;
public interface IWatchInExpressions {
+ String getScript();
+
TCFDataCache<String> getExpressionText();
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExpressions.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExpressions.java
index 3287b80ed..9d397607a 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExpressions.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExpressions.java
@@ -13,6 +13,7 @@ package org.eclipse.tm.internal.tcf.debug.ui.model;
import java.util.HashMap;
import org.eclipse.debug.core.model.IExpression;
+import org.eclipse.debug.core.model.IWatchExpression;
public class TCFChildrenExpressions extends TCFChildren {
@@ -53,6 +54,7 @@ public class TCFChildrenExpressions extends TCFChildren {
TCFNodeExpression n = findScript(text);
if (n == null) add(n = new TCFNodeExpression(node, text, null, null, -1, false));
n.setSortPosition(cnt++);
+ if (e instanceof IWatchExpression) n.setEnabled(((IWatchExpression)e).isEnabled());
data.put(n.id, n);
}
set(null, null, data);
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
index 8497d124c..84f43f402 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
@@ -17,6 +17,7 @@ import java.util.Map;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IExpressionManager;
import org.eclipse.debug.core.model.IExpression;
+import org.eclipse.debug.core.model.IWatchExpression;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor;
@@ -63,6 +64,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
private final TCFData<String> expression_text;
private final TCFChildrenSubExpressions children;
private int sort_pos;
+ private boolean enabled = true;
private IExpressions.Value prev_value;
private IExpressions.Value next_value;
@@ -565,7 +567,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
postAllChangedDelta();
}
- String getScript() {
+ public String getScript() {
return script;
}
@@ -585,6 +587,12 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
this.sort_pos = sort_pos;
}
+ void setEnabled(boolean enabled) {
+ if (this.enabled == enabled) return;
+ this.enabled = enabled;
+ postAllChangedDelta();
+ }
+
/**
* Get expression properties cache.
* The cache is empty is the expression does not represent a variable.
@@ -863,113 +871,131 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
@Override
protected boolean getData(ILabelUpdate result, Runnable done) {
- TCFDataCache<ISymbols.Symbol> field = model.getSymbolInfoCache(field_id);
- TCFDataCache<?> pending = null;
- if (field != null && !field.validate()) pending = field;
- if (!var_expression.validate()) pending = var_expression;
- if (!base_text.validate()) pending = base_text;
- if (!value.validate()) pending = value;
- if (!type.validate()) pending = type;
- if (pending != null) {
- pending.wait(done);
- return false;
- }
- String name = null;
- if (index >= 0) {
- if (index == 0 && deref) {
- name = "*";
+ if (enabled || script == null) {
+ TCFDataCache<ISymbols.Symbol> field = model.getSymbolInfoCache(field_id);
+ TCFDataCache<?> pending = null;
+ if (field != null && !field.validate()) pending = field;
+ if (!var_expression.validate()) pending = var_expression;
+ if (!base_text.validate()) pending = base_text;
+ if (!value.validate()) pending = value;
+ if (!type.validate()) pending = type;
+ if (pending != null) {
+ pending.wait(done);
+ return false;
}
- else {
- name = "[" + index + "]";
+ String name = null;
+ if (index >= 0) {
+ if (index == 0 && deref) {
+ name = "*";
+ }
+ else {
+ name = "[" + index + "]";
+ }
}
- }
- if (name == null && field != null && field.getData() != null) name = field.getData().getName();
- if (name == null && var_expression.getData() != null) {
- TCFDataCache<ISymbols.Symbol> var = model.getSymbolInfoCache(var_expression.getData().getSymbolID());
- if (var != null) {
- if (!var.validate(done)) return false;
- if (var.getData() != null) name = var.getData().getName();
+ if (name == null && field != null && field.getData() != null) name = field.getData().getName();
+ if (name == null && var_expression.getData() != null) {
+ TCFDataCache<ISymbols.Symbol> var = model.getSymbolInfoCache(var_expression.getData().getSymbolID());
+ if (var != null) {
+ if (!var.validate(done)) return false;
+ if (var.getData() != null) name = var.getData().getName();
+ }
}
- }
- if (name == null && base_text.getData() != null) name = base_text.getData();
- if (name != null) {
- String cast = model.getCastToType(id);
- if (cast != null) name = "(" + cast + ")(" + name + ")";
- }
- Throwable error = base_text.getError();
- if (error == null) error = value.getError();
- String[] cols = result.getColumnIds();
- if (error != null) {
- if (cols == null || cols.length <= 1) {
- result.setForeground(new RGB(255, 0, 0), 0);
- result.setLabel(name + ": N/A", 0);
+ if (name == null && base_text.getData() != null) name = base_text.getData();
+ if (name != null) {
+ String cast = model.getCastToType(id);
+ if (cast != null) name = "(" + cast + ")(" + name + ")";
}
- else {
- for (int i = 0; i < cols.length; i++) {
- String c = cols[i];
- if (c.equals(TCFColumnPresentationExpression.COL_NAME)) {
- result.setLabel(name, i);
+ Throwable error = base_text.getError();
+ if (error == null) error = value.getError();
+ String[] cols = result.getColumnIds();
+ if (error != null) {
+ if (cols == null || cols.length <= 1) {
+ result.setForeground(new RGB(255, 0, 0), 0);
+ result.setLabel(name + ": N/A", 0);
+ }
+ else {
+ for (int i = 0; i < cols.length; i++) {
+ String c = cols[i];
+ if (c.equals(TCFColumnPresentationExpression.COL_NAME)) {
+ result.setLabel(name, i);
+ }
+ else if (c.equals(TCFColumnPresentationExpression.COL_TYPE)) {
+ if (!type_name.validate(done)) return false;
+ result.setLabel(type_name.getData(), i);
+ }
+ else {
+ result.setForeground(new RGB(255, 0, 0), i);
+ result.setLabel("N/A", i);
+ }
}
- else if (c.equals(TCFColumnPresentationExpression.COL_TYPE)) {
- if (!type_name.validate(done)) return false;
- result.setLabel(type_name.getData(), i);
+ }
+ }
+ else {
+ if (cols == null) {
+ setLabel(result, name, 0, 16);
+ }
+ else {
+ for (int i = 0; i < cols.length; i++) {
+ String c = cols[i];
+ if (c.equals(TCFColumnPresentationExpression.COL_NAME)) {
+ result.setLabel(name, i);
+ }
+ else if (c.equals(TCFColumnPresentationExpression.COL_TYPE)) {
+ if (!type_name.validate(done)) return false;
+ result.setLabel(type_name.getData(), i);
+ }
+ else if (c.equals(TCFColumnPresentationExpression.COL_HEX_VALUE)) {
+ setLabel(result, null, i, 16);
+ }
+ else if (c.equals(TCFColumnPresentationExpression.COL_DEC_VALUE)) {
+ setLabel(result, null, i, 10);
+ }
}
- else {
- result.setForeground(new RGB(255, 0, 0), i);
- result.setLabel("N/A", i);
+ }
+ }
+ next_value = value.getData();
+ if (isValueChanged(prev_value, next_value)) {
+ RGB c = new RGB(255, 255, 0);
+ result.setBackground(c, 0);
+ if (cols != null) {
+ for (int i = 1; i < cols.length; i++) {
+ result.setBackground(c, i);
}
}
}
+ ISymbols.TypeClass type_class = ISymbols.TypeClass.unknown;
+ ISymbols.Symbol type_symbol = type.getData();
+ if (type_symbol != null) {
+ type_class = type_symbol.getTypeClass();
+ }
+ switch (type_class) {
+ case pointer:
+ result.setImageDescriptor(ImageCache.getImageDescriptor(ImageCache.IMG_VARIABLE_POINTER), 0);
+ break;
+ case composite:
+ case array:
+ result.setImageDescriptor(ImageCache.getImageDescriptor(ImageCache.IMG_VARIABLE_AGGREGATE), 0);
+ break;
+ default:
+ result.setImageDescriptor(ImageCache.getImageDescriptor(ImageCache.IMG_VARIABLE), 0);
+ }
}
else {
- if (cols == null) {
- setLabel(result, name, 0, 16);
+ String[] cols = result.getColumnIds();
+ if (cols == null || cols.length <= 1) {
+ result.setForeground(new RGB(127, 127, 127), 0);
+ result.setLabel(script, 0);
}
else {
for (int i = 0; i < cols.length; i++) {
String c = cols[i];
if (c.equals(TCFColumnPresentationExpression.COL_NAME)) {
- result.setLabel(name, i);
- }
- else if (c.equals(TCFColumnPresentationExpression.COL_TYPE)) {
- if (!type_name.validate(done)) return false;
- result.setLabel(type_name.getData(), i);
- }
- else if (c.equals(TCFColumnPresentationExpression.COL_HEX_VALUE)) {
- setLabel(result, null, i, 16);
+ result.setForeground(new RGB(127, 127, 127), i);
+ result.setLabel(script, i);
}
- else if (c.equals(TCFColumnPresentationExpression.COL_DEC_VALUE)) {
- setLabel(result, null, i, 10);
- }
- }
- }
- }
- next_value = value.getData();
- if (isValueChanged(prev_value, next_value)) {
- RGB c = new RGB(255, 255, 0);
- result.setBackground(c, 0);
- if (cols != null) {
- for (int i = 1; i < cols.length; i++) {
- result.setBackground(c, i);
}
}
}
- ISymbols.TypeClass type_class = ISymbols.TypeClass.unknown;
- ISymbols.Symbol type_symbol = type.getData();
- if (type_symbol != null) {
- type_class = type_symbol.getTypeClass();
- }
- switch (type_class) {
- case pointer:
- result.setImageDescriptor(ImageCache.getImageDescriptor(ImageCache.IMG_VARIABLE_POINTER), 0);
- break;
- case composite:
- case array:
- result.setImageDescriptor(ImageCache.getImageDescriptor(ImageCache.IMG_VARIABLE_AGGREGATE), 0);
- break;
- default:
- result.setImageDescriptor(ImageCache.getImageDescriptor(ImageCache.IMG_VARIABLE), 0);
- }
return true;
}
@@ -1214,6 +1240,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
}
public String getDetailText(Runnable done) {
+ if (!enabled) return "Disabled";
if (!expression.validate(done)) return null;
if (!value.validate(done)) return null;
StringBuffer bf = new StringBuffer();
@@ -1273,20 +1300,31 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
@Override
protected boolean getData(IChildrenCountUpdate result, Runnable done) {
- if (!children.validate(done)) return false;
- result.setChildCount(children.size());
+ if (enabled) {
+ if (!children.validate(done)) return false;
+ result.setChildCount(children.size());
+ }
+ else {
+ result.setChildCount(0);
+ }
return true;
}
@Override
protected boolean getData(IChildrenUpdate result, Runnable done) {
+ if (!enabled) return true;
return children.getData(result, done);
}
@Override
protected boolean getData(IHasChildrenUpdate result, Runnable done) {
- if (!children.validate(done)) return false;
- result.setHasChilren(children.size() > 0);
+ if (enabled) {
+ if (!children.validate(done)) return false;
+ result.setHasChilren(children.size() > 0);
+ }
+ else {
+ result.setHasChilren(false);
+ }
return true;
}
@@ -1322,17 +1360,19 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
done(node.script != null);
return;
}
- if (!node.expression.validate(this)) return;
- if (node.expression.getData() != null && node.expression.getData().expression.canAssign()) {
- if (!node.value.validate(this)) return;
- if (!node.type.validate(this)) return;
- if (TCFColumnPresentationExpression.COL_HEX_VALUE.equals(property)) {
- done(TCFNumberFormat.isValidHexNumber(node.toNumberString(16)) == null);
- return;
- }
- if (TCFColumnPresentationExpression.COL_DEC_VALUE.equals(property)) {
- done(TCFNumberFormat.isValidDecNumber(true, node.toNumberString(10)) == null);
- return;
+ if (node.enabled) {
+ if (!node.expression.validate(this)) return;
+ if (node.expression.getData() != null && node.expression.getData().expression.canAssign()) {
+ if (!node.value.validate(this)) return;
+ if (!node.type.validate(this)) return;
+ if (TCFColumnPresentationExpression.COL_HEX_VALUE.equals(property)) {
+ done(TCFNumberFormat.isValidHexNumber(node.toNumberString(16)) == null);
+ return;
+ }
+ if (TCFColumnPresentationExpression.COL_DEC_VALUE.equals(property)) {
+ done(TCFNumberFormat.isValidDecNumber(true, node.toNumberString(10)) == null);
+ return;
+ }
}
}
done(Boolean.FALSE);
@@ -1460,14 +1500,19 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
- if (adapter == IExpression.class) {
- final String script = this.script;
- if (script != null) {
+ if (script != null) {
+ if (adapter == IExpression.class) {
IExpressionManager m = DebugPlugin.getDefault().getExpressionManager();
for (final IExpression e : m.getExpressions()) {
if (script.equals(e.getExpressionText())) return e;
}
}
+ if (adapter == IWatchExpression.class) {
+ IExpressionManager m = DebugPlugin.getDefault().getExpressionManager();
+ for (final IExpression e : m.getExpressions()) {
+ if (e instanceof IWatchExpression && script.equals(e.getExpressionText())) return e;
+ }
+ }
}
return super.getAdapter(adapter);
}

Back to the top