diff options
author | Sarika Sinha | 2014-10-08 09:10:12 +0000 |
---|---|---|
committer | Dani Megert | 2014-10-08 09:12:11 +0000 |
commit | 7a25e04d06eb13797a5e1ac0a61c9d48b30af179 (patch) | |
tree | 565bd5368efc9e99ab8096fb19551b68595c12b3 | |
parent | 67ab45167dc73f66adf47470532a7c71a3d3339f (diff) | |
download | eclipse.platform.debug-7a25e04d06eb13797a5e1ac0a61c9d48b30af179.tar.gz eclipse.platform.debug-7a25e04d06eb13797a5e1ac0a61c9d48b30af179.tar.xz eclipse.platform.debug-7a25e04d06eb13797a5e1ac0a61c9d48b30af179.zip |
Fixed bug 220657: [console][run control] Add Teminate All action in console view's context menuI20141008-1300
Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
4 files changed, 100 insertions, 6 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index 70a9f4d68..b1a4bd225 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2013 IBM Corporation and others. +# Copyright (c) 2000, 2014 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 @@ -138,6 +138,8 @@ ToggleBreakpointsTargetFactoriesExtension.name=Toggle Breakpoints Target Factori ToggleLineBreakpointAction.label=Toggle &Line Breakpoint ToggleMethodBreakpointAction.label=Toggle &Method Breakpoint ToggleWatchpointAction.label=Toggle &Watchpoint +TerminateAllAction.label=Termi&nate/Disconnect All +TerminateAllAction.tooltip=Terminate/Disconnect All BreakpointTypesMenu.label=B&reakpoint Types VariablesView.name=Variables VariableTextFontDefinition.label=Variable text font diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index e54c7e01c..fc6fa6d44 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <!-- - Copyright (c) 2005, 2013 IBM Corporation and others. + Copyright (c) 2005, 2014 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 @@ -1330,6 +1330,15 @@ id="org.eclipse.debug.ui.processConsoleContextMenu" targetID="org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu"> <action + class="org.eclipse.debug.internal.ui.commands.actions.TerminateAllActionDelegate" + helpContextId="terminate_all_action_context" + icon="$nl$/icons/full/elcl16/terminate_all_co.png" + id="org.eclipse.debug.ui.consoleTerminateAllAction" + label="%TerminateAllAction.label" + menubarPath="additions" + tooltip="%TerminateAllAction.tooltip"> + </action> + <action class="org.eclipse.debug.internal.ui.actions.RemoveAllTerminatedAction" helpContextId="console_remove_all_terminated_context" icon="$nl$/icons/full/elcl16/rem_all_co.png" diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java index f452460c1..7352f75dd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2014 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 @@ -23,6 +23,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; /** * Terminates all launches. @@ -42,9 +43,7 @@ public class TerminateAllAction extends DebugCommandAction implements ILaunchesL super.dispose(); } - @Override - public void init(IWorkbenchPart part) { - super.init(part); + private void attachSelfToLaunchManager() { ILaunchManager launchManager = getLaunchManager(); launchManager.addLaunchListener(this); // heuristic... rather than updating all the time, just assume there's @@ -104,6 +103,7 @@ public class TerminateAllAction extends DebugCommandAction implements ILaunchesL */ @Override public void launchesTerminated(ILaunch[] launches) { + setEnabled(getLaunchManager().getLaunches().length > 0); } /* (non-Javadoc) @@ -128,4 +128,21 @@ public class TerminateAllAction extends DebugCommandAction implements ILaunchesL public void launchesRemoved(ILaunch[] launches) { setEnabled(getLaunchManager().getLaunches().length > 0); } + + @Override + public void init(IWorkbenchPart part) { + super.init(part); + attachSelfToLaunchManager(); + } + + /** + * Initializes this action for the given workbench window. + * + * @param window the workbench window that this action is for + */ + @Override + public void init(IWorkbenchWindow window) { + super.init(window); + attachSelfToLaunchManager(); + } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllActionDelegate.java new file mode 100644 index 000000000..963209db8 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllActionDelegate.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2014 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.commands.actions; + +import org.eclipse.debug.ui.actions.DebugCommandAction; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.IActionDelegate2; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +/** + * Terminate action delegate. + */ +public class TerminateAllActionDelegate implements IWorkbenchWindowActionDelegate, IActionDelegate2, IViewActionDelegate { + + private DebugCommandAction fConsoleAction = new TerminateAllAction(); + + @Override + public void dispose() { + fConsoleAction.dispose(); + } + + @Override + public void init(IWorkbenchWindow window) { + fConsoleAction.init(window); + } + + @Override + public void run(IAction action) { + fConsoleAction.run(); + } + + @Override + public void selectionChanged(IAction action, ISelection selection) { + // do nothing + } + + @Override + public void init(IAction action) { + fConsoleAction.setActionProxy(action); + + } + + @Override + public void runWithEvent(IAction action, Event event) { + run(action); + } + + @Override + public void init(IViewPart view) { + fConsoleAction.init(view); + } +}
\ No newline at end of file |