1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Bug 315425 batch marker deletion (James' patch)

This commit is contained in:
Alena Laskavaia 2010-06-03 01:03:27 +00:00
parent 70237c3d81
commit 47c6380964

View file

@ -24,18 +24,16 @@ import org.eclipse.cdt.codan.core.model.IProblemReporterPersistent;
import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
/*
* (non-Javadoc)
*
* @see
* org.eclipse.cdt.codan.core.model.IProblemReporter#reportProblem(java.
* lang.String, org.eclipse.cdt.codan.core.model.IProblemLocation,
* java.lang.Object[])
/**
* Problem reported that created eclipse markers
*/
public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
public void reportProblem(String id, IProblemLocation loc, Object... args) {
IResource file = loc.getFile();
int lineNumber = loc.getLineNumber();
@ -132,8 +130,10 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
* (org.eclipse.core.resources.IResource,
* org.eclipse.cdt.codan.core.model.IChecker)
*/
public void deleteProblems(IResource file, IChecker checker) {
public void deleteProblems(final IResource file, final IChecker checker) {
try {
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
IMarker[] markers = file.findMarkers(
GENERIC_CODE_ANALYSIS_MARKER_TYPE, true,
IResource.DEPTH_INFINITE);
@ -150,6 +150,8 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
m.delete();
}
}
}
}, null, IWorkspace.AVOID_UPDATE, null);
} catch (CoreException e) {
CodanCorePlugin.log(e);
}