1 11 package org.eclipse.debug.internal.ui.actions.breakpoints; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.debug.core.model.IBreakpoint; 15 import org.eclipse.debug.internal.ui.DebugUIPlugin; 16 import org.eclipse.debug.internal.ui.actions.ActionMessages; 17 import org.eclipse.debug.ui.actions.RulerBreakpointAction; 18 import org.eclipse.jface.text.source.IVerticalRulerInfo; 19 import org.eclipse.ui.texteditor.ITextEditor; 20 import org.eclipse.ui.texteditor.IUpdate; 21 22 26 public class RulerEnableDisableBreakpointAction extends RulerBreakpointAction implements IUpdate { 27 28 private IBreakpoint fBreakpoint; 29 30 public RulerEnableDisableBreakpointAction(ITextEditor editor, IVerticalRulerInfo info) { 31 super(editor, info); 32 } 33 34 37 public void run() { 38 if (fBreakpoint != null) { 39 try { 40 fBreakpoint.setEnabled(!fBreakpoint.isEnabled()); 41 } catch (CoreException e) { 42 DebugUIPlugin.errorDialog(getEditor().getSite().getShell(), ActionMessages.RulerEnableDisableBreakpointAction_0, ActionMessages.RulerEnableDisableBreakpointAction_1, e.getStatus()); 43 } 44 } 45 } 46 47 50 public void update() { 51 fBreakpoint = getBreakpoint(); 52 setEnabled(fBreakpoint != null); 53 if (fBreakpoint != null) { 54 try { 55 if (fBreakpoint.isEnabled()) { 56 setText(ActionMessages.RulerEnableDisableBreakpointAction_2); 57 } else { 58 setText(ActionMessages.RulerEnableDisableBreakpointAction_3); 59 } 60 } catch (CoreException e) { 61 } 62 } else { 63 setText(ActionMessages.RulerEnableDisableBreakpointAction_2); 64 } 65 } 66 67 } 68 | Popular Tags |