diff options
author | Jared Burns | 2002-03-12 23:11:27 +0000 |
---|---|---|
committer | Jared Burns | 2002-03-12 23:11:27 +0000 |
commit | 5e843610a80d5d34669048439438dcaa666d3225 (patch) | |
tree | 9031f04bcf2fea8f65a634cfe44052c4cb089f7f | |
parent | 0af72d5a0c8d195b1521a2408a702a3a90ec9fc7 (diff) | |
download | eclipse.platform.debug-5e843610a80d5d34669048439438dcaa666d3225.tar.gz eclipse.platform.debug-5e843610a80d5d34669048439438dcaa666d3225.tar.xz eclipse.platform.debug-5e843610a80d5d34669048439438dcaa666d3225.zip |
Bug 8939 - Feature Request: Select all in the breakpoints view
4 files changed, 129 insertions, 4 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index 32146ecd4..5760f1f40 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -70,13 +70,15 @@ RemoveAllTerminatedAction.label=Remove &All Terminated commonTabName=&Common
+SelectAll.label=Select &all (Alt+A)
+
CopyToClipboardAction.label=&Copy Stack
CopyVariablesToClipboardAction.label=Copy &Variables
RelaunchAction.label=Re&launch
TerminateAndRemoveAction.label=Ter&minate and Remove
-RemoveAllAction.label=Remove &All
+RemoveAllAction.label=Remo&ve All
RemoveAllBreakpointsAction.tooltip=Remove All Breakpoints
RemoveAllExpressionsAction.tooltip=Remove All Expressions
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 970f3ee1a..2e3ca16c1 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -538,6 +538,12 @@ class="org.eclipse.debug.internal.ui.actions.EnableBreakpointsAction"
enablesFor="2+">
</action>
+ <action
+ id="org.eclipse.debug.ui.actions.SelectAllAction"
+ label="%SelectAll.label"
+ menubarPath="breakpointGroup"
+ class="org.eclipse.debug.internal.ui.actions.SelectAllAction">
+ </action>
</viewerContribution>
<!-- Contributions to Variables View Popup Menu -->
<viewerContribution
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java new file mode 100644 index 000000000..5f819bfd0 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java @@ -0,0 +1,99 @@ +/* + * (c) Copyright IBM Corp. 2002. + * All Rights Reserved. + */ +package org.eclipse.debug.internal.ui.actions; + +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.ui.AbstractDebugView; +import org.eclipse.debug.ui.IDebugViewAdapter; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.ui.IViewPart; + +public class SelectAllAction extends AbstractListenerActionDelegate { + + /** + * @see AbstractDebugActionDelegate#doAction(Object) + */ + protected void doAction(Object element) { + doAction(); + } + + /** + * @see IActionDelegate#run(IAction) + */ + public void run(IAction action){ + doAction(null); + } + + /** + * @see AbstractDebugActionDelegate#isEnabledFor(Object) + */ + protected boolean isEnabledFor(Object element) { + return true; + } + + /** + * @see AbstractDebugActionDelegate#getHelpContextId() + */ + protected String getHelpContextId() { + return null; + } + + protected void update(IAction action, ISelection s) { + update(); + } + + protected void doAction() { + if (!(getView() instanceof AbstractDebugView)) { + return; + } + Viewer viewer= ((AbstractDebugView)getView()).getViewer(); + if (!(viewer instanceof TableViewer)) { + return; + } + ((TableViewer)viewer).getTable().selectAll(); + } + + /** + * Enable this action if there are any breakpoints to select + */ + protected void update() { + getAction().setEnabled( + DebugPlugin.getDefault().getBreakpointManager().getBreakpoints().length == 0 ? false : true); + } + + /** + * @see AbstractDebugActionDelegate#setActionImages(IAction) + */ + protected void setActionImages(IAction action) { + } + + /** + * @see IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + setView(view); + setWindow(view.getViewSite().getWorkbenchWindow()); + getPage().addPartListener(this); + getPage().getWorkbenchWindow().addPageListener(this); + } + + /** + * @see AbstractDebugActionDelegate#initialize(IAction, ISelection) + */ + protected boolean initialize(IAction action, ISelection selection) { + if (!isInitialized()) { + IDebugViewAdapter debugView= (IDebugViewAdapter)getView().getAdapter(IDebugViewAdapter.class); + if (debugView != null) { + debugView.setAction(AbstractDebugView.SELECT_ALL_ACTION, action); + } + return super.initialize(action, selection); + } + return false; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java index 548455c42..a682a5fa9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java @@ -115,6 +115,16 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi public static final String REMOVE_ACTION = "Remove_ActionId"; //$NON-NLS-1$
/**
+ * Action id for a view's select all action. Any view
+ * with a select all action that should be invoked when
+ * ctrl+a is pressed should store their
+ * select all action with this key.
+ *
+ * @see #setAction(String, IAction)
+ */
+ public static final String SELECT_ALL_ACTION = "Select_All_ActionId"; //$NON-NLS-1$
+
+ /**
* Action id for a view's double-click action. Any view
* with an action that should be invoked when
* the mouse is double-clicked should store their
@@ -464,9 +474,12 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi }
/**
- * Handles key events in viewer. Invokes the
- * <code>REMOVE_ACTION</code> when the delete
- * key is pressed.
+ * Handles key events in viewer. Invokes
+ * <ol>
+ * <li><code>REMOVE_ACTION</code> when the delete
+ * key is pressed</li>
+ * <li><code>SELECT_ALL_ACTION</code> when ctrl+a
+ * key is pressed</li>
*/
protected void handleKeyPressed(KeyEvent event) {
if (event.character == SWT.DEL && event.stateMask == 0) {
@@ -474,6 +487,11 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi if (action != null && action.isEnabled()) {
action.run();
}
+ } else if (event.character == 'a' && event.stateMask == SWT.ALT) {
+ IAction action = getAction(SELECT_ALL_ACTION);
+ if (action != null && action.isEnabled()) {
+ action.run();
+ }
}
}
|