1
/*******************************************************************************
2
* Copyright (c) 2004, 2007 QNX Software Systems 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
* QNX Software Systems - Initial API and implementation
10
* Anton Leherbauer (Wind River Systems) - bug 183397
11
*******************************************************************************/
12
package org.eclipse.cdt.debug.internal.ui.actions;
14
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
15
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
16
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.debug.core.DebugPlugin;
18
import org.eclipse.debug.core.model.IBreakpoint;
19
import org.eclipse.jface.dialogs.ErrorDialog;
20
import org.eclipse.jface.text.source.IVerticalRulerInfo;
21
import org.eclipse.ui.IWorkbenchPart;
23
public class EnableDisableBreakpointRulerAction extends AbstractBreakpointRulerAction {
25
private IBreakpoint fBreakpoint;
28
* Creates the action to enable/disable breakpoints
30
public EnableDisableBreakpointRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
32
setText( ActionMessages.getString( "EnableDisableBreakpointRulerAction.Enable_Breakpoint_1" ) ); //$NON-NLS-1$
33
part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.ENABLE_DISABLE_BREAKPOINT_ACTION );
34
setId( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT );
38
* @see org.eclipse.jface.action.IAction#run()
41
if ( fBreakpoint != null ) {
43
fBreakpoint.setEnabled( !fBreakpoint.isEnabled() );
45
catch( CoreException e ) {
46
ErrorDialog.openError( getTargetPart().getSite().getShell(), ActionMessages.getString( "EnableDisableBreakpointRulerAction.Enabling_disabling_breakpoints_1" ), //$NON-NLS-1$
47
ActionMessages.getString( "EnableDisableBreakpointRulerAction.Exceptions_occurred_enabling_or_disabling_breakpoint_1" ), //$NON-NLS-1$
54
* @see org.eclipse.ui.texteditor.IUpdate#update()
56
public void update() {
57
fBreakpoint = getBreakpoint();
58
setEnabled( fBreakpoint != null );
61
boolean enabled = getBreakpoint().isEnabled();
62
setText( enabled ? ActionMessages.getString( "EnableDisableBreakpointRulerAction.Disable_Breakpoint_1" ) : ActionMessages.getString( "EnableDisableBreakpointRulerAction.Enable_Breakpoint_1" ) ); //$NON-NLS-1$ //$NON-NLS-2$
64
catch( CoreException e ) {