From 74005e4343f6494dec3e6599f280f1d63519f77a Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Thu, 13 Nov 2003 21:07:20 +0000 Subject: [PATCH] Use 'StringBuffer' instead of 'String' when generating stack frame labels. Added a label for dummy stack frames instead of using the name provided by the rendered object. --- debug/org.eclipse.cdt.debug.ui/ChangeLog | 5 ++ .../ui/CDTDebugModelPresentation.java | 47 ++++++++++++------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 4a7e74aae29..990641cb0c5 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,8 @@ +2003-11-13 Mikhail Khodjaiants + Use 'StringBuffer' instead of 'String' when generating stack frame labels. + Added a label for dummy stack frames instead of using the name provided by the rendered object. + * CDTDebugModelPresentation.java + 2003-11-05 Mikhail Khodjaiants The argument type of the 'getBreakpointAddress' of 'ICBreakpointManager' is changed from 'ICBreakpoint' to 'ICBreakpointManager'. diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java index bcf8e5aaf72..6a7e46c2fe3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java @@ -96,6 +96,8 @@ public class CDTDebugModelPresentation extends LabelProvider * @see #setAttribute(String, Object) */ public final static String DISPLAY_FULL_PATHS = "DISPLAY_FULL_PATHS"; //$NON-NLS-1$ + + private static final String DUMMY_STACKFRAME_LABEL = "..."; protected HashMap fAttributes = new HashMap(3); @@ -521,32 +523,41 @@ public class CDTDebugModelPresentation extends LabelProvider IStackFrameInfo info = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class ); if ( info != null ) { - String label = new String(); - label += info.getLevel() + " "; - if ( info.getFunction() != null && info.getFunction().trim().length() > 0 ) + StringBuffer label = new StringBuffer(); + label.append( info.getLevel() ); + label.append( ' ' ); + if ( info.getFunction() != null ) { - label += info.getFunction() + "() "; - if ( info.getFile() != null ) + String function = info.getFunction().trim(); + if ( function.length() > 0 ) { - IPath path = new Path( info.getFile() ); - if ( !path.isEmpty() ) + label.append( function ); + label.append( "() " ); + if ( info.getFile() != null ) { - label += "at " + ( qualified ? path.toOSString() : path.lastSegment() ) + ":"; - if ( info.getFrameLineNumber() != 0 ) - label += info.getFrameLineNumber(); + IPath path = new Path( info.getFile() ); + if ( !path.isEmpty() ) + { + label.append( "at " ); + label.append( ( qualified ? path.toOSString() : path.lastSegment() ) ); + label.append( ":" ); + if ( info.getFrameLineNumber() != 0 ) + label.append( info.getFrameLineNumber() ); + } } } } else - label += ""; - return label; + label.append( "" ); + return label.toString(); } - IDummyStackFrame dummy = (IDummyStackFrame)stackFrame.getAdapter( IDummyStackFrame.class ); - if ( dummy != null ) - { - return stackFrame.getName(); - } - return stackFrame.getName(); + return ( stackFrame.getAdapter( IDummyStackFrame.class ) != null ) ? + getDummyStackFrameLabel( stackFrame ) : stackFrame.getName(); + } + + private String getDummyStackFrameLabel( IStackFrame stackFrame ) + { + return DUMMY_STACKFRAME_LABEL; } protected String getVariableText( IVariable var ) throws DebugException