mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 460476 - [visualizer] make showing debug actions in toolbar
configurable Change-Id: I860a0268c727f482fcc136031f8bd0cc11315831
This commit is contained in:
parent
d38aa32296
commit
9105e2d42c
3 changed files with 123 additions and 10 deletions
|
@ -10,6 +10,7 @@
|
|||
# Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
|
||||
# Marc Dumais (Ericsson) - Bug 405390
|
||||
# Marc Dumais (Ericsson) - Bug 441713
|
||||
# Marc Dumais (Ericsson) - Bug 460476
|
||||
# =============================================================================
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -41,6 +42,9 @@ 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.actions.ShowDebugToolbar.text=Show Debug Toolbar
|
||||
MulticoreVisualizer.actions.ShowDebugToolbar.description=Shows/hides the debug actions from the visualizer toolbar
|
||||
|
||||
MulticoreVisualizer.view.CanvasFilter.Active.text=Filter Active:
|
||||
MulticoreVisualizer.view.CanvasFilter.cpu.text=CPUs:
|
||||
MulticoreVisualizer.view.CanvasFilter.core.text=Cores:
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 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 460476)
|
||||
*******************************************************************************/
|
||||
|
||||
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.dsf.gdb.multicorevisualizer.internal.utils.PersistentSettingsManager;
|
||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.PersistentSettingsManager.PersistentParameter;
|
||||
import org.eclipse.cdt.visualizer.ui.VisualizerAction;
|
||||
import org.eclipse.jface.action.Action;
|
||||
|
||||
/** Actions that shows/hides the debug actions on the Multicore Visualizer toolbar */
|
||||
public class ShowDebugToolbarAction extends VisualizerAction {
|
||||
// --- members ---
|
||||
|
||||
/** Visualizer instance we're associated with. */
|
||||
private MulticoreVisualizer m_visualizer;
|
||||
|
||||
/** persistent settings manager */
|
||||
private PersistentSettingsManager m_persistentSettingsManager;
|
||||
|
||||
/** Persistent parameter that remembers if the debug actions should be shown or not */
|
||||
private PersistentParameter<Boolean> m_showDebugActions;
|
||||
|
||||
// --- constructors/destructors ---
|
||||
|
||||
/** Constructor.
|
||||
* @param showDebugActions : show the debug actions by default
|
||||
* @param MVInstanceId : id that uniquely identifies a Multicore Visualizer instance
|
||||
*/
|
||||
public ShowDebugToolbarAction(boolean showDebugActions, String MVInstanceId)
|
||||
{
|
||||
super(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.ShowDebugToolbar.text"), Action.AS_CHECK_BOX); //$NON-NLS-1$
|
||||
setDescription(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.ShowDebugToolbar.description")); //$NON-NLS-1$
|
||||
|
||||
m_persistentSettingsManager = new PersistentSettingsManager("ShowDebugToolbarAction", MVInstanceId); //$NON-NLS-1$
|
||||
m_showDebugActions = m_persistentSettingsManager.getNewParameter(Boolean.class,
|
||||
"showDebugActionsInMVToolbar", true, showDebugActions); //$NON-NLS-1$
|
||||
|
||||
// Set initial state
|
||||
this.setChecked(m_showDebugActions.value());
|
||||
}
|
||||
|
||||
/** 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_showDebugActions.set(isChecked());
|
||||
// trigger refresh of canvas
|
||||
m_visualizer.raiseVisualizerChangedEvent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
* Alvaro Sanchez-Leon (Ericsson) - Bug 459114 - override construction of the data model
|
||||
* Marc Dumais (Ericsson) - Bug 460737
|
||||
* Marc Dumais (Ericsson) - Bug 460837
|
||||
* Marc Dumais (Ericsson) - Bug 460476
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
|
||||
|
@ -53,6 +54,7 @@ import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.PinToDebu
|
|||
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;
|
||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.ShowDebugToolbarAction;
|
||||
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;
|
||||
|
@ -116,7 +118,6 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
|
||||
/** Eclipse ID for this view */
|
||||
public static final String ECLIPSE_ID = "org.eclipse.cdt.dsf.gdb.multicorevisualizer.visualizer"; //$NON-NLS-1$
|
||||
|
||||
|
||||
// --- members ---
|
||||
|
||||
|
@ -179,6 +180,9 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
/** constant for the long load meters update period */
|
||||
private static final int LOAD_METER_TIMER_SLOW = 5000;
|
||||
|
||||
/** Whether to show debug actions in toolbar, by default */
|
||||
private static final boolean SHOW_DEBUG_ACTIONS_IN_MV_TOOLBAR_DEFAULT = true;
|
||||
|
||||
/** Currently pinned session id, if any */
|
||||
private String m_currentPinedSessionId = null;
|
||||
|
||||
|
@ -239,6 +243,9 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
/** Menu action */
|
||||
protected PinToDebugSessionAction m_pinToDbgSessionAction = null;
|
||||
|
||||
/** Menu action */
|
||||
protected ShowDebugToolbarAction m_showDebugToolbarAction = null;
|
||||
|
||||
/** persistent settings manager */
|
||||
protected PersistentSettingsManager m_persistentSettingsManager = null;
|
||||
|
||||
|
@ -530,6 +537,12 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
m_pinToDbgSessionAction.init(this);
|
||||
m_pinToDbgSessionAction.setEnabled(false);
|
||||
|
||||
// default: do not show debug actions
|
||||
m_showDebugToolbarAction = new ShowDebugToolbarAction(SHOW_DEBUG_ACTIONS_IN_MV_TOOLBAR_DEFAULT,
|
||||
m_visualizerInstanceId);
|
||||
m_showDebugToolbarAction.init(this);
|
||||
m_showDebugToolbarAction.setEnabled(true);
|
||||
|
||||
// Note: debug view may not be initialized at startup,
|
||||
// so we'll pretend the actions are not yet updated,
|
||||
// and reinitialize them later.
|
||||
|
@ -657,7 +670,12 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
m_pinToDbgSessionAction.dispose();
|
||||
m_pinToDbgSessionAction = null;
|
||||
}
|
||||
|
||||
|
||||
if (m_showDebugToolbarAction != null) {
|
||||
m_showDebugToolbarAction.dispose();
|
||||
m_showDebugToolbarAction = null;
|
||||
}
|
||||
|
||||
m_actionsInitialized = false;
|
||||
}
|
||||
|
||||
|
@ -675,16 +693,19 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
// note: if in the future we want to display the debug buttons even
|
||||
// when pinned, all that needs to be done it to remove this check.
|
||||
if (!m_pinToDbgSessionAction.isChecked()) {
|
||||
toolBarManager.add(m_resumeAction);
|
||||
toolBarManager.add(m_suspendAction);
|
||||
toolBarManager.add(m_terminateAction);
|
||||
// only show the debug actions in toolbar, if configured to do so
|
||||
if (m_showDebugToolbarAction.isChecked()) {
|
||||
toolBarManager.add(m_resumeAction);
|
||||
toolBarManager.add(m_suspendAction);
|
||||
toolBarManager.add(m_terminateAction);
|
||||
|
||||
toolBarManager.add(m_separatorAction);
|
||||
toolBarManager.add(m_separatorAction);
|
||||
|
||||
toolBarManager.add(m_stepReturnAction);
|
||||
toolBarManager.add(m_stepOverAction);
|
||||
toolBarManager.add(m_stepIntoAction);
|
||||
toolBarManager.add(m_dropToFrameAction);
|
||||
toolBarManager.add(m_stepReturnAction);
|
||||
toolBarManager.add(m_stepOverAction);
|
||||
toolBarManager.add(m_stepIntoAction);
|
||||
toolBarManager.add(m_dropToFrameAction);
|
||||
}
|
||||
}
|
||||
toolBarManager.add(m_pinToDbgSessionAction);
|
||||
|
||||
|
@ -697,6 +718,8 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
{
|
||||
// initialize menu/toolbar actions, if needed
|
||||
createActions();
|
||||
|
||||
menuManager.add(m_showDebugToolbarAction);
|
||||
|
||||
// TODO: Anything we want to hide on the toolbar menu?
|
||||
updateActions();
|
||||
|
@ -1008,6 +1031,8 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
return;
|
||||
|
||||
m_currentPinedSessionId = m_sessionState.getSessionID();
|
||||
|
||||
m_showDebugToolbarAction.setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1019,6 +1044,8 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPin
|
|||
// force visualizer to re-evaluate its current session and
|
||||
// display the correct one, if needed
|
||||
workbenchSelectionChanged(null);
|
||||
|
||||
m_showDebugToolbarAction.setEnabled(true);
|
||||
}
|
||||
|
||||
/** Returns whether the MV is currently pinned to a session */
|
||||
|
|
Loading…
Add table
Reference in a new issue