diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ICPUInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ICPUInfo.java
new file mode 100644
index 00000000000..4761799ef82
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ICPUInfo.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core;
+
+/**
+ */
+public interface ICPUInfo {
+ public String getId();
+ public String getNumOfCores();
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ICoreInfo.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ICoreInfo.java
new file mode 100644
index 00000000000..3eba56f8783
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ICoreInfo.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core;
+
+/**
+ */
+public interface ICoreInfo {
+ public String getId();
+ public String getPhysicalId();
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.classpath b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.classpath
new file mode 100644
index 00000000000..31db9a91174
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.project b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.project
new file mode 100644
index 00000000000..8b3f7a66576
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.project
@@ -0,0 +1,34 @@
+
+
+ org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.pde.api.tools.apiAnalysisBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.pde.api.tools.apiAnalysisNature
+
+
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.settings/org.eclipse.jdt.core.prefs b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..669b0a3caf2
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,70 @@
+#Tue Jun 24 11:04:03 PDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..eef9f222bf8
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.cdt.dsf,
+ org.eclipse.cdt.dsf.ui,
+ org.eclipse.cdt.dsf.gdb,
+ org.eclipse.cdt.ui,
+ org.eclipse.cdt.visualizer.core,
+ org.eclipse.cdt.visualizer.ui,
+ org.eclipse.debug.ui
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: com.ibm.icu.text
+Export-Package: org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui,
+ org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions,
+ org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model,
+ org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view,
+ org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/about.html b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/about.html
new file mode 100644
index 00000000000..cb740ae8bc8
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/about.html
@@ -0,0 +1,24 @@
+
+
+
+
+About
+
About This Content
+
+
June 5, 2007
+
License
+
+
The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+
If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at http://www.eclipse.org.
+
+
\ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/build.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/build.properties
new file mode 100644
index 00000000000..6b63ac40a03
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/build.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2012 Ericsson 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
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Marc Khouzam (Ericsson) - initial API and implementation
+###############################################################################
+source.. = src/,\
+ resources/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/plugin.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/plugin.properties
new file mode 100644
index 00000000000..7216b261257
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2012 Ericsson 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
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Marc Khouzam (Ericsson) - initial API and implementation
+###############################################################################
+pluginName=Multicore Visualizer for DSF-GDB Integration
+providerName=Eclipse CDT
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/plugin.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/plugin.xml
new file mode 100644
index 00000000000..46a0aac6dde
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/plugin.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/pom.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/pom.xml
new file mode 100644
index 00000000000..d3a9fcbd007
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+
+ org.eclipse.cdt
+ cdt-parent
+ 8.1.0-SNAPSHOT
+ ../../pom.xml
+
+
+ 1.0.0-SNAPSHOT
+ org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui
+ eclipse-plugin
+
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties
new file mode 100644
index 00000000000..0103a53551c
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties
@@ -0,0 +1,21 @@
+# =============================================================================
+# Copyright (c) 2012 Tilera Corporation 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
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# William R. Swanson (Tilera Corporation)
+# =============================================================================
+
+# -----------------------------------------------------------------------------
+# Application string resources
+# -----------------------------------------------------------------------------
+
+# MulticoreVisualizer actions
+MulticoreVisualizer.actions.SelectAll.text=Select &All@Ctrl+A
+MulticoreVisualizer.actions.SelectAll.description=Select all thread(s)
+
+MulticoreVisualizer.actions.Refresh.text=Refresh@F5
+MulticoreVisualizer.actions.Refresh.description=Refresh the visualizer display
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/MulticoreVisualizerUIPlugin.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/MulticoreVisualizerUIPlugin.java
new file mode 100644
index 00000000000..f780d4e4051
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/MulticoreVisualizerUIPlugin.java
@@ -0,0 +1,282 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ * William R. Swanson (Tilera Corporation) - added resource support
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui;
+
+import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages;
+import org.eclipse.cdt.visualizer.ui.plugin.CDTVisualizerUIPlugin;
+import org.eclipse.cdt.visualizer.ui.util.UIResourceManager;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class MulticoreVisualizerUIPlugin extends AbstractUIPlugin
+{
+ // --- constants ---
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui"; //$NON-NLS-1$
+
+
+ // --- static members ---
+
+ /** Singleton instance */
+ private static MulticoreVisualizerUIPlugin plugin;
+
+ /** Bundle context */
+ private static BundleContext fgBundleContext;
+
+ /** Resource manager */
+ protected static UIResourceManager s_resources = null;
+
+ /**
+ * Returns the shared instance
+ */
+ public static MulticoreVisualizerUIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the bundle context for this plugin.
+ */
+ public static BundleContext getBundleContext() {
+ return fgBundleContext;
+ }
+
+
+ // --- constructors/destructors ---
+
+ /**
+ * The constructor
+ */
+ public MulticoreVisualizerUIPlugin() {
+ }
+
+
+ // --- plugin startup/shutdown methods ---
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ fgBundleContext = context;
+ super.start(context);
+ plugin = this;
+
+ // initialize resource management (strings, images, fonts, colors, etc.)
+ getPluginResources();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ // clean up resource management
+ cleanupPluginResources();
+
+ plugin = null;
+ super.stop(context);
+ fgBundleContext = null;
+ }
+
+
+ // --- logging ---
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @param status
+ * status to log
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+ /**
+ * Logs an internal error with the specified message.
+ *
+ * @param message
+ * the error message to log
+ */
+ public static void logErrorMessage(String message) {
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
+ }
+
+ /**
+ * Logs an internal error with the specified throwable
+ *
+ * @param e
+ * the exception to be logged
+ */
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e));
+ }
+
+
+ // --- accessors ---
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() == null) {
+ // If the default instance is not yet initialized,
+ // return a static identifier. This identifier must
+ // match the plugin id defined in plugin.xml
+ return PLUGIN_ID;
+ }
+ return getDefault().getBundle().getSymbolicName();
+ }
+
+
+ // --- UI plugin support ---
+
+ /**
+ * copied from org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
+ */
+ private static Shell debugDialogShell;
+
+ /**
+ * Returns shell (workbench or dialog) for this plugin.
+ */
+ public static Shell getShell() {
+ if (getActiveWorkbenchShell() != null) {
+ return getActiveWorkbenchShell();
+ }
+ if (debugDialogShell != null) {
+ if (!debugDialogShell.isDisposed())
+ return debugDialogShell;
+ debugDialogShell = null;
+ }
+ IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
+ return windows[0].getShell();
+ }
+
+ public static void setDialogShell(Shell shell) {
+ debugDialogShell = shell;
+ }
+
+ /**
+ * Returns the active workbench window
+ *
+ * @return the active workbench window
+ */
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ public static IWorkbenchPage getActivePage() {
+ IWorkbenchWindow w = getActiveWorkbenchWindow();
+ if (w != null) {
+ return w.getActivePage();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the active workbench shell or null if none
+ *
+ * @return the active workbench shell or null if none
+ */
+ public static Shell getActiveWorkbenchShell() {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null) {
+ return window.getShell();
+ }
+ return null;
+ }
+
+ /**
+ * Displays an error dialog.
+ */
+ public static void errorDialog(String message, IStatus status) {
+ log(status);
+ Shell shell = getActiveWorkbenchShell();
+ if (shell != null) {
+ ErrorDialog.openError(shell, LaunchMessages.getString("LaunchUIPlugin.Error"), message, status); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Displays an error dialog.
+ */
+ public static void errorDialog(String message, Throwable t) {
+ log(t);
+ Shell shell = getActiveWorkbenchShell();
+ if (shell != null) {
+ IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), 1, t.getMessage(), null);
+ ErrorDialog.openError(shell, LaunchMessages.getString("LaunchUIPlugin.Error"), message, status); //$NON-NLS-1$
+ }
+ }
+
+ // --- resource management ---
+
+ /** Returns resource manager for this plugin */
+ public UIResourceManager getPluginResources() {
+ if (s_resources == null) {
+ s_resources = new UIResourceManager(this);
+ s_resources.setParentManager(CDTVisualizerUIPlugin.getResources());
+ }
+
+ return s_resources;
+ }
+
+ /** Releases resource manager for this plugin. */
+ public void cleanupPluginResources() {
+ s_resources.dispose();
+ }
+
+ /** Convenience method for getting plugin resource manager */
+ public static UIResourceManager getResources() {
+ return getDefault().getPluginResources();
+ }
+
+ /** Convenience method for looking up string resources */
+ public static String getString(String key) {
+ return getDefault().getPluginResources().getString(key);
+ }
+ /** Convenience method for looking up string resources */
+ public static String getString(String key, Object... arguments) {
+ return getDefault().getPluginResources().getString(key, arguments);
+ }
+
+ /** Convenience method for looking up image resources */
+ public static Image getImage(String key) {
+ return getDefault().getPluginResources().getImage(key);
+ }
+ /** Convenience method for looking up image resources */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getDefault().getPluginResources().getImageDescriptor(key);
+ }
+
+ /** Convenience method for looking up font resources */
+ public static Font getFont(String fontName, int height) {
+ return getDefault().getPluginResources().getFont(fontName, height);
+ }
+ /** Convenience method for looking up font resources */
+ public static Font getFont(String fontName, int height, int style) {
+ return getDefault().getPluginResources().getFont(fontName, height, style);
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/RefreshAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/RefreshAction.java
new file mode 100644
index 00000000000..d60327715f9
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/RefreshAction.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tilera Corporation 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William R. Swanson (Tilera Corporation) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions;
+
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVisualizer;
+import org.eclipse.cdt.visualizer.ui.VisualizerAction;
+import org.eclipse.swt.SWT;
+
+/** Select All action for Visualizer context menu. */
+public class RefreshAction extends VisualizerAction
+{
+ // --- members ---
+
+ /** Visualizer instance we're associated with. */
+ MulticoreVisualizer m_visualizer = null;
+
+
+ // --- constructors/destructors ---
+
+ /** Constructor. */
+ public RefreshAction()
+ {
+ setText(MulticoreVisualizerUIPlugin.getString(
+ "MulticoreVisualizer.actions.Refresh.text")); //$NON-NLS-1$
+ setDescription(MulticoreVisualizerUIPlugin.getString(
+ "MulticoreVisualizer.actions.Refresh.description")); //$NON-NLS-1$
+ setAccelerator(SWT.F5);
+ }
+
+ /** Dispose method. */
+ @Override
+ public void dispose()
+ {
+ m_visualizer = null;
+ super.dispose();
+ }
+
+
+ // --- init methods ---
+
+ /** Initializes this action for the specified view. */
+ public void init(MulticoreVisualizer visualizer)
+ {
+ m_visualizer = visualizer;
+ }
+
+
+ // --- methods ---
+
+ /** Invoked when action is triggered. */
+ @Override
+ public void run() {
+ if (m_visualizer != null)
+ m_visualizer.refresh();
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SelectAllAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SelectAllAction.java
new file mode 100644
index 00000000000..80123a9f526
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/SelectAllAction.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tilera Corporation 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William R. Swanson (Tilera Corporation) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions;
+
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVisualizer;
+import org.eclipse.cdt.visualizer.ui.VisualizerAction;
+import org.eclipse.swt.SWT;
+
+/** Select All action for Visualizer context menu. */
+public class SelectAllAction extends VisualizerAction
+{
+ // --- members ---
+
+ /** Visualizer instance we're associated with. */
+ MulticoreVisualizer m_visualizer = null;
+
+
+ // --- constructors/destructors ---
+
+ /** Constructor. */
+ public SelectAllAction()
+ {
+ setText(MulticoreVisualizerUIPlugin.getString(
+ "MulticoreVisualizer.actions.SelectAll.text")); //$NON-NLS-1$
+ setDescription(MulticoreVisualizerUIPlugin.getString(
+ "MulticoreVisualizer.actions.SelectAll.description")); //$NON-NLS-1$
+ setAccelerator(SWT.CTRL + 'A');
+ }
+
+ /** Dispose method. */
+ @Override
+ public void dispose()
+ {
+ m_visualizer = null;
+ super.dispose();
+ }
+
+
+ // --- init methods ---
+
+ /** Initializes this action for the specified view. */
+ public void init(MulticoreVisualizer visualizer)
+ {
+ m_visualizer = visualizer;
+ }
+
+
+ // --- methods ---
+
+ /** Invoked when action is triggered. */
+ @Override
+ public void run() {
+ if (m_visualizer != null)
+ m_visualizer.selectAll();
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCPU.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCPU.java
new file mode 100755
index 00000000000..1f92161f1fd
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCPU.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tilera Corporation 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William R. Swanson (Tilera Corporation) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.List;
+
+//----------------------------------------------------------------------------
+// VisualizerCPU
+//----------------------------------------------------------------------------
+
+/** Represents single CPU. */
+public class VisualizerCPU
+ implements Comparable
+{
+ // --- members ---
+
+ /** ID of this core. */
+ public int m_id;
+
+ /** List of cores */
+ protected ArrayList m_cores;
+
+ /** Lookup table for cores. */
+ protected Hashtable m_coreMap;
+
+
+ // --- constructors/destructors ---
+
+ /** Constructor */
+ public VisualizerCPU(int id) {
+ m_id = id;
+ m_cores = new ArrayList();
+ m_coreMap = new Hashtable();
+ }
+
+ /** Dispose method */
+ public void dispose() {
+ if (m_cores != null) {
+ for (VisualizerCore core : m_cores) {
+ core.dispose();
+ }
+ m_coreMap.clear();
+ m_coreMap = null;
+ m_cores.clear();
+ m_cores = null;
+ }
+ }
+
+
+ // --- Object methods ---
+
+ /** Returns string representation. */
+ @Override
+ public String toString() {
+ return "CPU:" + m_id; //$NON-NLS-1$
+ }
+
+
+ // --- accessors ---
+
+ /** Gets ID of this CPU. */
+ public int getID() {
+ return m_id;
+ }
+
+
+ // --- methods ---
+
+ /** Gets number of cores. */
+ public int getCoreCount() {
+ return m_cores.size();
+ }
+
+ /** Gets cores. */
+ public List getCores() {
+ return m_cores;
+ }
+
+ /** Gets core with specified ID. */
+ public VisualizerCore getCore(int id) {
+ return m_coreMap.get(id);
+ }
+
+ /** Adds core. */
+ public VisualizerCore addCore(VisualizerCore core) {
+ m_cores.add(core);
+ m_coreMap.put(core.getID(), core);
+ return core;
+ }
+
+ /** Removes core. */
+ public void removeCore(VisualizerCore core) {
+ m_cores.remove(core);
+ m_coreMap.remove(core.getID());
+ }
+
+
+ /** Sorts cores, cpus, etc. by IDs. */
+ public void sort() {
+ Collections.sort(m_cores);
+ }
+
+
+ // --- Comparable implementation ---
+
+ /** Compares this item to the specified item. */
+ @Override
+ public int compareTo(VisualizerCPU o) {
+ int result = 0;
+ if (o != null) {
+ if (m_id < o.m_id) {
+ result = -1;
+ }
+ else if (m_id > o.m_id) {
+ result = 1;
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCore.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCore.java
new file mode 100755
index 00000000000..87bc1c55e96
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerCore.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tilera Corporation 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William R. Swanson (Tilera Corporation) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
+
+/** Represents single core of a CPU. */
+public class VisualizerCore
+ implements Comparable
+{
+ // --- members ---
+
+ /** CPU this core is part of. */
+ public VisualizerCPU m_cpu = null;
+
+ /** Linux CPU ID of this core. */
+ public int m_id = 0;
+
+
+ // --- constructors/destructors ---
+
+ /** Constructor */
+ public VisualizerCore(VisualizerCPU cpu, int id) {
+ m_cpu = cpu;
+ m_id = id;
+ }
+
+ /** Dispose method */
+ public void dispose() {
+ }
+
+
+ // --- Object methods ---
+
+ /** Returns string representation. */
+ @Override
+ public String toString() {
+ return m_cpu + ",Core:" + m_id; //$NON-NLS-1$
+ }
+
+
+ // --- accessors ---
+
+ /** Gets CPU this core is part of. */
+ public VisualizerCPU getCPU() {
+ return m_cpu;
+ }
+
+ /** Gets Linux CPU ID of this core. */
+ public int getID() {
+ return m_id;
+ }
+
+
+ // --- methods ---
+
+
+
+ // --- Comparable implementation ---
+
+ /** Compares this item to the specified item. */
+ @Override
+ public int compareTo(VisualizerCore o) {
+ int result = 0;
+ if (o != null) {
+ if (m_id < o.m_id) {
+ result = -1;
+ }
+ else if (m_id > o.m_id) {
+ result = 1;
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerExecutionState.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerExecutionState.java
new file mode 100644
index 00000000000..965a2e84ffe
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerExecutionState.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
+
+/**
+ * Execution state for the different multicore visualizer objects.
+ */
+public enum VisualizerExecutionState {
+ RUNNING,
+ SUSPENDED,
+ CRASHED,
+ EXITED
+};
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerModel.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerModel.java
new file mode 100755
index 00000000000..d62a71435d7
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerModel.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tilera Corporation 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William R. Swanson (Tilera Corporation) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.visualizer.ui.util.Todo;
+
+/**
+ * Class representing the state of the data to display in the MulticoreVisualizer.
+ */
+public class VisualizerModel
+{
+ // --- members ---
+
+ /** List of cpus (and cores) */
+ protected ArrayList m_cpus;
+
+ /** Lookup table for CPUs */
+ protected Hashtable m_cpuMap;
+
+ /** List of threads */
+ protected ArrayList m_threads;
+
+ /** Completion state tracker. */
+ protected Todo m_todo;
+
+ // Setting to remove exited threads, or keep them shown.
+ // If we are to support this, we should have a preference
+ // and a way to for the user to clean up old threads,
+ // or maybe a timeout to remove them.
+ private boolean m_keepExitedThreads = false;
+
+ // --- constructors/destructors ---
+
+ /** Constructor */
+ public VisualizerModel() {
+ m_cpus = new ArrayList();
+ m_cpuMap = new Hashtable();
+ m_threads = new ArrayList();
+ m_todo = new Todo();
+ }
+
+ /** Dispose method */
+ public void dispose() {
+ if (m_cpus != null) {
+ for (VisualizerCPU cpu : m_cpus) {
+ cpu.dispose();
+ }
+ m_cpuMap.clear();
+ m_cpuMap = null;
+ m_cpus.clear();
+ m_cpus = null;
+ }
+ if (m_threads != null) {
+ for (VisualizerThread thread : m_threads) {
+ thread.dispose();
+ }
+ m_threads.clear();
+ m_threads = null;
+ }
+ if (m_todo != null) {
+ m_todo.dispose();
+ m_todo = null;
+ }
+ }
+
+
+ // --- accessors ---
+
+ /** Gets completion state tracker. */
+ public Todo getTodo() {
+ return m_todo;
+ }
+
+ // --- methods ---
+
+ /** Sorts cores, cpus, etc. by IDs. */
+ public void sort() {
+ Collections.sort(m_cpus);
+ for (VisualizerCPU cpu : m_cpus) cpu.sort();
+ Collections.sort(m_threads);
+ }
+
+
+ // --- core/cpu management ---
+
+ /** Gets number of CPUs. */
+ public int getCPUCount() {
+ return m_cpus.size();
+ }
+
+ /** Gets CPU with specified ID. */
+ public VisualizerCPU getCPU(int id) {
+ return m_cpuMap.get(id);
+ }
+
+ /** Gets Core with specified ID. */
+ public VisualizerCore getCore(int id) {
+ VisualizerCore result = null;
+ for (VisualizerCPU cpu: m_cpus) {
+ result = cpu.getCore(id);
+ if (result != null) break;
+ }
+ return result;
+ }
+
+ /** Gets CPU set. */
+ public List getCPUs() {
+ return m_cpus;
+ }
+
+ /** Adds CPU. */
+ public VisualizerCPU addCPU(VisualizerCPU cpu) {
+ m_cpus.add(cpu);
+ m_cpuMap.put(cpu.getID(), cpu);
+ return cpu;
+ }
+
+ /** Removes CPU. */
+ public void removeCPU(VisualizerCPU cpu) {
+ m_cpus.remove(cpu);
+ m_cpuMap.remove(cpu.getID());
+ }
+
+
+ /** Gets maximum number of cores per CPU. */
+ public int getCoresPerCPU() {
+ int maxCores = 1;
+ for (VisualizerCPU cpu : m_cpus) {
+ int cores = cpu.getCoreCount();
+ if (cores > maxCores) maxCores = cores;
+ }
+ return maxCores;
+ }
+
+
+ // --- thread management ---
+
+ /** Gets threads. */
+ public List getThreads() {
+ return m_threads;
+ }
+
+ /**
+ * Finds thread(s) by process ID.
+ * If no threads are found, returns null rather
+ * than an empty list.
+ */
+ public List getThreadsForProcess(int processId) {
+ List result = null;
+ for (VisualizerThread thread : m_threads) {
+ if (thread.getPID() == processId) {
+ if (result == null) result = new ArrayList();
+ result.add(thread);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Find a thread by GDB threadId.
+ * Since thread ids are unique across a GDB session,
+ * we can uniquely find a thread based on its id.
+ */
+ public VisualizerThread getThread(int threadId) {
+ VisualizerThread result = null;
+ for (VisualizerThread thread : m_threads) {
+ if (thread.getGDBTID() == threadId) {
+ result = thread;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /** Adds thread. */
+ public VisualizerThread addThread(VisualizerThread thread) {
+ m_threads.add(thread);
+ return thread;
+ }
+
+ /** Removes thread. */
+ public void removeThread(VisualizerThread thread) {
+ m_threads.remove(thread);
+ }
+
+ /**
+ * Removes thread by GDB threadId.
+ */
+ public void removeThread(int threadId) {
+ Iterator itr = m_threads.iterator();
+ while (itr.hasNext()) {
+ VisualizerThread thread = itr.next();
+ if (thread.getGDBTID() == threadId) {
+ itr.remove();
+ break;
+ }
+ }
+ }
+
+ /**
+ * Mark the specified thread as having exited.
+ */
+ public void markThreadExited(int threadId) {
+ if (m_keepExitedThreads) {
+ VisualizerThread thread = getThread(threadId);
+ thread.setState(VisualizerExecutionState.EXITED);
+ } else {
+ removeThread(threadId);
+ }
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerThread.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerThread.java
new file mode 100755
index 00000000000..9c19d57bc5b
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/model/VisualizerThread.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tilera Corporation 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William R. Swanson (Tilera Corporation) - initial API and implementation
+ * Marc Khouzam (Ericsson) - Added knowledge about execution
+ * state and os/gdb thread ids
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
+
+/** Represents single thread. */
+public class VisualizerThread
+ implements Comparable
+{
+ // --- members ---
+
+ /** Current core this thread is on. */
+ protected VisualizerCore m_core;
+
+ /** Process ID (pid). */
+ protected int m_pid;
+
+ /** OS Thread ID (tid). */
+ protected int m_tid;
+
+ /** Thread ID as chosen by GDB. */
+ protected int m_gdbtid;
+
+ /** Thread execution state. */
+ protected VisualizerExecutionState m_threadState;
+
+
+ // --- constructors/destructors ---
+
+ /** Constructor. */
+ public VisualizerThread(VisualizerCore core, int pid, int tid, int gdbtid, VisualizerExecutionState state) {
+ m_core = core;
+ m_pid = pid;
+ m_tid = tid;
+ m_gdbtid = gdbtid;
+ m_threadState = state;
+ }
+
+ /** Dispose method */
+ public void dispose() {
+ m_core = null;
+ }
+
+
+ // --- Object methods ---
+
+ /** Equality comparison. */
+ @Override
+ public boolean equals(Object obj) {
+ boolean result = false;
+ if (obj instanceof VisualizerThread) {
+ VisualizerThread v = (VisualizerThread) obj;
+ result = (
+ v.m_pid == m_pid &&
+ v.m_tid == m_tid &&
+ v.m_gdbtid == m_gdbtid
+ );
+ }
+ return result;
+ }
+
+ /** Returns string representation. */
+ @Override
+ public String toString() {
+ StringBuffer output = new StringBuffer();
+ output.append(m_core).append(",Proc:").append(m_pid) //$NON-NLS-1$
+ .append(",Thread:(").append(m_tid).append(",").append(m_gdbtid).append(")"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ return output.toString();
+ }
+
+
+ // --- accessors ---
+
+ /** Gets core. */
+ public VisualizerCore getCore() {
+ return m_core;
+ }
+
+ public void setCore(VisualizerCore core) {
+ m_core = core;
+ }
+
+ /** Returns true if this is the "process" thread, i.e.
+ * its PID and OS TID are the same.
+ */
+ public boolean isProcessThread()
+ {
+ return m_pid == m_tid;
+ }
+
+ /** Gets process id (pid). */
+ public int getPID() {
+ return m_pid;
+ }
+
+ /** Gets thread id (tid). */
+ public int getTID() {
+ return m_tid;
+ }
+
+ /** Gets gdb thread id. */
+ public int getGDBTID() {
+ return m_gdbtid;
+ }
+
+ /** Gets thread execution state. */
+ public VisualizerExecutionState getState() {
+ return m_threadState;
+ }
+
+ /** Sets thread execution state. */
+ public void setState(VisualizerExecutionState state) {
+ m_threadState = state;
+ }
+
+
+ // --- methods ---
+
+
+
+ // --- Comparable implementation ---
+
+ /** Compares this item to the specified item. */
+ @Override
+ public int compareTo(VisualizerThread o) {
+ int result = 0;
+ if (o != null) {
+ if (m_pid < o.m_pid) {
+ result = -1;
+ }
+ else if (m_pid > o.m_pid) {
+ result = 1;
+ }
+ else if (m_tid < o.m_tid) {
+ result = -1;
+ }
+ else if (m_tid > o.m_tid) {
+ result = 1;
+ }
+ }
+ return result;
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IMulticoreVisualizerConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IMulticoreVisualizerConstants.java
new file mode 100644
index 00000000000..5b3a280cacc
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IMulticoreVisualizerConstants.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
+
+import org.eclipse.cdt.visualizer.ui.util.Colors;
+import org.eclipse.swt.graphics.Color;
+
+
+/**
+ * Constants to be used in the Multicore Visualizer.
+ */
+public class IMulticoreVisualizerConstants
+{
+ // General canvas colors
+ public static final Color COLOR_SELECTED = Colors.CYAN;
+
+ // Colors for drawing threads
+
+ /** Color to be used to draw a running thread */
+ public static final Color COLOR_RUNNING_THREAD = Colors.GREEN;
+ /** Color to be used to draw a suspended thread */
+ public static final Color COLOR_SUSPENDED_THREAD = Colors.YELLOW;
+ /** Color to be used to draw a crashed thread */
+ public static final Color COLOR_CRASHED_THREAD = Colors.RED;
+ /** Color to be used to draw an exited thread (if they are being shown) */
+ public static final Color COLOR_EXITED_THREAD = Colors.GRAY;
+
+ /** Color to be used to draw an highlight for the process thread */
+ public static final Color COLOR_PROCESS_THREAD = Colors.WHITE;
+
+ // Colors for drawing cores
+
+ /** Color to be used to draw a running core */
+ public static final Color COLOR_RUNNING_CORE_FG = Colors.GREEN;
+ public static final Color COLOR_RUNNING_CORE_BG = Colors.DARK_GREEN;
+ /** Color to be used to draw a suspended core */
+ public static final Color COLOR_SUSPENDED_CORE_FG = Colors.YELLOW;
+ public static final Color COLOR_SUSPENDED_CORE_BG = Colors.DARK_YELLOW;
+ /** Color to be used to draw a crashed core */
+ public static final Color COLOR_CRASHED_CORE_FG = Colors.RED;
+ public static final Color COLOR_CRASHED_CORE_BG = Colors.DARK_RED;
+
+ // Colors for text
+
+ /** Color to be used to draw a the text for a thread */
+ public static final Color COLOR_THREAD_TEXT_FG = Colors.WHITE;
+ public static final Color COLOR_THREAD_TEXT_BG = Colors.BLACK;
+
+ /** Color to be used to draw a the text for a core */
+ public static final Color COLOR_CORE_TEXT_FG = Colors.WHITE;
+ public static final Color COLOR_CORE_TEXT_BG = Colors.BLACK;
+}
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
new file mode 100755
index 00000000000..8dc1a78028d
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
@@ -0,0 +1,879 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tilera Corporation 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William R. Swanson (Tilera Corporation) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
+import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
+import org.eclipse.cdt.dsf.datamodel.DMContexts;
+import org.eclipse.cdt.dsf.datamodel.IDMContext;
+import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
+import org.eclipse.cdt.dsf.gdb.launching.GDBProcess;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.RefreshAction;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.SelectAllAction;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerCPU;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerCore;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerExecutionState;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerModel;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerThread;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DSFDebugModel;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DSFDebugModelListener;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DSFSessionState;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DebugViewUtils;
+import org.eclipse.cdt.dsf.gdb.service.IGDBHardware.ICPUDMContext;
+import org.eclipse.cdt.dsf.gdb.service.IGDBHardware.ICoreDMContext;
+import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
+import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
+import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
+import org.eclipse.cdt.visualizer.ui.canvas.GraphicCanvas;
+import org.eclipse.cdt.visualizer.ui.canvas.GraphicCanvasVisualizer;
+import org.eclipse.cdt.visualizer.ui.plugin.CDTVisualizerUIPlugin;
+import org.eclipse.cdt.visualizer.ui.util.Colors;
+import org.eclipse.cdt.visualizer.ui.util.GUIUtils;
+import org.eclipse.cdt.visualizer.ui.util.SelectionUtils;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.internal.ui.commands.actions.DropToFrameCommandAction;
+import org.eclipse.debug.internal.ui.commands.actions.ResumeCommandAction;
+import org.eclipse.debug.internal.ui.commands.actions.StepIntoCommandAction;
+import org.eclipse.debug.internal.ui.commands.actions.StepOverCommandAction;
+import org.eclipse.debug.internal.ui.commands.actions.StepReturnCommandAction;
+import org.eclipse.debug.internal.ui.commands.actions.SuspendCommandAction;
+import org.eclipse.debug.internal.ui.commands.actions.TerminateCommandAction;
+import org.eclipse.debug.internal.ui.views.launch.LaunchView;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * The Multicore Visualizer is a generic visualizer that displays
+ * CPUs, cores, threads graphically.
+ *
+ * This visualizer uses the CDT Visualizer framework.
+ */
+@SuppressWarnings("restriction")
+public class MulticoreVisualizer extends GraphicCanvasVisualizer
+ implements DSFDebugModelListener
+{
+ // --- constants ---
+
+ /** Eclipse ID for this view */
+ public static final String ECLIPSE_ID = "org.eclipse.cdt.dsf.gdb.multicorevisualizer.visualizer"; //$NON-NLS-1$
+
+
+ // --- members ---
+
+ /**
+ * The data model drawn by this visualizer.
+ */
+ protected VisualizerModel fDataModel;
+
+ /** Downcast reference to canvas. */
+ protected MulticoreVisualizerCanvas m_canvas;
+
+ /** DSF debug context session object. */
+ protected DSFSessionState m_sessionState;
+
+ /** Event listener class for DSF events */
+ protected MulticoreVisualizerEventListener fEventListener;
+
+
+ // --- UI members ---
+
+ /** Whether actions have been initialized. */
+ boolean m_actionsInitialized = false;
+
+ /** Toolbar / menu action */
+ Separator m_separatorAction = null;
+
+ /** Toolbar / menu action */
+ ResumeCommandAction m_resumeAction = null;
+
+ /** Toolbar / menu action */
+ SuspendCommandAction m_suspendAction = null;
+
+ /** Toolbar / menu action */
+ TerminateCommandAction m_terminateAction = null;
+
+ /** Toolbar / menu action */
+ StepReturnCommandAction m_stepReturnAction = null;
+
+ /** Toolbar / menu action */
+ StepOverCommandAction m_stepOverAction = null;
+
+ /** Toolbar / menu action */
+ StepIntoCommandAction m_stepIntoAction = null;
+
+ /** Toolbar / menu action */
+ DropToFrameCommandAction m_dropToFrameAction = null;
+
+ /** Toolbar / menu action */
+ SelectAllAction m_selectAllAction = null;
+
+ /** Toolbar / menu action */
+ RefreshAction m_refreshAction = null;
+
+
+ // --- constructors/destructors ---
+
+ /** Constructor. */
+ public MulticoreVisualizer()
+ {
+ }
+
+ /** Dispose method. */
+ @Override
+ public void dispose()
+ {
+ super.dispose();
+ disposeActions();
+ }
+
+
+ // --- init methods ---
+
+ /** Invoked when visualizer is created, to permit any initialization. */
+ @Override
+ public void initializeVisualizer() {
+ fEventListener = new MulticoreVisualizerEventListener(this);
+ }
+
+ /** Invoked when visualizer is disposed, to permit any cleanup. */
+ @Override
+ public void disposeVisualizer()
+ {
+ // handle any other cleanup
+ dispose();
+ }
+
+
+ // --- accessors ---
+
+ /** Returns non-localized unique name for this visualizer. */
+ @Override
+ public String getName() {
+ return "multicore"; //$NON-NLS-1$
+ }
+
+ /** Returns localized name to display for this visualizer. */
+ @Override
+ public String getDisplayName() {
+ // TODO: use a string resource here.
+ return "Multicore Visualizer"; //$NON-NLS-1$
+ }
+
+ /** Returns localized tooltip text to display for this visualizer. */
+ @Override
+ public String getDescription() {
+ // TODO: use a string resource here.
+ return "Displays current state of selected debug target."; //$NON-NLS-1$
+ }
+
+
+ // --- canvas management ---
+
+ /** Creates and returns visualizer canvas control. */
+ @Override
+ public GraphicCanvas createCanvas(Composite parent)
+ {
+ m_canvas = new MulticoreVisualizerCanvas(parent);
+ m_canvas.addSelectionChangedListener(this);
+ return m_canvas;
+ }
+
+ /** Invoked when canvas control should be disposed. */
+ @Override
+ public void disposeCanvas()
+ {
+ if (m_canvas != null) {
+ m_canvas.removeSelectionChangedListener(this);
+ m_canvas.dispose();
+ m_canvas = null;
+ }
+ }
+
+ /** Invoked after visualizer control creation, */
+ @Override
+ protected void initializeCanvas(GraphicCanvas canvas)
+ {
+ // Any workbench views left open at application shutdown may be instanced
+ // before our plugins are fully loaded, so make sure resource manager is initialized.
+ // Note: this also associates the resource manager with the Colors class;
+ // until this is done, the Colors constants are null.
+ CDTVisualizerUIPlugin.getResources();
+
+ m_canvas.setBackground(Colors.BLACK);
+ m_canvas.setForeground(Colors.GREEN);
+ }
+
+ /** Returns downcast reference to grid view canvas. */
+ public MulticoreVisualizerCanvas getMulticoreVisualizerCanvas()
+ {
+ return (MulticoreVisualizerCanvas) getCanvas();
+ }
+
+ /** Return the data model backing this multicore visualizer */
+ public VisualizerModel getModel() {
+ return fDataModel;
+ }
+
+
+ // --- action management ---
+
+ /** Creates actions for menus/toolbar. */
+ protected void createActions()
+ {
+ if (m_actionsInitialized) return; // already done
+
+ LaunchView debugView = DebugViewUtils.getDebugView();
+
+ m_separatorAction = new Separator();
+
+ m_resumeAction = new ResumeCommandAction();
+ if (debugView != null) m_resumeAction.init(debugView);
+
+ m_suspendAction = new SuspendCommandAction();
+ if (debugView != null) m_suspendAction.init(debugView);
+
+ m_terminateAction = new TerminateCommandAction();
+ if (debugView != null) m_terminateAction.init(debugView);
+
+
+ m_stepReturnAction = new StepReturnCommandAction();
+ if (debugView != null) m_stepReturnAction.init(debugView);
+
+ m_stepOverAction = new StepOverCommandAction();
+ if (debugView != null) m_stepOverAction.init(debugView);
+
+ m_stepIntoAction = new StepIntoCommandAction();
+ if (debugView != null) m_stepIntoAction.init(debugView);
+
+ m_dropToFrameAction = new DropToFrameCommandAction();
+ if (debugView != null) m_dropToFrameAction.init(debugView);
+
+ m_selectAllAction = new SelectAllAction();
+ m_selectAllAction.init(this);
+
+ m_refreshAction = new RefreshAction();
+ m_refreshAction.init(this);
+
+ // Note: debug view may not be initialized at startup,
+ // so we'll pretend the actions are not yet updated,
+ // and reinitialize them later.
+ m_actionsInitialized = (debugView != null);
+ }
+
+ /** Updates actions displayed on menu/toolbars. */
+ protected void updateActions()
+ {
+ if (! m_actionsInitialized) return;
+
+ // TODO: do we need any special enabling code here?
+ // Seems like we can rely on the enabling done by the DebugView itself,
+ // since we've associated these actions with it.
+
+ boolean enabled = hasSelection();
+
+ m_resumeAction.setEnabled(enabled);
+ m_suspendAction.setEnabled(enabled);
+ m_terminateAction.setEnabled(enabled);
+
+ m_stepReturnAction.setEnabled(enabled);
+ m_stepOverAction.setEnabled(enabled);
+ m_stepIntoAction.setEnabled(enabled);
+ m_dropToFrameAction.setEnabled(enabled);
+
+ }
+
+ /** Updates actions specific to context menu. */
+ protected void updateContextMenuActions(Point location)
+ {
+ }
+
+ /** Cleans up actions. */
+ protected void disposeActions() {
+ if (m_resumeAction != null) {
+ m_resumeAction.dispose();
+ m_resumeAction = null;
+ }
+
+ if (m_suspendAction != null) {
+ m_suspendAction.dispose();
+ m_suspendAction = null;
+ }
+
+ if (m_terminateAction != null) {
+ m_terminateAction.dispose();
+ m_terminateAction = null;
+ }
+
+ if (m_stepReturnAction != null) {
+ m_stepReturnAction.dispose();
+ m_stepReturnAction = null;
+ }
+
+ if (m_stepOverAction != null) {
+ m_stepOverAction.dispose();
+ m_stepOverAction = null;
+ }
+
+ if (m_stepIntoAction != null) {
+ m_stepIntoAction.dispose();
+ m_stepIntoAction = null;
+ }
+
+ if (m_dropToFrameAction != null) {
+ m_dropToFrameAction.dispose();
+ m_dropToFrameAction = null;
+ }
+
+ if (m_selectAllAction != null) {
+ m_selectAllAction.dispose();
+ m_selectAllAction = null;
+ }
+
+ if (m_refreshAction != null) {
+ m_refreshAction.dispose();
+ m_refreshAction = null;
+ }
+
+ m_actionsInitialized = false;
+ }
+
+
+ // --- menu/toolbar management ---
+
+ /** Invoked when visualizer is selected, to populate the toolbar. */
+ @Override
+ public void populateToolBar(IToolBarManager toolBarManager)
+ {
+ // initialize menu/toolbar actions, if needed
+ createActions();
+
+ toolBarManager.add(m_resumeAction);
+ toolBarManager.add(m_suspendAction);
+ toolBarManager.add(m_terminateAction);
+
+ toolBarManager.add(m_separatorAction);
+
+ toolBarManager.add(m_stepReturnAction);
+ toolBarManager.add(m_stepOverAction);
+ toolBarManager.add(m_stepIntoAction);
+ toolBarManager.add(m_dropToFrameAction);
+
+ updateActions();
+ }
+
+ /** Invoked when visualizer is selected, to populate the toolbar's menu. */
+ @Override
+ public void populateMenu(IMenuManager menuManager)
+ {
+ // initialize menu/toolbar actions, if needed
+ createActions();
+
+ // TODO: Anything we want to hide on the toolbar menu?
+
+ updateActions();
+ }
+
+ /** Invoked when visualizer view's context menu is invoked, to populate it. */
+ @Override
+ public void populateContextMenu(IMenuManager menuManager)
+ {
+ // initialize menu/toolbar actions, if needed
+ createActions();
+
+ menuManager.add(m_resumeAction);
+ menuManager.add(m_suspendAction);
+ menuManager.add(m_terminateAction);
+
+ menuManager.add(m_separatorAction);
+
+ menuManager.add(m_stepReturnAction);
+ menuManager.add(m_stepOverAction);
+ menuManager.add(m_stepIntoAction);
+ menuManager.add(m_dropToFrameAction);
+
+ menuManager.add(m_separatorAction);
+
+ menuManager.add(m_selectAllAction);
+ menuManager.add(m_refreshAction);
+
+ updateActions();
+ Point location = m_viewer.getContextMenuLocation();
+ updateContextMenuActions(location);
+ }
+
+
+ // --- visualizer selection management ---
+
+ /** Invoked when visualizer has been selected. */
+ @Override
+ public void visualizerSelected() {
+ updateActions();
+ };
+
+ /** Invoked when another visualizer has been selected, hiding this one. */
+ @Override
+ public void visualizerDeselected() {
+ };
+
+
+ // --- workbench selection management ---
+
+ /**
+ * Tests whether if the IVisualizer can display the selection
+ * (or something reachable from it).
+ */
+ @Override
+ public int handlesSelection(ISelection selection)
+ {
+ // By default, we don't support anything.
+ int result = 0;
+
+ Object sel = SelectionUtils.getSelectedObject(selection);
+ if (sel instanceof GdbLaunch ||
+ sel instanceof GDBProcess ||
+ sel instanceof IDMVMContext)
+ {
+ result = 1;
+ }
+ else {
+ result = 0;
+ }
+
+ return result;
+ }
+
+ /**
+ * Invoked by VisualizerViewer when workbench selection changes.
+ */
+ @Override
+ public void workbenchSelectionChanged(ISelection selection)
+ {
+ refresh();
+ }
+
+ /** Refreshes visualizer content from model. */
+ public void refresh()
+ {
+ // See if we need to update our debug info from
+ // the workbench selection. This will be done asynchronously.
+ boolean changed = updateDebugContext();
+
+ // Even if debug info doesn't change, we still want to
+ // check whether the canvas selection needs to change
+ // to reflect the current workbench selection.
+ if (!changed) updateCanvasSelection();
+ }
+
+
+ // --- ISelectionChangedListener implementation ---
+
+ /**
+ * Invoked when visualizer control's selection changes.
+ * Sets control selection as its own selection,
+ * and raises selection changed event for any listeners.
+ */
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ super.selectionChanged(event);
+
+ // Force Debug View's selection to reflect visualizer selection,
+ // since debug view doesn't update itself from the workbench selection.
+ // NOTE: This can be overridden by the model selection policy, if there is one.
+ ISelection debugViewSelection = visualizerToDebugViewSelection(getSelection());
+ DebugViewUtils.setDebugViewSelection(debugViewSelection);
+
+ // update actions to reflect change of selection
+ updateActions();
+ }
+
+
+ // --- Selection conversion methods ---
+
+ /** Gets debug view selection from visualizer selection. */
+ protected ISelection visualizerToDebugViewSelection(ISelection visualizerSelection)
+ {
+ MulticoreVisualizerSelectionFinder selectionFinder =
+ new MulticoreVisualizerSelectionFinder();
+ ISelection workbenchSelection =
+ selectionFinder.findSelection(visualizerSelection);
+ return workbenchSelection;
+ }
+
+ /** Gets visualizer selection from debug view selection. */
+ protected ISelection workbenchToVisualizerSelection(ISelection workbenchSelection)
+ {
+ ISelection visualizerSelection = null;
+
+ List