From d4bb0bba4d448dc6c8e69d1202795545860a668d Mon Sep 17 00:00:00 2001 From: Marc Dumais Date: Mon, 1 Apr 2013 06:59:49 -0400 Subject: [PATCH] Bug 404565 - [visualizer] Thread synchronization from multicore visualizer to debug view only works for first session Change-Id: I89cbd25169630f862129546f3ec1b3d652ee8dee Reviewed-on: https://git.eclipse.org/r/11547 IP-Clean: William Swanson Tested-by: William Swanson Reviewed-by: William Swanson --- .../internal/utils/DebugViewTreeWalker.java | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java index 5f7776dc971..ebf1133f20c 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewTreeWalker.java @@ -7,10 +7,14 @@ * * Contributors: * William R. Swanson (Tilera Corporation) - initial API and implementation + * Marc Dumais (Ericsson) - Bug 404565 *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; import org.eclipse.jface.viewers.TreePath; import org.eclipse.swt.widgets.Tree; @@ -57,7 +61,10 @@ public class DebugViewTreeWalker */ public void walk() { - walk(getRootPath()); + TreePath roots[] = getRootPaths(); + for(TreePath path : roots) { + walk(path); + } } /** @@ -105,20 +112,26 @@ public class DebugViewTreeWalker // --- tree path utilities --- - /** Gets tree path of root element. */ - public TreePath getRootPath() - { - // (?) This doesn't always return the expected root element. - //return m_viewer.getTopElementPath(); + /** + * Gets tree path of root element(s). + * Note: each returned path is the root of a distinct debug session + */ + public TreePath[] getRootPaths() + { + List paths = new ArrayList(); - TreePath path = null; if (m_viewer != null) { Tree tree = (Tree) m_viewer.getControl(); TreeItem[] items = tree.getItems(); - Object root = (items == null || items.length == 0) ? null : items[0].getData(); - if (root != null) path = new TreePath(new Object[] {root}); + + for (TreeItem item : items) { + Object root = (item == null) ? null : item.getData(); + if (root != null) { + paths.add(new TreePath(new Object[] {root})); + } + } } - return path; + return paths.toArray(new TreePath[paths.size()]); } /** Gets tree path for child element. */