@@ -23,6 +23,7 @@ public class ProblemReporter implements IProblemReporter {
2323 public static final String ATTRIBUTE_ID = "problemId" ; //$NON-NLS-1$
2424 public static final String ATTRIBUTE_ORIGINAL_LINE_NUMBER = "originalLineNumber" ; //$NON-NLS-1$
2525 public static final String ATTRIBUTE_FILE = "file" ; //$NON-NLS-1$
26+ public static final String ATTRIBUTE_STACK = "stack" ; //$NON-NLS-1$
2627
2728 public ProblemReporter () {
2829 }
@@ -53,13 +54,13 @@ public void reportProblem(Problem problem) throws CoreException {
5354 // for each resource
5455 reportProblem (resource , completeMessage , problem
5556 .getSeverity ().intValue (), lineNumber , problem .getId (),
56- problem .getFile (), problem .getLineNumber ());
57+ problem .getFile (), problem .getLineNumber (), problem . getStack () );
5758 }
5859 }
5960
6061 private void reportProblem (IResource resource , String message ,
6162 int severity , int lineNumber , String id , File file ,
62- int originalLineNumber ) throws CoreException {
63+ int originalLineNumber , String stack ) throws CoreException {
6364 // TODO: open external file, see
6465 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=151005 on how to
6566 // generate markers for external files
@@ -81,20 +82,28 @@ private void reportProblem(IResource resource, String message,
8182 }
8283 }
8384 }
85+
86+ // Only display stack if it contains multiple locations
87+ String message_display = message ;
88+ int locationCount = (stack .length () - stack .replace ("->" , "" ).length ())/2 ;
89+ if (locationCount > 0 ) {
90+ message_display = message + " " + stack ;
91+ }
8492
8593 // see
8694 // http://wiki.eclipse.org/FAQ_Why_don%27t_my_markers_appear_in_the_editor%27s_vertical_ruler%3F
8795 Map <String , Object > attributes = new HashMap <String , Object >();
8896 if (lineNumber != 0 ) {
8997 MarkerUtilities .setLineNumber (attributes , lineNumber );
9098 }
91- MarkerUtilities .setMessage (attributes , message );
99+ MarkerUtilities .setMessage (attributes , message_display );
92100 attributes .put (IMarker .SEVERITY , severity );
93101 // the following attributes are only used for the quick fixes
94102 attributes .put (ATTRIBUTE_ID , id );
95103 if (file != null ) {
96104 attributes .put (ATTRIBUTE_FILE , file .toString ());
97105 }
106+ attributes .put (ATTRIBUTE_STACK , stack );
98107 attributes .put (ATTRIBUTE_ORIGINAL_LINE_NUMBER , originalLineNumber );
99108 MarkerUtilities .createMarker (resource , attributes , CHECKER_MARKER_TYPE );
100109 }
0 commit comments