1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 01:45:33 +02:00

Bug 441713 - [visualizer] Make pinning of multicore visualizer view

possible

Change-Id: Ie47c21c35dc85d4efd34f273f8f0a51d4e82d16a
Reviewed-on: https://git.eclipse.org/r/31898
Reviewed-by: Marc Dumais <marc.dumais@ericsson.com>
Tested-by: Marc Dumais <marc.dumais@ericsson.com>
This commit is contained in:
Marc Dumais 2014-08-12 09:09:26 -04:00
parent 698bb0afe4
commit ce5a26d6ce
8 changed files with 188 additions and 5 deletions

View file

@ -7,7 +7,7 @@ Bundle-Activator: org.eclipse.cdt.debug.ui.CDebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package:
org.eclipse.cdt.debug.internal.ui;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.dsf.gdb.ui",
org.eclipse.cdt.debug.internal.ui;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.dsf.gdb.ui,org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui",
org.eclipse.cdt.debug.internal.ui.actions;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.memorybrowser,org.eclipse.cdt.visualizer.ui",
org.eclipse.cdt.debug.internal.ui.actions.breakpoints;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.breakpoints;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.dsf.gdb.ui",

View file

@ -10,6 +10,7 @@
* Ericsson - Added tracepoint support (284286)
* Marc Khouzam (Ericsson) - Added dynamic printf support (400628)
* Marc Dumais (Ericsson) - Bug 437692
* Marc Dumais (Ericsson) - Bug 441713
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui;
@ -127,6 +128,7 @@ public class CDebugImages {
public static final String IMG_LCL_DETAIL_PANE_HIDE = NAME_PREFIX + "det_pane_hide.gif"; //$NON-NLS-1$
public static final String IMG_LCL_COLLAPSE_ALL = NAME_PREFIX + "collapseall.gif"; //$NON-NLS-1$
public static final String IMG_LCL_OPEN_NEW_VIEW = NAME_PREFIX + "open_new.gif"; //$NON-NLS-1$
public static final String IMG_LCL_PIN_VIEW = NAME_PREFIX + "toolbar_pinned.gif"; //$NON-NLS-1$
public static final String IMG_WIZBAN_ADD_SOURCE = NAME_PREFIX + "addsrcloc_wiz.gif"; //$NON-NLS-1$
public static final String IMG_WIZBAN_PATH_MAPPING = NAME_PREFIX + "mapping_wiz.gif"; //$NON-NLS-1$
@ -215,6 +217,7 @@ public class CDebugImages {
public static final ImageDescriptor DESC_LCL_COLLAPSE_ALL = createManaged(T_ELCL, IMG_LCL_COLLAPSE_ALL);
public static final ImageDescriptor DESC_LCL_COLLAPSE_ALL_DISABLED = createManaged(T_DLCL, IMG_LCL_COLLAPSE_ALL);
public static final ImageDescriptor DESC_LCL_OPEN_NEW_VIEW = createManaged(T_ELCL, IMG_LCL_OPEN_NEW_VIEW);
public static final ImageDescriptor DESC_LCL_PIN_VIEW = createManaged(T_ELCL, IMG_LCL_PIN_VIEW);
/**
* Returns the image managed under the given key in this registry.

View file

@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.cdt.visualizer.core,
org.eclipse.cdt.visualizer.ui,
org.eclipse.debug.ui,
org.eclipse.cdt.core
org.eclipse.cdt.core,
org.eclipse.cdt.debug.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.ibm.icu.text

View file

@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2012, 2013 Tilera Corporation and others.
# Copyright (c) 2012, 2014 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
@ -9,6 +9,7 @@
# William R. Swanson (Tilera Corporation)
# Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
# Marc Dumais (Ericsson) - Bug 405390
# Marc Dumais (Ericsson) - Bug 441713
# =============================================================================
# -----------------------------------------------------------------------------
@ -36,6 +37,10 @@ MulticoreVisualizer.actions.LoadMetersRefreshSubSubmenu.text=Refresh Speed
MulticoreVisualizer.actions.ClearFilter.text=Clear filter
MulticoreVisualizer.actions.SetFilter.text=Filter to selection
MulticoreVisualizer.actions.PinToDebugSession.text=Pin view to debug session
MulticoreVisualizer.actions.PinToDebugSession.description=Pin this view to the current debug session
MulticoreVisualizer.view.CanvasFilter.Active.text=Filter Active:
MulticoreVisualizer.view.CanvasFilter.cpu.text=CPUs:
MulticoreVisualizer.view.CanvasFilter.core.text=Cores:

View file

@ -0,0 +1,76 @@
/*******************************************************************************
* Copyright (c) 2014 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 Dumais (Ericsson) - Initial API and implementation (Bug 441713)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
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;
/** Pins the multicore visualizer to the current debug session */
public class PinToDebugSessionAction extends VisualizerAction {
// --- members ---
/** current active state of pinning */
private boolean m_pinActive;
/** Visualizer instance we're associated with. */
MulticoreVisualizer m_visualizer = null;
// --- constructors/destructors ---
/** Constructor. */
public PinToDebugSessionAction() {
super(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.PinToDebugSession.text"), //$NON-NLS-1$
MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.PinToDebugSession.description"), //$NON-NLS-1$
CDebugImages.DESC_LCL_PIN_VIEW
);
// at first, this action is disabled (un-pinned)
setChecked(false);
m_pinActive = false;
}
/** 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() {
// Toggle pinned state
m_pinActive = !m_pinActive;
if (m_pinActive) {
m_visualizer.pin();
}
else {
m_visualizer.unpin();
}
}
}

View file

@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright (c) 2014 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 Dumais (Ericsson) - Initial API and implementation (Bug 441713)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
/** Interface for pinnable objects */
public interface IPinnable {
/**
* Pins to the current context
*/
public void pin();
/**
* Unpins
*/
public void unpin();
/** Returns whether currently pinned */
public boolean isPinned();
}

View file

@ -17,6 +17,7 @@
* Marc-Andre Laperle (Ericsson) - Bug 411634
* Marc Dumais (Ericsson) - Bug 409965
* Xavier Raynaud (kalray) - Bug 431935
* Marc Dumais (Ericsson) - Bug 441713
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
@ -37,6 +38,7 @@ import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.EnableLoadMetersAction;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.FilterCanvasAction;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.PinToDebugSessionAction;
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.actions.SetLoadMeterPeriodAction;
@ -95,7 +97,7 @@ import org.eclipse.swt.widgets.Composite;
*/
@SuppressWarnings("restriction")
public class MulticoreVisualizer extends GraphicCanvasVisualizer
implements DSFDebugModelListener
implements DSFDebugModelListener, IPinnable
{
// --- constants ---
@ -158,6 +160,9 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
private static final int LOAD_METER_TIMER_MEDIUM = 1000;
private static final int LOAD_METER_TIMER_SLOW = 5000;
/** Currently pinned session id, if any */
private String m_currentPinedSessionId = null;
// --- UI members ---
@ -210,6 +215,9 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
/** Menu action */
FilterCanvasAction m_clearFilterAction = null;
/** Menu action */
PinToDebugSessionAction m_pinToDbgSessionAction = null;
// --- constructors/destructors ---
@ -456,6 +464,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
m_clearFilterAction.init(this);
m_clearFilterAction.setEnabled(false);
m_pinToDbgSessionAction = new PinToDebugSessionAction();
m_pinToDbgSessionAction.init(this);
m_pinToDbgSessionAction.setEnabled(false);
// Note: debug view may not be initialized at startup,
// so we'll pretend the actions are not yet updated,
// and reinitialize them later.
@ -481,6 +493,9 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
// show the load meter refresh speed sub-menu only
// if the load meters are enabled
m_loadMetersRefreshSubSubmenu.setVisible(m_loadMetersEnabled);
// Enable pinning menu item when there is a current debug session
m_pinToDbgSessionAction.setEnabled(m_sessionState != null);
// We should not change the enablement of the debug view
// actions, as they are automatically enabled/disabled
@ -572,6 +587,11 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
m_clearFilterAction.dispose();
m_clearFilterAction = null;
}
if (m_pinToDbgSessionAction != null) {
m_pinToDbgSessionAction.dispose();
m_pinToDbgSessionAction = null;
}
m_actionsInitialized = false;
}
@ -596,6 +616,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
toolBarManager.add(m_stepOverAction);
toolBarManager.add(m_stepIntoAction);
toolBarManager.add(m_dropToFrameAction);
toolBarManager.add(m_pinToDbgSessionAction);
updateActions();
}
@ -862,7 +883,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
}
else { // thread
VisualizerThread thread = model.getThread(tid);
if (thread != null) {
// here "tid" is the "GDB thread id", which is not
// unique across sessions, so make sure the thread
// belongs to the correct process, before selecting it
if (thread != null && thread.getPID() == pid) {
selected.add(thread);
}
}
@ -875,6 +899,39 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
return visualizerSelection;
}
// --- IPinnable implementation ---
/**
* Pins the multicore visualizer to the current debug session, preventing
* it from switching to a different session.
*/
@Override
public void pin() {
// No current session - do nothing
if (m_sessionState == null)
return;
m_currentPinedSessionId = m_sessionState.getSessionID();
}
/**
* Unpins the visualizer.
*/
@Override
public void unpin() {
m_currentPinedSessionId = null;
// force visualizer to re-evaluate its current session and
// display the correct one, if needed
workbenchSelectionChanged(null);
}
/** Returns whether the MV is currently pinned to a session */
@Override
public boolean isPinned() {
return m_currentPinedSessionId != null;
}
// --- DSF Context Management ---
@ -883,6 +940,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
*/
public boolean updateDebugContext()
{
// is the visualizer pinned? Then inhibit context change
if (isPinned())
return false;
String sessionId = null;
IAdaptable debugContext = DebugUITools.getDebugContext();
if (debugContext instanceof IDMVMContext) {

View file

@ -279,6 +279,14 @@ public class VisualizerView
else if (source == this) {
// Do nothing.
}
// if the source is another instance of VisualizerView
// it's a selection in another (cloned) view. The
// workbench selection has or will be updated by the
// instance of the view where the selection originated,
// so no need to do anything
else if (source.getClass() == VisualizerView.class) {
// Do nothing.
}
// else this is a selection change from some other view
// in the workbench, which we should pass down to the viewer
else {