Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Dumais2015-03-02 14:44:26 +0000
committerMarc Dumais2015-03-04 12:03:51 +0000
commit9105e2d42c94f77b2b25da75de0501e1cd1d8b0f (patch)
tree83865772f632b8e2bddc5aee6cef11fe05d6e9bc /dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui
parentd38aa3229672d7fd2a8cd4a28dae3cf52a77c816 (diff)
downloadorg.eclipse.cdt-9105e2d42c94f77b2b25da75de0501e1cd1d8b0f.tar.gz
org.eclipse.cdt-9105e2d42c94f77b2b25da75de0501e1cd1d8b0f.tar.xz
org.eclipse.cdt-9105e2d42c94f77b2b25da75de0501e1cd1d8b0f.zip
Bug 460476 - [visualizer] make showing debug actions in toolbar
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java82
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java51
3 files changed, 125 insertions, 12 deletions
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
index 030ad42477a..891e2170c91 100644
--- 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
@@ -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:
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java
new file mode 100644
index 00000000000..93456fae7e0
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/ShowDebugToolbarAction.java
@@ -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();
+ }
+ }
+}
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 15d2a195c9e..3e6d492ecc3 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
@@ -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);
-
- toolBarManager.add(m_separatorAction);
-
- toolBarManager.add(m_stepReturnAction);
- toolBarManager.add(m_stepOverAction);
- toolBarManager.add(m_stepIntoAction);
- toolBarManager.add(m_dropToFrameAction);
+ // 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_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 */

Back to the top