1 /*******************************************************************************
2 * Copyright (c) 2005, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM Corporation - initial API and implementation
11 * Mauro "Incastrix" Casciari
12 *******************************************************************************/
13 package net.sourceforge.phpeclipse.xdebug.ui.actions;
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.debug.core.model.IBreakpoint;
17 import net.sourceforge.phpeclipse.xdebug.ui.XDebugUIPlugin;
18 import org.eclipse.debug.ui.actions.RulerBreakpointAction;
19 import org.eclipse.jface.text.source.IVerticalRulerInfo;
20 import org.eclipse.ui.texteditor.ITextEditor;
21 import org.eclipse.ui.texteditor.IUpdate;
27 public class RulerEnableDisableXDebugBreakpointAction extends RulerBreakpointAction implements IUpdate {
28 private static final String ENABLE_XDEBUG_BREAKPOINT_LABEL = "EnableXDebugBreakpoint.label"; //$NON-NLS-1$
29 private static final String DISABLE_XDEBUG_BREAKPOINT_LABEL = "DisableXDebugBreakpoint.label"; //$NON-NLS-1$
30 private static final String RULER_ENABLE_EDISABLE_BREAKPOINT_ACTION_0 = "RulerEnableDisableBreakpointAction_0"; //$NON-NLS-1$
31 private static final String RULER_ENABLE_EDISABLE_BREAKPOINT_ACTION_1 = "RulerEnableDisableBreakpointAction_1"; //$NON-NLS-1$
33 private IBreakpoint fBreakpoint;
35 public RulerEnableDisableXDebugBreakpointAction(ITextEditor editor, IVerticalRulerInfo info) {
40 * @see org.eclipse.jface.action.Action#run()
43 if (fBreakpoint != null) {
45 fBreakpoint.setEnabled(!fBreakpoint.isEnabled());
46 } catch (CoreException e) {
47 XDebugUIPlugin.errorDialog(getEditor().getSite().getShell(), XDebugUIPlugin.getString(RULER_ENABLE_EDISABLE_BREAKPOINT_ACTION_0), XDebugUIPlugin.getString(RULER_ENABLE_EDISABLE_BREAKPOINT_ACTION_1), e.getStatus());
53 * @see org.eclipse.ui.texteditor.IUpdate#update()
55 public void update() {
56 fBreakpoint = getBreakpoint();
57 setEnabled(fBreakpoint != null);
58 if (fBreakpoint != null) {
60 if (fBreakpoint.isEnabled()) {
61 setText(XDebugUIPlugin.getString(DISABLE_XDEBUG_BREAKPOINT_LABEL));
63 setText(XDebugUIPlugin.getString(ENABLE_XDEBUG_BREAKPOINT_LABEL));
65 } catch (CoreException e) {
68 setText(XDebugUIPlugin.getString(ENABLE_XDEBUG_BREAKPOINT_LABEL));