Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2016-11-28 21:47:11 +0000
committerEugene Tarassov2016-11-28 21:47:11 +0000
commit60e137e671216c642d97bcb6968b6d7a369a89e1 (patch)
tree4e484a3e62ce489da90162dfa2a13b08aecf5378 /plugins
parentd9a9936a3e4e97add6daccb915b3c3b14a8186f4 (diff)
downloadorg.eclipse.tcf-60e137e671216c642d97bcb6968b6d7a369a89e1.tar.gz
org.eclipse.tcf-60e137e671216c642d97bcb6968b6d7a369a89e1.tar.xz
org.eclipse.tcf-60e137e671216c642d97bcb6968b6d7a369a89e1.zip
Fixed race condition in ICellModifier implementation in the Expressions view
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenExpressions.java16
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenHoverExpressions.java4
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLocalVariables.java4
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLogExpressions.java4
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenSubExpressions.java10
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java63
6 files changed, 39 insertions, 62 deletions
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenExpressions.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenExpressions.java
index 303d5b24e..1bd6a85fa 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenExpressions.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenExpressions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2008, 2016 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
@@ -37,12 +37,10 @@ public class TCFChildrenExpressions extends TCFChildren {
for (TCFNode n : getNodes()) ((TCFNodeExpression)n).onMemoryMapChanged();
}
- private TCFNodeExpression findScript(String text, IExpression e) {
+ private TCFNodeExpression findScript(IExpression e) {
for (TCFNode n : getNodes()) {
TCFNodeExpression node = (TCFNodeExpression)n;
- if (text.equals(node.getScript()) &&
- (node.getPlatformExpression() == null || node.getPlatformExpression().equals(e)) )
- {
+ if (e == node.getPlatformExpression() && e.getExpressionText().equals(node.getScript())) {
return node;
}
}
@@ -62,16 +60,14 @@ public class TCFChildrenExpressions extends TCFChildren {
int cnt = 0;
HashMap<String,TCFNode> data = new HashMap<String,TCFNode>();
for (final IExpression e : node.model.getExpressionManager().getExpressions()) {
- String text = e.getExpressionText();
- TCFNodeExpression n = findScript(text, e);
- if (n == null) add(n = new TCFNodeExpression(node, text, null, null, null, -1, false));
- n.setPlatformExpression(e);
+ TCFNodeExpression n = findScript(e);
+ if (n == null) add(n = new TCFNodeExpression(node, null, e, null, null, null, -1, false));
n.setSortPosition(cnt++);
if (e instanceof IWatchExpression) n.setEnabled(((IWatchExpression)e).isEnabled());
data.put(n.id, n);
}
TCFNodeExpression n = findEmpty();
- if (n == null) add(n = new TCFNodeExpression(node, null, null, null, null, -1, false));
+ if (n == null) add(n = new TCFNodeExpression(node, null, null, null, null, null, -1, false));
n.setSortPosition(cnt++);
data.put(n.id, n);
set(null, null, data);
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenHoverExpressions.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenHoverExpressions.java
index 3f3bdd8b8..f5156ca34 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenHoverExpressions.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenHoverExpressions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 2016 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
@@ -60,7 +60,7 @@ class TCFChildrenHoverExpressions extends TCFChildren {
if (expression != null) {
TCFNodeExpression expression_node = findScript(expression);
if (expression_node == null) {
- add(expression_node = new TCFNodeExpression(node, expression, null, null, null, -1, false));
+ add(expression_node = new TCFNodeExpression(node, expression, null, null, null, null, -1, false));
}
data.put(expression_node.id, expression_node);
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLocalVariables.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLocalVariables.java
index 03eccd093..dc48b63d8 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLocalVariables.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLocalVariables.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2008, 2016 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
@@ -65,7 +65,7 @@ public class TCFChildrenLocalVariables extends TCFChildren {
data = new HashMap<String,TCFNode>();
for (String id : contexts) {
TCFNodeExpression n = (TCFNodeExpression)node.model.getNode(id);
- if (n == null) n = new TCFNodeExpression(node, null, null, id, null, -1, false);
+ if (n == null) n = new TCFNodeExpression(node, null, null, null, id, null, -1, false);
assert n.id.equals(id);
assert n.parent == node;
n.setSortPosition(cnt++);
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLogExpressions.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLogExpressions.java
index a138d1c61..8634e4843 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLogExpressions.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenLogExpressions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2011, 2016 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
@@ -57,7 +57,7 @@ public class TCFChildrenLogExpressions extends TCFChildren {
for (String script : scripts) {
TCFNodeExpression expression_node = findScript(script);
if (expression_node == null) {
- add(expression_node = new TCFNodeExpression(node, script, null, null, null, -1, false));
+ add(expression_node = new TCFNodeExpression(node, script, null, null, null, null, -1, false));
}
data.put(expression_node.id, expression_node);
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenSubExpressions.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenSubExpressions.java
index 97741a6ee..1b509b85e 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenSubExpressions.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenSubExpressions.java
@@ -91,7 +91,7 @@ public class TCFChildrenSubExpressions extends TCFChildren {
}
}
if (isValid()) return null;
- TCFNodeExpression e = new TCFNodeExpression(node, null, field_id, null, null, -1, deref);
+ TCFNodeExpression e = new TCFNodeExpression(node, null, null, field_id, null, null, -1, deref);
add(e);
return e;
}
@@ -258,7 +258,7 @@ public class TCFChildrenSubExpressions extends TCFChildren {
if (!reg_children.validate(this)) return false;
for (TCFNode subnode : reg_children.toArray()) {
TCFNodeExpression n = findReg(subnode.id);
- if (n == null) add(n = new TCFNodeExpression(node, null, null, null, subnode.id, -1, false));
+ if (n == null) add(n = new TCFNodeExpression(node, null, null, null, null, subnode.id, -1, false));
n.setSortPosition(map.size());
map.put(n.id, n);
}
@@ -312,7 +312,7 @@ public class TCFChildrenSubExpressions extends TCFChildren {
HashMap<String,TCFNode> data = new HashMap<String,TCFNode>();
for (String s : c.getData()) {
TCFNodeExpression n = findScript(s);
- if (n == null) n = new TCFNodeExpression(node, s, null, null, null, -1, false);
+ if (n == null) n = new TCFNodeExpression(node, s, null, null, null, null, -1, false);
n.setSortPosition(i++);
data.put(n.id, n);
}
@@ -355,7 +355,7 @@ public class TCFChildrenSubExpressions extends TCFChildren {
if (size <= 100) {
for (int i = offs; i < offs + size; i++) {
TCFNodeExpression n = findIndex(i, false);
- if (n == null) n = new TCFNodeExpression(node, null, null, null, null, i, false);
+ if (n == null) n = new TCFNodeExpression(node, null, null, null, null, null, i, false);
n.setSortPosition(i);
data.put(n.id, n);
}
@@ -387,7 +387,7 @@ public class TCFChildrenSubExpressions extends TCFChildren {
}
else {
TCFNodeExpression n = findIndex(0, true);
- if (n == null) n = new TCFNodeExpression(node, null, null, null, null, 0, true);
+ if (n == null) n = new TCFNodeExpression(node, null, null, null, null, null, 0, true);
n.setSortPosition(0);
data.put(n.id, n);
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
index 9352360e0..0b5527eba 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
@@ -19,11 +19,7 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IExpressionManager;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IWatchExpression;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
@@ -33,7 +29,6 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdat
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.CellEditor;
@@ -66,10 +61,11 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
// TODO: enable Change Value user command
private final String script;
- private final int index;
- private final boolean deref;
+ private final IExpression platform_expression;
private final String field_id;
private final String reg_id;
+ private final int index;
+ private final boolean deref;
private final TCFData<String> base_text;
private final TCFData<IExpressions.Expression> var_expression;
private final TCFData<IExpressions.Expression> rem_expression;
@@ -86,7 +82,6 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
private IExpressions.Value next_value;
private byte[] parent_value;
private String remote_expression_id;
- private IExpression platform_expression;
private Object update_generation;
private static int expr_cnt;
@@ -100,11 +95,18 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
}
};
- TCFNodeExpression(final TCFNode parent, final String script,
+ TCFNodeExpression(final TCFNode parent, String expression_script, IExpression platform_expression,
final String field_id, final String var_id, final String reg_id,
final int index, final boolean deref) {
super(parent, var_id != null ? var_id : "Expr" + expr_cnt++);
- this.script = script;
+ if (platform_expression == null) {
+ this.script = expression_script;
+ this.platform_expression = null;
+ }
+ else {
+ this.script = platform_expression.getExpressionText();
+ this.platform_expression = platform_expression;
+ }
this.field_id = field_id;
this.reg_id = reg_id;
this.index = index;
@@ -807,10 +809,6 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return platform_expression;
}
- void setPlatformExpression(IExpression expression) {
- this.platform_expression = expression;
- }
-
String getFieldID() {
return field_id;
}
@@ -2205,33 +2203,16 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
public void run() {
try {
if (TCFColumnPresentationExpression.COL_NAME.equals(property)) {
- if (node.is_empty) {
- if (value instanceof String) {
- final String s = ((String)value).trim();
- if (s.length() > 0) {
- node.model.getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(s);
- DebugPlugin.getDefault().getExpressionManager().addExpression(expression);
- IAdaptable object = DebugUITools.getDebugContext();
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement)object;
- }
- else if (object instanceof ILaunch) {
- context = ((ILaunch)object).getDebugTarget();
- }
- expression.setExpressionContext(context);
- }
- });
- }
+ if (value instanceof String) {
+ String s = ((String)value).trim();
+ IExpressionManager m = node.model.getExpressionManager();
+ if (node.is_empty) {
+ if (s.length() > 0) m.addExpression(m.newWatchExpression(s));
+ }
+ else if (node.platform_expression != null && !s.equals(node.script)) {
+ m.removeExpression(node.platform_expression);
+ if (s.length() > 0) m.addExpression(m.newWatchExpression(s));
}
- }
- else if (!node.script.equals(value)) {
- IExpressionManager m = DebugPlugin.getDefault().getExpressionManager();
- m.removeExpression(node.platform_expression);
- IExpression e = m.newWatchExpression((String)value);
- m.addExpression(e);
}
done(Boolean.TRUE);
return;
@@ -2357,7 +2338,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
- if (script != null) {
+ if (platform_expression != null) {
if (adapter == IExpression.class) {
return platform_expression;
}

Back to the top