Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Dumais2014-11-13 19:09:56 +0000
committerMarc Dumais2014-11-14 13:29:51 +0000
commit2d511d95a6b429f79ce4aeca6f073e4f57d4c115 (patch)
treef0d60a048eafa228d2e240674b8b3804387404c7 /dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui
parent13b0270d5cc185165be0870d8618e97150daeedf (diff)
downloadorg.eclipse.cdt-2d511d95a6b429f79ce4aeca6f073e4f57d4c115.tar.gz
org.eclipse.cdt-2d511d95a6b429f79ce4aeca6f073e4f57d4c115.tar.xz
org.eclipse.cdt-2d511d95a6b429f79ce4aeca6f073e4f57d4c115.zip
Bug 451392 - [visualizer] improve selection synchronization from MV view
to debug view back to cloned MV view(s) Change-Id: I16abf3022a2b4fa0478624c1a9a6b4589cbdc311 Reviewed-on: https://git.eclipse.org/r/36434 Tested-by: Hudson CI Reviewed-by: William Swanson <WilliamRSwanson@gmail.com> Reviewed-by: Marc Dumais <marc.dumais@ericsson.com> Tested-by: Marc Dumais <marc.dumais@ericsson.com>
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui')
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java29
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java10
2 files changed, 38 insertions, 1 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
index 826d462435c..3c2266efaff 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
@@ -19,6 +19,7 @@
* Xavier Raynaud (kalray) - Bug 431935
* Marc Dumais (Ericsson) - Bug 441713
* Marc Dumais (Ericsson) - Bug 442312
+ * Marc Dumais (Ericsson) - Bug 451392
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
@@ -86,6 +87,7 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
@@ -128,6 +130,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
/** Model changed listener, attached to Debug View. */
protected IModelChangedListener m_modelChangedListener = null;
+ /** Debug view selection changed listener, attached to Debug View. */
+ protected ISelectionChangedListener m_debugViewSelectionChangedListener = null;
+
+
// These two arrays are used to cache the CPU and core
// contexts, each time the model is recreated. This way
// we can avoid asking the backend for the CPU/core
@@ -751,7 +757,19 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
}});
}
};
+ m_debugViewSelectionChangedListener =
+ new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ // Execute a refresh after any pending UI updates.
+ GUIUtils.exec( new Runnable() { @Override public void run() {
+ // Update canvas selection to match to dbg view selection
+ updateCanvasSelectionFromDebugView();
+ }});
+ }
+ };
m_debugViewer.addModelChangedListener(m_modelChangedListener);
+ m_debugViewer.addSelectionChangedListener(m_debugViewSelectionChangedListener);
}
}
}
@@ -759,11 +777,13 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
/** Removes debug viewer listener. */
protected void removeDebugViewerListener()
{
- if (m_modelChangedListener != null) {
+ if (m_modelChangedListener != null && m_debugViewSelectionChangedListener != null) {
if (m_debugViewer != null) {
m_debugViewer.removeModelChangedListener(m_modelChangedListener);
+ m_debugViewer.removeSelectionChangedListener(m_debugViewSelectionChangedListener);
m_debugViewer = null;
m_modelChangedListener = null;
+ m_debugViewSelectionChangedListener = null;
}
}
}
@@ -1052,6 +1072,13 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
updateCanvasSelectionInternal(SelectionUtils.getWorkbenchSelection());
}
+ /** Updates canvas selection from current debug view selection.
+ * Note: this method assumes it is called on the UI thread. */
+ protected void updateCanvasSelectionFromDebugView()
+ {
+ updateCanvasSelectionInternal(DebugViewUtils.getDebugViewSelection());
+ }
+
/** Updates canvas selection from current workbench selection.
* Note: this method assumes it is called on the UI thread. */
protected void updateCanvasSelectionInternal(ISelection selection)
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java
index b91497d35b7..b3da3e5f6dc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/utils/DebugViewUtils.java
@@ -7,6 +7,7 @@
*
* Contributors:
* William R. Swanson (Tilera Corporation)
+ * Marc Dumais (Ericsson) - Bug 451392
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils;
@@ -76,4 +77,13 @@ public class DebugViewUtils
if (viewer == null || selection == null) return false;
return viewer.trySelection(selection, true, true);
}
+
+ /**
+ * Returns the debug view selection.
+ */
+ public static ISelection getDebugViewSelection() {
+ TreeModelViewer viewer = DebugViewUtils.getDebugViewer();
+ if (viewer == null) return null;
+ return viewer.getSelection();
+ }
}

Back to the top