1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

bug 278779: CodanProblemReporter creates duplicate markers

This commit is contained in:
Andrew Gvozdev 2009-07-10 17:59:05 +00:00
parent 73778a3286
commit 1f5127784d

View file

@ -33,6 +33,19 @@ public class CodanProblemReporter {
if (problem.isEnabled() == false)
return; // skip
int severity = problem.getSeverity().intValue();
// Do not put in duplicates
IMarker[] cur = file.findMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, false, IResource.DEPTH_ZERO);
if (cur != null) {
for (IMarker element : cur) {
int line = ((Integer) element.getAttribute(IMarker.LINE_NUMBER)).intValue();
if (line==lineNumber) {
String mesg = (String) element.getAttribute(IMarker.MESSAGE);
int sev = ((Integer) element.getAttribute(IMarker.SEVERITY)).intValue();
if (sev == severity && mesg.equals(message))
return;
}
}
}
IMarker marker = file
.createMarker(GENERIC_CODE_ANALYSIS_MARKER_TYPE);
marker.setAttribute(IMarker.MESSAGE, message);