| package org.eclipse.jdt.internal.debug.ui.actions; |
| |
| /********************************************************************** |
| Copyright (c) 2000, 2002 IBM Corp. and others. |
| All rights reserved. This program and the accompanying materials |
| are made available under the terms of the Common Public License v0.5 |
| which accompanies this distribution, and is available at |
| http://www.eclipse.org/legal/cpl-v05.html |
| |
| Contributors: |
| IBM Corporation - Initial implementation |
| **********************************************************************/ |
| |
| import org.eclipse.core.runtime.CoreException; |
| import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; |
| import org.eclipse.jface.dialogs.ErrorDialog; |
| import org.eclipse.jface.text.source.IVerticalRulerInfo; |
| import org.eclipse.ui.texteditor.ITextEditor; |
| |
| public class EnableDisableBreakpointRulerAction extends AbstractBreakpointRulerAction { |
| |
| /** |
| * Creates the action to enable/disable breakpoints |
| */ |
| public EnableDisableBreakpointRulerAction(ITextEditor editor, IVerticalRulerInfo info) { |
| setInfo(info); |
| setTextEditor(editor); |
| setText(ActionMessages.getString("EnableDisableBreakpointRulerAction.&Enable_Breakpoint_1")); //$NON-NLS-1$ |
| } |
| |
| /** |
| * @see Action#run() |
| */ |
| public void run() { |
| if (getBreakpoint() != null) { |
| try { |
| getBreakpoint().setEnabled(!getBreakpoint().isEnabled()); |
| } catch (CoreException e) { |
| ErrorDialog.openError(getTextEditor().getEditorSite().getShell(), ActionMessages.getString("EnableDisableBreakpointRulerAction.Enabling/disabling_breakpoints_2"), ActionMessages.getString("EnableDisableBreakpointRulerAction.Exceptions_occurred_enabling_disabling_the_breakpoint_3"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| } |
| |
| /** |
| * @see IUpdate#update() |
| */ |
| public void update() { |
| setBreakpoint(determineBreakpoint()); |
| if (getBreakpoint() == null) { |
| setEnabled(false); |
| return; |
| } |
| setEnabled(true); |
| try { |
| boolean enabled= getBreakpoint().isEnabled(); |
| setText(enabled ? ActionMessages.getString("EnableDisableBreakpointRulerAction.&Disable_Breakpoint_4") : ActionMessages.getString("EnableDisableBreakpointRulerAction.&Enable_Breakpoint_5")); //$NON-NLS-1$ //$NON-NLS-2$ |
| } catch (CoreException ce) { |
| JDIDebugUIPlugin.log(ce); |
| } |
| } |
| } |