| package org.eclipse.debug.internal.ui.actions; |
| |
| /* |
| * (c) Copyright IBM Corp. 2002. |
| * All Rights Reserved. |
| */ |
| |
| import org.eclipse.core.resources.IMarkerDelta; |
| import org.eclipse.debug.core.DebugPlugin; |
| import org.eclipse.debug.core.IBreakpointListener; |
| import org.eclipse.debug.core.model.IBreakpoint; |
| import org.eclipse.debug.ui.IDebugView; |
| import org.eclipse.jface.viewers.TableViewer; |
| import org.eclipse.jface.viewers.Viewer; |
| import org.eclipse.ui.IViewPart; |
| |
| public class SelectAllBreakpointsAction extends SelectAllAction implements IBreakpointListener { |
| |
| protected void update() { |
| getAction().setEnabled( |
| DebugPlugin.getDefault().getBreakpointManager().hasBreakpoints()); |
| } |
| |
| /** |
| * @see AbstractDebugActionDelegate#doAction(Object) |
| */ |
| protected void doAction(Object element) { |
| if (!(getView() instanceof IDebugView)) { |
| return; |
| } |
| Viewer viewer = ((IDebugView) getView()).getViewer(); |
| if (!(viewer instanceof TableViewer)) { |
| return; |
| } |
| ((TableViewer) viewer).getTable().selectAll(); |
| //ensure that the selection change callback is fired |
| viewer.setSelection(viewer.getSelection()); |
| } |
| |
| /** |
| * @see IBreakpointListener#breakpointAdded(IBreakpoint) |
| */ |
| public void breakpointAdded(IBreakpoint breakpoint) { |
| if (getAction() != null && !getAction().isEnabled()) { |
| update(); |
| } |
| } |
| |
| /** |
| * @see IBreakpointListener#breakpointChanged(IBreakpoint, IMarkerDelta) |
| */ |
| public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { |
| } |
| |
| /** |
| * @see IBreakpointListener#breakpointRemoved(IBreakpoint, IMarkerDelta) |
| */ |
| public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { |
| if (getAction() != null) { |
| update(); |
| } |
| } |
| |
| /** |
| * @see IViewActionDelegate#init(IViewPart) |
| */ |
| public void init(IViewPart view) { |
| super.init(view); |
| DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this); |
| } |
| |
| public void dispose() { |
| DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this); |
| super.dispose(); |
| } |
| |
| protected String getActionId() { |
| return IDebugView.SELECT_ALL_ACTION; |
| } |
| } |