diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 2e57663e6df..c16f0a39629 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,9 @@ +2005-02-03 Mikhail Khodjaiants + Fix for bug 84187: "Toggle Watchpoint" and "Toggle Method Breakpoint" don't work with C editor. + ICWatchpoint should extend ILineBreakpoint to allow watchpoints to be shown in editors. + * ICWatchpoint.java + * CWatchpoint.java + 2005-02-03 Mikhail Khodjaiants Fix for bug 84187: "Toggle Watchpoint" and "Toggle Method Breakpoint" don't work with C editor. * CDIDebugModel.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java index ab3d07f9f7a..b125727b267 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICWatchpoint.java @@ -11,11 +11,12 @@ package org.eclipse.cdt.debug.core.model; import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.model.ILineBreakpoint; /** * A watchpoint specific to the C/C++ debug model. */ -public interface ICWatchpoint extends ICBreakpoint { +public interface ICWatchpoint extends ICBreakpoint, ILineBreakpoint { /** * Watchpoint attribute storing the expression associated with this diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java index 5a3b59a16ab..c9750725d8c 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CWatchpoint.java @@ -12,8 +12,8 @@ package org.eclipse.cdt.debug.internal.core.breakpoints; import java.text.MessageFormat; import java.util.Map; - import org.eclipse.cdt.debug.core.model.ICWatchpoint; +import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -37,28 +37,22 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint { super( resource, getMarkerType(), attributes, add ); } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.ICWatchpoint#isWriteType() + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICWatchpoint#isWriteType() */ public boolean isWriteType() throws CoreException { return ensureMarker().getAttribute( WRITE, true ); } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.ICWatchpoint#isReadType() + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICWatchpoint#isReadType() */ public boolean isReadType() throws CoreException { return ensureMarker().getAttribute( READ, false ); } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.debug.core.ICWatchpoint#getExpression() + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.model.ICWatchpoint#getExpression() */ public String getExpression() throws CoreException { return ensureMarker().getAttribute( EXPRESSION, "" ); //$NON-NLS-1$ @@ -71,9 +65,7 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint { return C_WATCHPOINT; } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage() */ protected String getMarkerMessage() throws CoreException { @@ -99,4 +91,25 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint { sb.append( getConditionText() ); return sb.toString(); } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber() + */ + public int getLineNumber() throws CoreException { + return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart() + */ + public int getCharStart() throws CoreException { + return ensureMarker().getAttribute( IMarker.CHAR_START, -1 ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd() + */ + public int getCharEnd() throws CoreException { + return ensureMarker().getAttribute( IMarker.CHAR_END, -1 ); + } } \ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 0df8ffb28c1..fa0334a7454 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,9 @@ +2005-02-03 Mikhail Khodjaiants + Fix for bug 84187: "Toggle Watchpoint" and "Toggle Method Breakpoint" don't work with C editor. + ICWatchpoint should extend ILineBreakpoint to allow watchpoints to be shown in editors. + * AbstractBreakpointRulerAction.java + * CBreakpointPropertyPage.java + 2005-02-02 Mikhail Khodjaiants The "INTERNAL_ERROR" constant has been moved from ICDebugUIConstants to IInternalCDebugUIConstants. * IInternalCDebugUIConstants.java diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java index ef83a0448d9..97368972ee0 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java @@ -11,13 +11,12 @@ package org.eclipse.cdt.debug.internal.ui.actions; import java.util.Iterator; - import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.core.model.ILineBreakpoint; import org.eclipse.jface.action.Action; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; @@ -47,10 +46,10 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints( CDebugCorePlugin.getUniqueIdentifier() ); for( int i = 0; i < breakpoints.length; i++ ) { IBreakpoint breakpoint = breakpoints[i]; - if ( breakpoint instanceof ICLineBreakpoint ) { - ICLineBreakpoint cBreakpoint = (ICLineBreakpoint)breakpoint; - if ( breakpointAtRulerLine( cBreakpoint ) ) { - return cBreakpoint; + if ( breakpoint instanceof ILineBreakpoint ) { + ILineBreakpoint lineBreakpoint = (ILineBreakpoint)breakpoint; + if ( breakpointAtRulerLine( lineBreakpoint ) ) { + return lineBreakpoint; } } } @@ -80,13 +79,13 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU fBreakpoint = breakpoint; } - protected boolean breakpointAtRulerLine( ICLineBreakpoint cBreakpoint ) { + protected boolean breakpointAtRulerLine( ILineBreakpoint cBreakpoint ) { int lineNumber = getBreakpointLine( cBreakpoint ); int rulerLine = getInfo().getLineOfLastMouseButtonActivity(); return ( rulerLine == lineNumber ); } - private int getBreakpointLine( ICLineBreakpoint breakpoint ) { + private int getBreakpointLine( ILineBreakpoint breakpoint ) { if ( getTargetPart() instanceof ISaveablePart && ((ISaveablePart)getTargetPart()).isDirty() ) { try { return breakpoint.getLineNumber(); @@ -112,7 +111,7 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU return -1; } - private Position getBreakpointPosition( ICLineBreakpoint breakpoint ) { + private Position getBreakpointPosition( ILineBreakpoint breakpoint ) { IAnnotationModel model = getAnnotationModel(); if ( model != null ) { Iterator it = model.getAnnotationIterator(); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java index 9ff0f995311..206300f6dc9 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java @@ -301,6 +301,29 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.5" ), address ) ); //$NON-NLS-1$ } } + else if ( breakpoint instanceof ICWatchpoint ) { + ICWatchpoint watchpoint = (ICWatchpoint)breakpoint; + String type = ""; //$NON-NLS-1$ + String expression = ""; //$NON-NLS-1$ + try { + if ( watchpoint.isReadType() && !watchpoint.isWriteType() ) + type = PropertyPageMessages.getString( "CBreakpointPropertyPage.11" ); //$NON-NLS-1$ + else if ( !watchpoint.isReadType() && watchpoint.isWriteType() ) + type = PropertyPageMessages.getString( "CBreakpointPropertyPage.12" ); //$NON-NLS-1$ + else + type = PropertyPageMessages.getString( "CBreakpointPropertyPage.13" ); //$NON-NLS-1$ + expression = watchpoint.getExpression(); + } + catch( CoreException ce ) { + CDebugUIPlugin.log( ce ); + } + addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), type ) ); //$NON-NLS-1$ + String projectName = breakpoint.getMarker().getResource().getLocation().toOSString(); + if ( projectName != null ) { + addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.10" ), projectName ) ); //$NON-NLS-1$ + } + addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.14" ), expression ) ); //$NON-NLS-1$ + } else if ( breakpoint instanceof ILineBreakpoint ) { addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), PropertyPageMessages.getString( "CBreakpointPropertyPage.8" ) ) ); //$NON-NLS-1$//$NON-NLS-2$ String fileName = null; @@ -327,29 +350,6 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.9" ), lineNumber.toString() ) ); //$NON-NLS-1$ } } - else if ( breakpoint instanceof ICWatchpoint ) { - ICWatchpoint watchpoint = (ICWatchpoint)breakpoint; - String type = ""; //$NON-NLS-1$ - String expression = ""; //$NON-NLS-1$ - try { - if ( watchpoint.isReadType() && !watchpoint.isWriteType() ) - type = PropertyPageMessages.getString( "CBreakpointPropertyPage.11" ); //$NON-NLS-1$ - else if ( !watchpoint.isReadType() && watchpoint.isWriteType() ) - type = PropertyPageMessages.getString( "CBreakpointPropertyPage.12" ); //$NON-NLS-1$ - else - type = PropertyPageMessages.getString( "CBreakpointPropertyPage.13" ); //$NON-NLS-1$ - expression = watchpoint.getExpression(); - } - catch( CoreException ce ) { - CDebugUIPlugin.log( ce ); - } - addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), type ) ); //$NON-NLS-1$ - String projectName = breakpoint.getMarker().getResource().getLocation().toOSString(); - if ( projectName != null ) { - addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.10" ), projectName ) ); //$NON-NLS-1$ - } - addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.14" ), expression ) ); //$NON-NLS-1$ - } } protected void createEnabledField( Composite parent ) {