1 11 package org.eclipse.ant.internal.ui.editor.actions; 12 13 import org.eclipse.ant.internal.ui.AntUIPlugin; 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.jface.dialogs.ErrorDialog; 16 import org.eclipse.jface.text.source.IVerticalRulerInfo; 17 import org.eclipse.ui.texteditor.ITextEditor; 18 19 public class EnableDisableBreakpointRulerAction extends AbstractBreakpointRulerAction { 20 21 24 public EnableDisableBreakpointRulerAction(ITextEditor editor, IVerticalRulerInfo info) { 25 setInfo(info); 26 setTextEditor(editor); 27 setText(AntEditorActionMessages.getString("EnableDisableBreakpointRulerAction.0")); } 29 30 33 public void run() { 34 if (getBreakpoint() != null) { 35 try { 36 getBreakpoint().setEnabled(!getBreakpoint().isEnabled()); 37 } catch (CoreException e) { 38 ErrorDialog.openError(getTextEditor().getEditorSite().getShell(), AntEditorActionMessages.getString("EnableDisableBreakpointRulerAction.1"), AntEditorActionMessages.getString("EnableDisableBreakpointRulerAction.2"), e.getStatus()); } 40 } 41 } 42 43 46 public void update() { 47 setBreakpoint(determineBreakpoint()); 48 if (getBreakpoint() == null) { 49 setEnabled(false); 50 return; 51 } 52 setEnabled(true); 53 try { 54 boolean enabled= getBreakpoint().isEnabled(); 55 setText(enabled ? AntEditorActionMessages.getString("EnableDisableBreakpointRulerAction.3"): AntEditorActionMessages.getString("EnableDisableBreakpointRulerAction.4")); } catch (CoreException ce) { 57 AntUIPlugin.log(ce); 58 } 59 } 60 } 61 | Popular Tags |