From afb99ca2e026e59a5c617d28c46944e1e46b3fda Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 11 Jul 2005 20:18:06 +0000 Subject: [PATCH] Bug 94770: Breakpoint marker messages need formatting. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 8 ++++ .../breakpoints/BreakpointMessages.properties | 40 ++++++++++++++----- .../core/breakpoints/CAddressBreakpoint.java | 16 ++------ .../core/breakpoints/CFunctionBreakpoint.java | 15 ++----- .../core/breakpoints/CLineBreakpoint.java | 11 +---- .../core/breakpoints/CWatchpoint.java | 24 +++++------ 6 files changed, 56 insertions(+), 58 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 282f5ea0e43..7ffc1216905 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,11 @@ +2005-07-11 Mikhail Khodjaiants + Bug 94770: Breakpoint marker messages need formatting. + * BreakpointMessages.properties + * CAddressBreakpoint.java + * CFunctionBreakpoint.java + * CLineBreakpoint.java + * CWatchpoint.java + 2005-07-11 Mikhail Khodjaiants Bug 102077: The DebugLabelViewDecorato asking info out of context. Added a new flag to CVariable indicate the disposed state and prevent target requests. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/BreakpointMessages.properties b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/BreakpointMessages.properties index d0b726bbb6b..4483df52aad 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/BreakpointMessages.properties +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/BreakpointMessages.properties @@ -8,16 +8,34 @@ # Contributors: # QNX Software Systems - initial API and implementation ############################################################################### -CAddressBreakpoint.1=Address breakpoint: -CAddressBreakpoint.2=[address: {0}] + +# The marker message of an address breakpoint. +# Format: Address breakpoint: [address:
] +CAddressBreakpoint.0=Address breakpoint:{0}[address: {1}]{2} + CBreakpoint.1=\ [ignore count: {0}] CBreakpoint.2=\ if {0} -CFunctionBreakpoint.2=Function breakpoint: -CFunctionBreakpoint.3=\ [function: {0}] -CLineBreakpoint.1=Line breakpoint: -CLineBreakpoint.2=\ [line: {0}] -CWatchpoint.1=Write watchpoint -CWatchpoint.2=Read watchpoint -CWatchpoint.3=Access watchpoint -CWatchpoint.4=Watchpoint -CWatchpoint.5=\ at \'{0}\' + +# The marker message of a function breakpoint. +# Format: Function breakpoint: [function: ] +CFunctionBreakpoint.0=Function breakpoint:{0}[function: {1}]{2} + +# The marker message of a line breakpoint. +# Format: Line breakpoint: [line: ] +CLineBreakpoint.0=Line breakpoint:{0}[line: {1}] + +# The marker message of a write watchpoint. +# Format: Write watchpoint: at +CWatchpoint.0=Write watchpoint{0}at{1}{2} + +# The marker message of a read watchpoint. +# Format: Read watchpoint: at +CWatchpoint.1=Read watchpoint{0}at{1}{2} + +# The marker message of an access watchpoint. +# Format: Access watchpoint: at +CWatchpoint.2=Access watchpoint{0}at{1}{2} + +# The marker message of a watchpoint. +# Format: Watchpoint: at +CWatchpoint.3=Watchpoint{0}at{1}{2} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java index 29e1ef53511..3893f03ec95 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java @@ -50,18 +50,10 @@ public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddr * @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage() */ protected String getMarkerMessage() throws CoreException { - StringBuffer sb = new StringBuffer( BreakpointMessages.getString( "CAddressBreakpoint.1" ) ); //$NON-NLS-1$ - String name = ensureMarker().getResource().getName(); - if ( name != null && name.length() > 0 ) { - sb.append( ' ' ); - sb.append( name ); + String fileName = ensureMarker().getResource().getName(); + if ( fileName != null && fileName.length() > 0 ) { + fileName = ' ' + fileName + ' '; } - try { - sb.append( MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.2" ), new String[] { getAddress() } ) ); //$NON-NLS-1$ - } - catch( NumberFormatException e ) { - } - sb.append( getConditionText() ); - return sb.toString(); + return MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.0" ), new String[] { fileName, getAddress(), getConditionText() } ); //$NON-NLS-1$ } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java index 389ad7b6abc..bc66e62205e 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CFunctionBreakpoint.java @@ -48,17 +48,10 @@ public class CFunctionBreakpoint extends AbstractLineBreakpoint implements ICFun * @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage() */ protected String getMarkerMessage() throws CoreException { - StringBuffer sb = new StringBuffer( BreakpointMessages.getString( "CFunctionBreakpoint.2" ) ); //$NON-NLS-1$ - String name = ensureMarker().getResource().getName(); - if ( name != null && name.length() > 0 ) { - sb.append( ' ' ); - sb.append( name ); + String fileName = ensureMarker().getResource().getName(); + if ( fileName != null && fileName.length() > 0 ) { + fileName = ' ' + fileName + ' '; } - String function = getFunction(); - if ( function != null && function.trim().length() > 0 ) { - sb.append( MessageFormat.format( BreakpointMessages.getString( "CFunctionBreakpoint.3" ), new String[] { function.trim() } ) ); //$NON-NLS-1$ - } - sb.append( getConditionText() ); - return sb.toString(); + return MessageFormat.format( BreakpointMessages.getString( "CFunctionBreakpoint.0" ), new String[] { fileName, getFunction(), getConditionText() } ); //$NON-NLS-1$ } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java index 437990603f7..3a604925629 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CLineBreakpoint.java @@ -48,17 +48,10 @@ public class CLineBreakpoint extends AbstractLineBreakpoint { * @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage() */ protected String getMarkerMessage() throws CoreException { - StringBuffer sb = new StringBuffer( BreakpointMessages.getString( "CLineBreakpoint.1" ) ); //$NON-NLS-1$ String fileName = ensureMarker().getResource().getName(); if ( fileName != null && fileName.length() > 0 ) { - sb.append( ' ' ); - sb.append( fileName ); + fileName = ' ' + fileName + ' '; } - int lineNumber = getLineNumber(); - if ( lineNumber > 0 ) { - sb.append( MessageFormat.format( BreakpointMessages.getString( "CLineBreakpoint.2" ), new Integer[] { new Integer( lineNumber ) } ) ); //$NON-NLS-1$ - } - sb.append( getConditionText() ); - return sb.toString(); + return MessageFormat.format( BreakpointMessages.getString( "CLineBreakpoint.0" ), new Object[] { fileName, new Integer( getLineNumber() ), getConditionText() } ); //$NON-NLS-1$ } } 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 e5766f714d3..5f4cfecf26c 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 @@ -69,27 +69,21 @@ public class CWatchpoint extends CBreakpoint implements ICWatchpoint { * @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage() */ protected String getMarkerMessage() throws CoreException { - StringBuffer sb = new StringBuffer(); - if ( isWriteType() && !isReadType() ) - sb.append( BreakpointMessages.getString( "CWatchpoint.1" ) ); //$NON-NLS-1$ - else if ( !isWriteType() && isReadType() ) - sb.append( BreakpointMessages.getString( "CWatchpoint.2" ) ); //$NON-NLS-1$ - else if ( isWriteType() && isReadType() ) - sb.append( BreakpointMessages.getString( "CWatchpoint.3" ) ); //$NON-NLS-1$ - else - sb.append( BreakpointMessages.getString( "CWatchpoint.4" ) ); //$NON-NLS-1$ - sb.append( ' ' ); String fileName = ensureMarker().getResource().getName(); if ( fileName != null && fileName.length() > 0 ) { - sb.append( ' ' ); - sb.append( fileName ); + fileName = ' ' + fileName + ' '; } String expression = getExpression(); if ( expression != null && expression.length() > 0 ) { - sb.append( MessageFormat.format( BreakpointMessages.getString( "CWatchpoint.5" ), new String[]{ expression } ) ); //$NON-NLS-1$ + expression = " '" + expression + "' "; //$NON-NLS-1$ //$NON-NLS-2$ } - sb.append( getConditionText() ); - return sb.toString(); + if ( isWriteType() && !isReadType() ) + return MessageFormat.format( BreakpointMessages.getString( "CWatchpoint.0" ), new String[] { fileName, expression, getConditionText() } ); //$NON-NLS-1$ + else if ( !isWriteType() && isReadType() ) + return MessageFormat.format( BreakpointMessages.getString( "CWatchpoint.1" ), new String[] { fileName, expression, getConditionText() } ); //$NON-NLS-1$ + else if ( isWriteType() && isReadType() ) + return MessageFormat.format( BreakpointMessages.getString( "CWatchpoint.2" ), new String[] { fileName, expression, getConditionText() } ); //$NON-NLS-1$ + return MessageFormat.format( BreakpointMessages.getString( "CWatchpoint.3" ), new String[] { fileName, expression, getConditionText() } ); //$NON-NLS-1$ } /* (non-Javadoc)