summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorPawel Piech2012-10-24 18:33:32 (EDT)
committer Eugene Tarassov2012-10-30 14:16:14 (EDT)
commit0ff083d1344fbb52ed61ac7f0e65a0087166f5fd (patch)
tree60a3168f5fc354ab6fd5b741c83b27ebb2e3fa1b
parentdd804abcd6ca1e34198bc0b5d1b38eacdf2727b4 (diff)
downloadorg.eclipse.tcf-0ff083d1344fbb52ed61ac7f0e65a0087166f5fd.zip
org.eclipse.tcf-0ff083d1344fbb52ed61ac7f0e65a0087166f5fd.tar.gz
org.eclipse.tcf-0ff083d1344fbb52ed61ac7f0e65a0087166f5fd.tar.bz2
Bug 392783 - Parent context node never re-expanded in debug view after child list is deleted and repopulated
Extended use of tracking user-expanded/collapsed elements to auto-expand containers.
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java10
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelProxy.java41
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java1
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeLaunch.java1
4 files changed, 39 insertions, 14 deletions
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java
index 0031c8a..91fb837 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModel.java
@@ -933,14 +933,14 @@ public class TCFModel implements ITCFModel, IElementContentProvider, IElementLab
TCFNode node = getNode(id);
if (node instanceof TCFNodeExecContext) {
((TCFNodeExecContext)node).onContextRemoved();
- for (TCFModelProxy p : model_proxies) p.saveExpandState(node);
+ for (TCFModelProxy p : model_proxies) {
+ p.saveExpandState(node);
+ p.clearAutoExpandStack(id);
+ }
}
action_results.remove(id);
Object o = context_map.remove(id);
if (o instanceof CreateNodeRunnable) ((CreateNodeRunnable)o).onContextRemoved();
- for (TCFModelProxy proxy : model_proxies) {
- proxy.clearAutoExpandStack(id);
- }
if (mem_blocks_update != null) mem_blocks_update.changeset.remove(id);
}
@@ -1602,7 +1602,7 @@ public class TCFModel implements ITCFModel, IElementContentProvider, IElementLab
reason.equals(IRunControl.REASON_STEP) ||
reason.equals(IRunControl.REASON_CONTAINER) ||
delay_stack_update_until_last_step && launch.getContextActionsCount(node.id) != 0;
- if (proxy.getAutoExpandNode(node.id, user_request)) proxy.expand(node);
+ if (proxy.getAutoExpandNode(node, user_request)) proxy.expand(node);
if (reason.equals(IRunControl.REASON_USER_REQUEST)) return;
proxy.setSelection(node);
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelProxy.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelProxy.java
index 3a60c2b..4ead69c 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelProxy.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFModelProxy.java
@@ -18,7 +18,6 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
-import java.util.TreeMap;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
@@ -61,7 +60,7 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru
private final Set<ModelDelta> content_deltas = new HashSet<ModelDelta>();
private final LinkedList<TCFNode> selection = new LinkedList<TCFNode>();
private final Set<String> auto_expand_set = new HashSet<String>();
- private Map<String, Boolean> expanded_nodes = Collections.synchronizedMap(new TreeMap<String, Boolean>());
+ private Map<String, Boolean> expanded_nodes = Collections.synchronizedMap(new HashMap<String, Boolean>());
private ITreeModelViewer viewer;
private boolean posted;
@@ -303,17 +302,22 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru
* @param user_request Flag whether the state is requested in response
* to a user-requested suspend event.
*/
- boolean getAutoExpandNode(String id, boolean user_request) {
+ boolean getAutoExpandNode(TCFNode node, boolean user_request) {
+ String id = node.id;
+ node.getParent();
Boolean expand = null;
synchronized(expanded_nodes) {
- expand = id != null ? expanded_nodes.get(id) : null;
+ expand = expanded_nodes.get(id);
if (expand == null) {
if (user_request) {
expand = Boolean.FALSE;
}
else {
expand = Boolean.TRUE;
- if (id != null) expanded_nodes.put(id, is_linux);
+ while (node != null) {
+ expanded_nodes.put(node.getID(), is_linux);
+ node = node.getParent();
+ }
}
}
}
@@ -486,10 +490,13 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru
public void run() {
if (save_expand_state != null && save_expand_state.size() > 0) {
if (viewer instanceof IInternalTreeModelViewer) {
- IInternalTreeModelViewer tree_viwer = (IInternalTreeModelViewer)viewer;
final Set<String> expanded = new HashSet<String>();
for (TCFNode node : save_expand_state) {
- if (tree_viwer.getExpandedState(node)) expanded.add(node.id);
+ if (getExpandedState(node) ||
+ Boolean.TRUE.equals(expanded_nodes.get(node.getID())) )
+ {
+ expanded.add(node.id);
+ }
}
if (expanded.size() > 0) {
Protocol.invokeLater(new Runnable() {
@@ -507,6 +514,15 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru
}
}
+ private boolean getExpandedState(TCFNode node) {
+ IInternalTreeModelViewer tree_viewer = (IInternalTreeModelViewer)viewer;
+ Object element = node;
+ if (node instanceof TCFNodeLaunch) {
+ element = node.getModel().getLaunch();
+ }
+ return tree_viewer.getExpandedState(element);
+ }
+
private void postDelta() {
assert Protocol.isDispatchThread();
if (disposed) return;
@@ -620,8 +636,15 @@ public class TCFModelProxy extends AbstractModelProxy implements IModelProxy, Ru
}
private void updateExpandStack(TreeExpansionEvent event, final boolean expand) {
- if (event.getElement() instanceof TCFNodeExecContext) {
- TCFNodeExecContext node = (TCFNodeExecContext)event.getElement();
+ Object element = event.getElement();
+ TCFNode node = null;
+ if (element instanceof TCFNode) {
+ node = (TCFNode)element;
+ }
+ if (element instanceof TCFLaunch) {
+ node = model.getRootNode();
+ }
+ if (node != null) {
if (model == node.getModel()) expanded_nodes.put(node.id, expand);
}
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
index c90c6e5..7ce5588 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
@@ -1338,6 +1338,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner, ITCFExe
}
void onContextAdded(IRunControl.RunControlContext context) {
+ model.setDebugViewSelection(this, IRunControl.REASON_USER_REQUEST);
children_exec.onContextAdded(context);
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeLaunch.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeLaunch.java
index ec0a64f..8c3cc77 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeLaunch.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeLaunch.java
@@ -142,6 +142,7 @@ public class TCFNodeLaunch extends TCFNode implements ISymbolOwner {
}
}
}
+ model.setDebugViewSelection(this, IRunControl.REASON_USER_REQUEST);
children.onContextAdded(context);
}