| package org.eclipse.debug.internal.ui.actions; |
| |
| /********************************************************************** |
| Copyright (c) 2000, 2002 IBM Corp. All rights reserved. |
| This file is made available under the terms of the Common Public License v1.0 |
| which accompanies this distribution, and is available at |
| http://www.eclipse.org/legal/cpl-v10.html |
| **********************************************************************/ |
| |
| import org.eclipse.core.resources.IMarkerDelta; |
| import org.eclipse.debug.core.DebugPlugin; |
| import org.eclipse.debug.core.IBreakpointsListener; |
| 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 IBreakpointsListener { |
| |
| 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 IBreakpointsListener#breakpointsAdded(IBreakpoint[])breakpointAdded(IBreakpoint) |
| */ |
| public void breakpointsAdded(IBreakpoint[] breakpoints) { |
| if (getAction() != null && !getAction().isEnabled()) { |
| update(); |
| } |
| } |
| |
| /** |
| * @see IBreakpointsListener#breakpointsChanged(IBreakpoint[], IMarkerDelta[])breakpointChanged(IBreakpoint, IMarkerDelta) |
| */ |
| public void breakpointsChanged(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) { |
| } |
| |
| /** |
| * @see IBreakpointsListener#breakpointsRemoved(IBreakpoint[], IMarkerDelta[]) |
| */ |
| public void breakpointsRemoved(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) { |
| 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; |
| } |
| } |