mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Bug 315425 batch marker deletion (James' patch)
This commit is contained in:
parent
70237c3d81
commit
47c6380964
1 changed files with 26 additions and 24 deletions
|
@ -24,18 +24,16 @@ import org.eclipse.cdt.codan.core.model.IProblemReporterPersistent;
|
||||||
import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
|
import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
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.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
|
/**
|
||||||
/*
|
* Problem reported that created eclipse markers
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* org.eclipse.cdt.codan.core.model.IProblemReporter#reportProblem(java.
|
|
||||||
* lang.String, org.eclipse.cdt.codan.core.model.IProblemLocation,
|
|
||||||
* java.lang.Object[])
|
|
||||||
*/
|
*/
|
||||||
|
public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
|
||||||
public void reportProblem(String id, IProblemLocation loc, Object... args) {
|
public void reportProblem(String id, IProblemLocation loc, Object... args) {
|
||||||
IResource file = loc.getFile();
|
IResource file = loc.getFile();
|
||||||
int lineNumber = loc.getLineNumber();
|
int lineNumber = loc.getLineNumber();
|
||||||
|
@ -132,8 +130,10 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
|
||||||
* (org.eclipse.core.resources.IResource,
|
* (org.eclipse.core.resources.IResource,
|
||||||
* org.eclipse.cdt.codan.core.model.IChecker)
|
* org.eclipse.cdt.codan.core.model.IChecker)
|
||||||
*/
|
*/
|
||||||
public void deleteProblems(IResource file, IChecker checker) {
|
public void deleteProblems(final IResource file, final IChecker checker) {
|
||||||
try {
|
try {
|
||||||
|
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||||
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
IMarker[] markers = file.findMarkers(
|
IMarker[] markers = file.findMarkers(
|
||||||
GENERIC_CODE_ANALYSIS_MARKER_TYPE, true,
|
GENERIC_CODE_ANALYSIS_MARKER_TYPE, true,
|
||||||
IResource.DEPTH_INFINITE);
|
IResource.DEPTH_INFINITE);
|
||||||
|
@ -150,6 +150,8 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
|
||||||
m.delete();
|
m.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}, null, IWorkspace.AVOID_UPDATE, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CodanCorePlugin.log(e);
|
CodanCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue