diff options
author | Pawel Piech | 2011-09-22 18:38:48 +0000 |
---|---|---|
committer | Pawel Piech | 2011-09-22 18:38:48 +0000 |
commit | 472eea319d490fe2300465bfcde19fce457b9724 (patch) | |
tree | 6102a28637371ed00d98d6c978296871c3836e64 | |
parent | 6f8daed33c35a3d295bf9597db71a0e0c81894bd (diff) | |
download | eclipse.platform.debug-472eea319d490fe2300465bfcde19fce457b9724.tar.gz eclipse.platform.debug-472eea319d490fe2300465bfcde19fce457b9724.tar.xz eclipse.platform.debug-472eea319d490fe2300465bfcde19fce457b9724.zip |
Bug 258767 - [debug view][menu] support for top level debug toolbarv20110922-1838
24 files changed, 818 insertions, 25 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF index 86a32d2bc..fbb62c8ac 100644 --- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.debug.ui; singleton:=true -Bundle-Version: 3.7.200.qualifier +Bundle-Version: 3.8.0.qualifier Bundle-Activator: org.eclipse.debug.internal.ui.DebugUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index 2d8faf443..aeb1c2497 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2010 IBM Corporation and others. +# Copyright (c) 2000, 2011 IBM 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 @@ -10,6 +10,7 @@ # QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640) # Wind River Systems - Pawel Piech - Added Modules view (bug 211158) # Wind River Systems - Ted Williams -[Memory View] Memory View: Workflow Enhancements (bug 215432) +# Patrick Chuong (Texas Instruments) - Move debug toolbar actions to main window (Bug 332784) ############################################################################### pluginName=Debug UI @@ -51,6 +52,7 @@ CopyVariablesToClipboardAction.label=Copy &Variables CopyExpressionsToClipboardAction.label=Copy &Expressions CopyRegistersToClipboardAction.label=Copy &Registers DebugActionSet.label=Debug +DebugToolbarActionSet.label=Debug Toolbar debugCurrentInstructionPointer=Debug Current Instruction Pointer debugCallStack=Debug Call Stack DebugDropDownAction.label=Debug @@ -129,6 +131,8 @@ StepReturnAction.label=Step Ret&urn StringVariablePresentationsName=String Variable Presentations SuspendAction.label=&Suspend TerminateAction.label=&Terminate +DropToFrame.label=Drop To Frame +Disconnect.label=Disconnect ToggleBreakpointAction.label=Toggle Brea&kpoint ToggleBreakpointsTargetFactoriesExtension.name=Toggle Breakpoints Target Factories ToggleLineBreakpointAction.label=Toggle &Line Breakpoint @@ -219,6 +223,12 @@ ActionDefinition.toggleBreakpoint.description=Creates or removes a breakpoint ActionDefinition.suspend.name=Suspend ActionDefinition.suspend.description=Suspend +ActionDefinition.dropToFrame.name=Drop to Frame +ActionDefinition.dropToFrame.description=Drop to Frame + +ActionDefinition.disconnect.name=Disconnect +ActionDefinition.disconnect.description=Disconnect + ActionDefinition.openProfile.name=Profile... ActionDefinition.openProfile.description=Open profile launch configuration dialog diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 6357bba15..81374c03b 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -10,6 +10,7 @@ Contributors: IBM Corporation - initial API and implementation Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956) + Patrick Chuong (Texas Instruments) - Move debug toolbar actions to main window (Bug 332784) --> <plugin> @@ -329,7 +330,6 @@ id="org.eclipse.debug.ui.actions.StepOver" hoverIcon="$nl$/icons/full/elcl16/stepover_co.gif" class="org.eclipse.debug.internal.ui.commands.actions.StepOverCommandActionDelegate" - definitionId="org.eclipse.debug.ui.commands.StepOver" disabledIcon="$nl$/icons/full/dlcl16/stepover_co.gif" icon="$nl$/icons/full/elcl16/stepover_co.gif" helpContextId="step_over_action_context" @@ -382,6 +382,111 @@ </action> </actionSet> <actionSet + label="%DebugToolbarActionSet.label" + visible="false" + id="org.eclipse.debug.ui.debugToolbarActionSet"> + <action + id="org.eclipse.debug.ui.actions.toolbar.ToggleStepFilters" + hoverIcon="$nl$/icons/full/elcl16/stepbystep_co.gif" + class="org.eclipse.debug.internal.ui.commands.actions.ToggleStepFiltersCommandActionDelegate" + disabledIcon="$nl$/icons/full/dlcl16/stepbystep_co.gif" + icon="$nl$/icons/full/elcl16/stepbystep_co.gif" + helpContextId="step_with_filters_action_context" + label="%StepWithFiltersAction.label" + style="toggle" + state="false" + toolbarPath="org.eclipse.debug.ui.main.toolbar/renderGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.DropToFrame" + hoverIcon="$nl$/icons/full/elcl16/drop_to_frame.gif" + class="org.eclipse.debug.internal.ui.commands.actions.DropToFrameCommandActionDelegate" + helpContextId="drop_to_frame_action_context" + icon="$nl$/icons/full/elcl16/drop_to_frame.gif" + label="%DropToFrame.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/emptyStepGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.RunToLine" + class="org.eclipse.debug.internal.ui.actions.RetargetRunToLineAction" + helpContextId="run_to_line_action_context" + disabledIcon="$nl$/icons/full/dlcl16/runtoline_co.gif" + icon="$nl$/icons/full/elcl16/runtoline_co.gif" + label="%RunToLine.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/emptyStepGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.StepReturn" + hoverIcon="$nl$/icons/full/elcl16/stepreturn_co.gif" + class="org.eclipse.debug.internal.ui.commands.actions.StepReturnCommandActionDelegate" + disabledIcon="$nl$/icons/full/dlcl16/stepreturn_co.gif" + icon="$nl$/icons/full/elcl16/stepreturn_co.gif" + helpContextId="step_return_action_context" + label="%StepReturnAction.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/stepReturnGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.StepOver" + hoverIcon="$nl$/icons/full/elcl16/stepover_co.gif" + class="org.eclipse.debug.internal.ui.commands.actions.StepOverCommandActionDelegate" + disabledIcon="$nl$/icons/full/dlcl16/stepover_co.gif" + icon="$nl$/icons/full/elcl16/stepover_co.gif" + helpContextId="step_over_action_context" + label="%StepOverAction.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/stepOverGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.StepInto" + hoverIcon="$nl$/icons/full/elcl16/stepinto_co.gif" + class="org.eclipse.debug.internal.ui.commands.actions.StepIntoCommandActionDelegate" + disabledIcon="$nl$/icons/full/dlcl16/stepinto_co.gif" + icon="$nl$/icons/full/elcl16/stepinto_co.gif" + helpContextId="step_into_action_context" + label="%StepIntoAction.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/stepIntoGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.Disconnect" + hoverIcon="$nl$/icons/full/elcl16/disconnect_co.gif" + class="org.eclipse.debug.internal.ui.commands.actions.DisconnectCommandActionDelegate" + disabledIcon="$nl$/icons/full/dlcl16/disconnect_co.gif" + icon="$nl$/icons/full/elcl16/disconnect_co.gif" + helpContextId="disconnect_action_context" + label="%Disconnect.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.Terminate" + hoverIcon="$nl$/icons/full/elcl16/terminate_co.gif" + class="org.eclipse.debug.internal.ui.commands.actions.TerminateCommandActionDelegate" + disabledIcon="$nl$/icons/full/dlcl16/terminate_co.gif" + icon="$nl$/icons/full/elcl16/terminate_co.gif" + helpContextId="terminate_action_context" + label="%TerminateAction.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.Suspend" + hoverIcon="$nl$/icons/full/elcl16/suspend_co.gif" + class="org.eclipse.debug.internal.ui.commands.actions.SuspendCommandActionDelegate" + disabledIcon="$nl$/icons/full/dlcl16/suspend_co.gif" + icon="$nl$/icons/full/elcl16/suspend_co.gif" + helpContextId="suspend_action_context" + label="%SuspendAction.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup"> + </action> + <action + id="org.eclipse.debug.ui.actions.toolbar.Resume" + hoverIcon="$nl$/icons/full/elcl16/resume_co.gif" + class="org.eclipse.debug.internal.ui.commands.actions.ResumeCommandActionDelegate" + disabledIcon="$nl$/icons/full/dlcl16/resume_co.gif" + icon="$nl$/icons/full/elcl16/resume_co.gif" + helpContextId="resume_action_context" + label="%ResumeAction.label" + toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup"> + </action> + </actionSet> + <actionSet label="%LaunchActionSet.label" visible="false" id="org.eclipse.debug.ui.launchActionSet"> @@ -613,6 +718,41 @@ </dynamic> </menu> </menuContribution> + <menuContribution + locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> + <toolbar + id="org.eclipse.debug.ui.main.toolbar" + label="%DebugActionSet.label"> + <separator + name="threadGroup" + visible="true"> + </separator> + <separator + name="stepGroup" + visible="true"> + </separator> + <separator + name="stepIntoGroup" + visible="false"> + </separator> + <separator + name="stepOverGroup" + visible="false"> + </separator> + <separator + name="stepReturnGroup" + visible="false"> + </separator> + <separator + name="emptyStepGroup" + visible="false"> + </separator> + <separator + name="renderGroup" + visible="true"> + </separator> + </toolbar> + </menuContribution> </extension> <extension @@ -1622,37 +1762,57 @@ M4 = Platform-specific fourth key name="%ActionDefinition.toggleStepFilters.name" categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.toggleStepFilters.description" - id="org.eclipse.debug.ui.commands.ToggleStepFilters"> + id="org.eclipse.debug.ui.commands.ToggleStepFilters" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.ToggleStepFiltersCommandHandler"> + </command> + <command + categoryId="org.eclipse.debug.ui.category.run" + description="%ActionDefinition.dropToFrame.description" + id="org.eclipse.debug.ui.commands.DropToFrame" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.DropToFrameCommandHandler" + name="%ActionDefinition.dropToFrame.name"> + </command> + <command + categoryId="org.eclipse.debug.ui.category.run" + description="%ActionDefinition.disconnect.discrption" + id="org.eclipse.debug.ui.commands.Disconnect" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.DisconnectCommandHandler" + name="%ActionDefinition.disconnect.name"> </command> <command name="%ActionDefinition.stepInto.name" categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.stepInto.description" - id="org.eclipse.debug.ui.commands.StepInto"> + id="org.eclipse.debug.ui.commands.StepInto" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.StepIntoCommandHandler"> </command> <command - name="%ActionDefinition.stepOver.name" categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.stepOver.description" - id="org.eclipse.debug.ui.commands.StepOver"> + id="org.eclipse.debug.ui.commands.StepOver" + name="%ActionDefinition.stepOver.name" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.StepOverCommandHandler"> </command> <command name="%ActionDefinition.stepReturn.name" categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.stepReturn.description" - id="org.eclipse.debug.ui.commands.StepReturn"> + id="org.eclipse.debug.ui.commands.StepReturn" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.StepReturnCommandHandler"> </command> <command name="%ActionDefinition.resume.name" categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.resume.description" - id="org.eclipse.debug.ui.commands.Resume"> + id="org.eclipse.debug.ui.commands.Resume" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.ResumeCommandHandler"> </command> <command categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.terminate.description" helpContextId="terminate_action_context" id="org.eclipse.debug.ui.commands.Terminate" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.TerminateCommandHandler" name="%ActionDefinition.terminate.name"> </command> <command @@ -1675,7 +1835,8 @@ M4 = Platform-specific fourth key name="%ActionDefinition.suspend.name" categoryId="org.eclipse.debug.ui.category.run" description="%ActionDefinition.suspend.description" - id="org.eclipse.debug.ui.commands.Suspend"> + id="org.eclipse.debug.ui.commands.Suspend" + defaultHandler="org.eclipse.debug.internal.ui.commands.actions.SuspendCommandHandler"> </command> <command name="%ActionDefinition.openProfile.name" diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java index ace7df94b..d7361f3a4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM 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 @@ -75,6 +75,9 @@ public interface IDebugHelpContextIds { public static final String DEBUG_VIEW_MODE_FULL_ACTION = PREFIX + "debug_view_mode_full_action_context"; //$NON-NLS-1$ public static final String DEBUG_VIEW_MODE_COMPACT_ACTION = PREFIX + "debug_view_mode_compact_action_context"; //$NON-NLS-1$ public static final String DEBUG_VIEW_DROP_DOWN_AUTOEXPAND_ACTION = PREFIX + "debug_view_drop_down_autoexpand_action_context"; //$NON-NLS-1$ + public static final String DEBUG_TOOLBAR_VIEW_ACTION = PREFIX + "debug_toolbar_view_action_context"; //$NON-NLS-1$ + public static final String DEBUG_TOOLBAR_WINDOW_ACTION = PREFIX + "debug_toolbar_window_action_context"; //$NON-NLS-1$ + public static final String DEBUG_TOOLBAR_BOTH_ACTION = PREFIX + "debug_toolbar_both_action_context"; //$NON-NLS-1$ // Views public static final String DEBUG_VIEW = PREFIX + "debug_view_context"; //$NON-NLS-1$ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java index d62459817..5e09d35d1 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM 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 @@ -77,6 +77,11 @@ public class RetargetRunToLineAction extends RetargetAction { fContextListener.contextActivated(activeContext); } + public void init(IAction action) { + super.init(action); + action.setActionDefinitionId("org.eclipse.debug.ui.commands.RunToLine"); + } + /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.actions.RetargetAction#canPerformAction(java.lang.Object, org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart) */ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java index ce50c1338..3c784dc5d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM 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 @@ -49,6 +49,9 @@ public abstract class DebugCommandActionDelegate implements IWorkbenchWindowActi */ public void init(IAction action) { fDebugAction.setActionProxy(action); + + // Ensure that the key accelerator is shown in tool-tip + action.setActionDefinitionId(fDebugAction.getActionDefinitionId()); } /* diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandActionDelegate.java new file mode 100644 index 000000000..611e5d4dc --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandActionDelegate.java @@ -0,0 +1,24 @@ +/***************************************************************** + * Copyright (c) 2010, 2011 Texas Instruments 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: + * Patrick Chuong (Texas Instruments) - Move debug toolbar actions to main window (Bug 332784) + *****************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +/** + * Disconnect action delegate. + * + * @since 3.7 + */ +public class DisconnectCommandActionDelegate extends DebugCommandActionDelegate { + + public DisconnectCommandActionDelegate() { + super(); + setAction(new DisconnectCommandAction()); + } +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandHandler.java new file mode 100644 index 000000000..435e83f33 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.IDisconnectHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class DisconnectCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return IDisconnectHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandActionDelegate.java new file mode 100644 index 000000000..f5b2f0bee --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandActionDelegate.java @@ -0,0 +1,24 @@ +/***************************************************************** + * Copyright (c) 2010, 2011 Texas Instruments 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: + * Patrick Chuong (Texas Instruments) - Move debug toolbar actions to main window (Bug 332784) + *****************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +/** + * Drop to Frame action delegate. + * + * @since 3.7 + */ +public class DropToFrameCommandActionDelegate extends DebugCommandActionDelegate { + + public DropToFrameCommandActionDelegate() { + super(); + setAction(new DropToFrameCommandAction()); + } +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandHandler.java new file mode 100644 index 000000000..627de9126 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.IDisconnectHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class DropToFrameCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return IDisconnectHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandHandler.java new file mode 100644 index 000000000..af8c669cd --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.IResumeHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class ResumeCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return IResumeHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandHandler.java new file mode 100644 index 000000000..2158b1078 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.IStepIntoHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class StepIntoCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return IStepIntoHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java index 71a20406d..2412f03c3 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java @@ -11,6 +11,8 @@ package org.eclipse.debug.internal.ui.commands.actions; +import org.eclipse.jface.action.IAction; + /** * Step over action delegate. * @@ -23,5 +25,9 @@ public class StepOverCommandActionDelegate extends DebugCommandActionDelegate { setAction(new StepOverCommandAction()); } + public void init(IAction action) { + super.init(action); + } + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandHandler.java new file mode 100644 index 000000000..b93551ebf --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.IStepOverHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class StepOverCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return IStepOverHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandHandler.java new file mode 100644 index 000000000..df4274249 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.IStepReturnHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class StepReturnCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return IStepReturnHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandHandler.java new file mode 100644 index 000000000..2a162df08 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.ISuspendHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class SuspendCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return ISuspendHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandHandler.java new file mode 100644 index 000000000..2eeb01889 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.ITerminateHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class TerminateCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return ITerminateHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandHandler.java new file mode 100644 index 000000000..aad7dc919 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.IStepFiltersHandler; +import org.eclipse.debug.ui.actions.DebugCommandHandler; + +/** + * Default handler for command. It ensures that the keyboard accelerator works even + * if the menu action set is not enabled. + * + * @since 3.8 + */ +public class ToggleStepFiltersCommandHandler extends DebugCommandHandler { + + protected Class getCommandType() { + return IStepFiltersHandler.class; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java index 1de50d7e4..d829914c4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM 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 @@ -295,6 +295,13 @@ public interface IDebugPreferenceConstants { * @since 3.5 */ public static final String DEBUG_VIEW_BREADCRUMB_AUTO_EXPAND_DROP_DOWN = "org.eclispe.debug.ui.Debug_view.Breadcrumb.dropDownAutoexpand"; //$NON-NLS-1$ + + /** + * Perspectives in which the debug toolbar is hidden. + * + * @since 3.8 + */ + public static final String DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES = "org.eclispe.debug.ui.Debug_view.debug_toolbar_hidden_perspectives"; //$NON-NLS-1$ } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugToolBarAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugToolBarAction.java new file mode 100644 index 000000000..5def549c7 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugToolBarAction.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 IBM 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.views.launch; + +import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; +import org.eclipse.debug.internal.ui.IDebugHelpContextIds; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.action.Action; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; + +/** + * Action that controls whether Debug actions are shown in Launch view. + * + * @since 3.8 + */ +class DebugToolBarAction extends Action { + + private final LaunchView fLaunchView; + private final boolean fDebugViewToolbar; + private final boolean fDebugToolbarActionSet; + + /** + * Creates a new action to set the debug view mode. + * + * @param view Reference to the debug view. + * @param debugViewToolbar Causes action to show toolbar in Debug view. + * @param debugActionSet Causes action to show toolbar in top level Window + * toolbar.. + */ + public DebugToolBarAction(LaunchView view, boolean debugViewToolbar, boolean debugActionSet) { + super(IInternalDebugCoreConstants.EMPTY_STRING, AS_RADIO_BUTTON); + fLaunchView = view; + fDebugViewToolbar = debugViewToolbar; + fDebugToolbarActionSet = debugActionSet; + + if (fDebugViewToolbar && fDebugToolbarActionSet) { + setText(LaunchViewMessages.DebugToolBarAction_Both_label); + setToolTipText(LaunchViewMessages.DebugToolBarAction_Both_tooltip); + setDescription(LaunchViewMessages.DebugToolBarAction_Both_description); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_TOOLBAR_BOTH_ACTION); + } else if (fDebugViewToolbar) { + setText(LaunchViewMessages.DebugToolBarAction_View_label); + setToolTipText(LaunchViewMessages.DebugToolBarAction_View_tooltip); + setDescription(LaunchViewMessages.DebugToolBarAction_View_description); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_TOOLBAR_VIEW_ACTION); + } else if (fDebugToolbarActionSet) { + setText(LaunchViewMessages.DebugToolBarAction_Window_label); + setToolTipText(LaunchViewMessages.DebugToolBarAction_Window_tooltip); + setDescription(LaunchViewMessages.DebugToolBarAction_Window_description); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_TOOLBAR_WINDOW_ACTION); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + fLaunchView.setDebugToolbarInView(fDebugViewToolbar); + + IWorkbenchPage page = fLaunchView.getSite().getPage(); + + if (fDebugToolbarActionSet) { + page.showActionSet(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET); + } else { + page.hideActionSet(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET); + } + } + + /** + * @return Returns whether debug toolbar is shown in view by this action. + */ + public boolean getDebugViewToolbar() { + return fDebugViewToolbar; + } + + /** + * @return Returns whether debug toolbar action set is shown by this action. + */ + public boolean getDebugToolbarActionSet() { + return fDebugToolbarActionSet; + } +} + diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index 650e9c883..d017ca317 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -22,8 +22,12 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import org.eclipse.core.commands.IHandler2; +import org.eclipse.core.commands.contexts.ContextManagerEvent; +import org.eclipse.core.commands.contexts.IContextManagerListener; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -67,6 +71,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener; import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; import org.eclipse.debug.internal.ui.views.DebugModelPresentationContext; +import org.eclipse.debug.internal.ui.views.ViewContextService; import org.eclipse.debug.ui.AbstractDebugView; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugModelPresentation; @@ -76,6 +81,7 @@ import org.eclipse.debug.ui.contexts.AbstractDebugContextProvider; import org.eclipse.debug.ui.contexts.DebugContextEvent; import org.eclipse.debug.ui.contexts.IDebugContextListener; import org.eclipse.debug.ui.contexts.IDebugContextProvider; +import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; @@ -115,6 +121,7 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.XMLMemento; import org.eclipse.ui.actions.SelectionListenerAction; +import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.dialogs.PropertyDialogAction; import org.eclipse.ui.part.IPageBookViewPage; import org.eclipse.ui.part.IPageSite; @@ -126,7 +133,10 @@ import org.eclipse.ui.part.ShowInContext; import org.eclipse.ui.progress.IWorkbenchSiteProgressService; import org.eclipse.ui.progress.UIJob; -public class LaunchView extends AbstractDebugView implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IShowInTarget, IShowInSource, IShowInTargetList, IPartListener2, IViewerUpdateListener { +public class LaunchView extends AbstractDebugView + implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IShowInTarget, IShowInSource, + IShowInTargetList, IPartListener2, IViewerUpdateListener, IContextManagerListener +{ public static final String ID_CONTEXT_ACTIVITY_BINDINGS = "contextActivityBindings"; //$NON-NLS-1$ @@ -194,6 +204,10 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi private DebugViewModeAction[] fDebugViewModeActions; /** + */ + private DebugToolBarAction[] fDebugToolBarActions; + + /** * Action that controls the breadcrumb drop-down auto-expand behavior. * * @since 3.5 @@ -201,6 +215,14 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi private BreadcrumbDropDownAutoExpandAction fBreadcrumbDropDownAutoExpandAction; /** + * Context service for this view. Used to track whether debug toolbar + * action set is active. + * + * @since 3.8 + */ + private IContextService fContextService; + + /** * Preference name for the view's memento. * * @since 3.5 @@ -214,7 +236,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi * @since 3.5 */ private static final String BREADCRUMB_DROPDOWN_AUTO_EXPAND = DebugUIPlugin.getUniqueIdentifier() + ".BREADCRUMB_DROPDOWN_AUTO_EXPAND"; //$NON-NLS-1$ - + /** * Preference for whether the elements in breadcrumb's * drop-down viewer should be automatically expanded. @@ -230,6 +252,10 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi */ private Map fHandlers = new HashMap(); + private boolean fDebugToolbarInView = true; + + private Set fDebugToolbarHiddenPerspectives = new TreeSet(); + /** * Page-book page for the breadcrumb viewer. This page is activated in * Debug view when the height of the view is reduced to just one line. @@ -604,6 +630,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi fDebugViewModeActions[i].setChecked(fDebugViewModeActions[i].getMode().equals(mode)); } + createDebugToolBarInViewActions(parent); + // Add a resize listener for the view to activate breadcrumb as needed. parent.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { @@ -617,6 +645,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi } } }); + + fContextService.addContextManagerListener(this); } /** @@ -705,7 +735,6 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi modeSubmenu.add(new Separator()); modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction); viewMenu.add(modeSubmenu); - viewMenu.add(new Separator()); modeSubmenu.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { @@ -716,10 +745,42 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction); } }); + } + + /** + * Creates actions for controlling view mode. + * + * @param parent The view's parent control used to calculate view size + * in auto mode. + */ + private void createDebugToolBarInViewActions(final Composite parent) { + IActionBars actionBars = getViewSite().getActionBars(); + IMenuManager viewMenu = actionBars.getMenuManager(); + + fDebugToolBarActions = new DebugToolBarAction[3]; + fDebugToolBarActions[0] = new DebugToolBarAction(this, true, false); + fDebugToolBarActions[1] = new DebugToolBarAction(this, false, true); + fDebugToolBarActions[2] = new DebugToolBarAction(this, true, true); + + final MenuManager modeSubmenu = new MenuManager(LaunchViewMessages.LaunchView_ToolBarMenu_label); + modeSubmenu.setRemoveAllWhenShown(true); + modeSubmenu.add(fDebugToolBarActions[0]); + modeSubmenu.add(fDebugToolBarActions[1]); + modeSubmenu.add(fDebugToolBarActions[2]); + viewMenu.add(modeSubmenu); + + modeSubmenu.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + modeSubmenu.add(fDebugToolBarActions[0]); + modeSubmenu.add(fDebugToolBarActions[1]); + modeSubmenu.add(fDebugToolBarActions[2]); + } + }); + updateCheckedDebugToolBarAction(); } - + /** * Sets the current view mode. If needed, the active view page is changed. * @@ -858,6 +919,14 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi setBreadcrumbDropDownAutoExpand(auto.booleanValue()); } } + + String preference = DebugUIPlugin.getDefault().getPreferenceStore().getString( + IDebugPreferenceConstants.DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES); + if (preference != null) { + fDebugToolbarHiddenPerspectives = ViewContextService.parseList(preference); + } + IPerspectiveDescriptor perspective = getSite().getPage().getPerspective(); + fDebugToolbarInView = perspective == null || !fDebugToolbarHiddenPerspectives.contains(perspective.getId()); } /* (non-Javadoc) @@ -867,6 +936,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi super.init(site); commonInit(site); preferenceInit(site); + fContextService = (IContextService)site.getService(IContextService.class); } /* (non-Javadoc) @@ -876,6 +946,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi super.init(site, memento); commonInit(site); preferenceInit(site); + fContextService = (IContextService)site.getService(IContextService.class); } /* (non-Javadoc) @@ -904,6 +975,13 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi } } } + + StringBuffer buffer= new StringBuffer(); + for (Iterator itr = fDebugToolbarHiddenPerspectives.iterator(); itr.hasNext();) { + buffer.append(itr.next()).append(','); + } + getPreferenceStore().setValue(IDebugPreferenceConstants.DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES, buffer.toString()); + super.partDeactivated(part); } @@ -926,7 +1004,13 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi tbm.add(new GroupMarker(IDebugUIConstants.STEP_RETURN_GROUP)); tbm.add(new GroupMarker(IDebugUIConstants.EMPTY_STEP_GROUP)); tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP)); - + + if (fDebugToolbarInView) { + addDebugToolbarActions(tbm); + } + } + + protected void addDebugToolbarActions(IToolBarManager tbm) { tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESUME)); tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND)); tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE)); @@ -935,16 +1019,75 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi tbm.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO)); tbm.appendToGroup(IDebugUIConstants.STEP_OVER_GROUP, getAction(STEP_OVER)); tbm.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN)); - + tbm.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME)); tbm.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS)); - } - + } + + /** + * Removes the toolbar actions contributed by this view from the toolbar + * manager. + * @param tbm + */ + protected void removeDebugToolbarActions(IToolBarManager tbm) { + tbm.remove(new ActionContributionItem(getAction(RESUME))); + tbm.remove(new ActionContributionItem(getAction(SUSPEND))); + tbm.remove(new ActionContributionItem(getAction(TERMINATE))); + tbm.remove(new ActionContributionItem(getAction(DISCONNECT))); + + tbm.remove(new ActionContributionItem(getAction(STEP_INTO))); + tbm.remove(new ActionContributionItem(getAction(STEP_OVER))); + tbm.remove(new ActionContributionItem(getAction(STEP_RETURN))); + + tbm.remove(new ActionContributionItem(getAction(DROP_TO_FRAME))); + + tbm.remove(new ActionContributionItem(getAction(TOGGLE_STEP_FILTERS))); + } + + public boolean isDebugToolbarInView() { + return fDebugToolbarInView; + } + + public boolean isDebugToolbarInViewInPerspective(IPerspectiveDescriptor perspective) { + return perspective == null || !fDebugToolbarHiddenPerspectives.contains(perspective.getId()); + } + + public void setDebugToolbarInView(boolean show) { + if (show == isDebugToolbarInView()) { + return; + } + fDebugToolbarInView = show; + + // Update the perspectives set. + IPerspectiveDescriptor perspective = getSite().getPage().getPerspective(); + if (perspective != null) { + if (show) { + fDebugToolbarHiddenPerspectives.remove(perspective.getId()); + } else { + fDebugToolbarHiddenPerspectives.add(perspective.getId()); + } + } + + // Update the toolbar manager. + IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager(); + if (show) { + addDebugToolbarActions(tbm); + } else { + removeDebugToolbarActions(tbm); + } + getViewSite().getActionBars().updateActionBars(); + + // Update system property used by contributed actions. + System.setProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE, Boolean.toString(show)); + } + + /* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchPart#dispose() */ public void dispose() { + fContextService.removeContextManagerListener(this); getSite().getSelectionProvider().removeSelectionChangedListener(this); DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextProvider(fContextProviderProxy); fContextProviderProxy.dispose(); @@ -1024,6 +1167,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { setActive(page.findView(getSite().getId()) != null); updateObjects(); + setDebugToolbarInView( isDebugToolbarInViewInPerspective(getSite().getPage().getPerspective()) ); + updateCheckedDebugToolBarAction(); } /* (non-Javadoc) @@ -1125,6 +1270,28 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi menu.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS)); } + public void contextManagerChanged(ContextManagerEvent event) { + if (event.isActiveContextsChanged()) { + Set oldContexts = event.getPreviouslyActiveContextIds(); + Set newContexts = event.getContextManager().getActiveContextIds(); + if (oldContexts.contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET) != + newContexts.contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET)) + { + updateCheckedDebugToolBarAction(); + } + } + } + + private void updateCheckedDebugToolBarAction() { + boolean debugToolBarInView = isDebugToolbarInView(); + boolean toolbarActionSetActive = fContextService.getActiveContextIds().contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET); + for (int i = 0; i < fDebugToolBarActions.length; i++) { + fDebugToolBarActions[i].setChecked( + fDebugToolBarActions[i].getDebugViewToolbar() == debugToolBarInView && + fDebugToolBarActions[i].getDebugToolbarActionSet() == toolbarActionSetActive); + } + } + /** * Updates the enabled state of the given action based on the selection * and adds to the menu if enabled. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java index a33ae0f8a..11bfe0451 100755 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM 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 @@ -32,6 +32,17 @@ public class LaunchViewMessages extends NLS { public static String BreadcrumbDropDownAutoExpandAction_tooltip; public static String BreadcrumbDropDownAutoExpandAction_description; + public static String LaunchView_ToolBarMenu_label; + public static String DebugToolBarAction_View_label; + public static String DebugToolBarAction_View_tooltip; + public static String DebugToolBarAction_View_description; + public static String DebugToolBarAction_Window_label; + public static String DebugToolBarAction_Window_tooltip; + public static String DebugToolBarAction_Window_description; + public static String DebugToolBarAction_Both_label; + public static String DebugToolBarAction_Both_tooltip; + public static String DebugToolBarAction_Both_description; + static { // load message values from bundle file NLS.initializeMessages(BUNDLE_NAME, LaunchViewMessages.class); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties index 839f9b775..799bb32c2 100755 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2009 IBM Corporation and others. +# Copyright (c) 2000, 2011 IBM 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 @@ -25,3 +25,15 @@ DebugViewModeAction_Compact_description=Always show the breadcrumb viewer BreadcrumbDropDownAutoExpandAction_label=Auto-&Expand Breadcrumb BreadcrumbDropDownAutoExpandAction_tooltip=Auto-Expand Breadcrumb BreadcrumbDropDownAutoExpandAction_description=In the breadcrumb drop-down, automatically expand elements to reveal full selection in view. + +LaunchView_ToolBarMenu_label=&Debug Toolbar +DebugToolBarAction_View_label=&Debug View +DebugToolBarAction_View_tooltip=Debug View +DebugToolBarAction_View_description=Show debug actions in Debug view toolbar +DebugToolBarAction_Window_label=&Main Toolbar +DebugToolBarAction_Window_tooltip=Main Toolbar +DebugToolBarAction_Window_description=Show debug action in the Window's main toolbar +DebugToolBarAction_Both_label=&Both +DebugToolBarAction_Both_tooltip=Both +DebugToolBarAction_Both_description=Show debug actions in both toolbars + diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java index 013c4126b..7cdd455ea 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java @@ -612,7 +612,23 @@ public interface IDebugUIConstants { */ public static final String DEBUG_ACTION_SET= PLUGIN_ID + ".debugActionSet"; //$NON-NLS-1$ - + /** + * Debug Toolbar action set identifier (value <code>"org.eclipse.debug.ui.debugToolbarActionSet"</code>). + * + * @since 3.8 + */ + public static final String DEBUG_TOOLBAR_ACTION_SET= PLUGIN_ID + ".debugToolbarActionSet"; //$NON-NLS-1$ + + /** + * System property which indicates whether the common debugging actions + * should be shown in the Debug view, as opposed to the top level + * toolbar. Actions contributing to the debug view can use this property + * to control their visibility. + * + * @since 3.8 + */ + public static final String DEBUG_VIEW_TOOBAR_VISIBLE = PLUGIN_ID + ".debugViewToolbarVisible"; //$NON-NLS-1$ + /** * Launch action set identifier (value <code>"org.eclipse.debug.ui.launchActionSet"</code>). */ |