@@ -59,9 +59,6 @@ public String getText(Object element) {
5959 final var label = new StringBuilder ();
6060 if (element instanceof DSPThread thread ) {
6161 label .append (NLS .bind ("Thread #{0} [{1}]" , thread .getId (), thread .getName ()));
62- }
63-
64- if (label .length () != 0 ) {
6562 if (element instanceof ITerminate terminate ) {
6663 if (terminate .isTerminated ()) {
6764 label .insert (0 , "<terminated>" );
@@ -74,24 +71,20 @@ public String getText(Object element) {
7471 label .append (DebugUIPlugin .getDefaultLabelProvider ().getText (element ));
7572
7673 if (element instanceof DSPStackFrame frame ) {
77- try {
78- final int line = frame .getLineNumber ();
79- if (line > 0 ) {
80- final String source = frame .getSourceName ();
81- if (source != null ) {
82- String file = new Path (source ).lastSegment ();
83- if (file == null ) {
84- file = source ;
85- }
86- final String suffix = '(' + file + ":" + line + ')' ; //$NON-NLS-1$
87- if (!endsWith (label , suffix )) {
88- label .append (' ' );
89- label .append (suffix );
90- }
74+ int line = getLine (frame );
75+ if (line > 0 ) {
76+ final String source = frame .getSourceName ();
77+ if (source != null ) {
78+ String file = new Path (source ).lastSegment ();
79+ if (file == null ) {
80+ file = source ;
81+ }
82+ final String suffix = '(' + file + ":" + line + ')' ; //$NON-NLS-1$
83+ if (!endsWith (label , suffix )) {
84+ label .append (' ' );
85+ label .append (suffix );
9186 }
9287 }
93- } catch (final Exception ex ) {
94- DSPPlugin .logWarning ("Failed to determine stack frame line number" , ex );
9588 }
9689 }
9790 }
@@ -105,6 +98,15 @@ public String getText(Object element) {
10598 return label .toString ();
10699 }
107100
101+ private int getLine (DSPStackFrame frame ) {
102+ try {
103+ return frame .getLineNumber ();
104+ } catch (DebugException ex ) {
105+ DSPPlugin .logWarning ("Failed to determine stack frame line number" , ex );
106+ return 0 ;
107+ }
108+ }
109+
108110 @ Override
109111 public @ Nullable Font getFont (Object element ) {
110112 if (element instanceof DSPDebugElement debugElement ) {
0 commit comments