mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
bug 278779: CodanProblemReporter creates duplicate markers
This commit is contained in:
parent
73778a3286
commit
1f5127784d
1 changed files with 13 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue