mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
From Sam Robb:
Changes the ErrorParserManager to use an instance of IProject and IMarkerGenerator instead of ACBuilder.
This commit is contained in:
parent
b9e49851ca
commit
c95957ca97
1 changed files with 17 additions and 9 deletions
|
@ -17,18 +17,22 @@ import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||||
|
|
||||||
public class ErrorParserManager {
|
public class ErrorParserManager {
|
||||||
|
|
||||||
private static String PREF_ERROR_PARSER= "errorOutputParser";
|
private static String PREF_ERROR_PARSER= "errorOutputParser";
|
||||||
|
|
||||||
private ACBuilder fBuilder;
|
private IProject fProject;
|
||||||
|
private IMarkerGenerator fMarkerGenerator;
|
||||||
private Map fFilesInProject;
|
private Map fFilesInProject;
|
||||||
private List fNameConflicts;
|
private List fNameConflicts;
|
||||||
|
|
||||||
|
@ -41,12 +45,15 @@ public class ErrorParserManager {
|
||||||
|
|
||||||
static String SEPARATOR = System.getProperty("file.separator");
|
static String SEPARATOR = System.getProperty("file.separator");
|
||||||
|
|
||||||
|
|
||||||
public ErrorParserManager(ACBuilder builder) {
|
public ErrorParserManager(ACBuilder builder) {
|
||||||
fBuilder= builder;
|
this(builder.getProject(), builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ErrorParserManager(IProject project, IMarkerGenerator markerGenerator) {
|
||||||
|
fProject= project;
|
||||||
|
fMarkerGenerator= markerGenerator;
|
||||||
fFilesInProject= new HashMap();
|
fFilesInProject= new HashMap();
|
||||||
fNameConflicts= new ArrayList();
|
fNameConflicts= new ArrayList();
|
||||||
|
|
||||||
fErrorParsers= new ArrayList();
|
fErrorParsers= new ArrayList();
|
||||||
fDirectoryStack = new Vector();
|
fDirectoryStack = new Vector();
|
||||||
fBaseDirectory = null;
|
fBaseDirectory = null;
|
||||||
|
@ -161,8 +168,8 @@ public class ErrorParserManager {
|
||||||
fNameConflicts.clear();
|
fNameConflicts.clear();
|
||||||
|
|
||||||
List collectedFiles= new ArrayList();
|
List collectedFiles= new ArrayList();
|
||||||
fBaseDirectory = fBuilder.getProject().getLocation();
|
fBaseDirectory = fProject.getLocation();
|
||||||
collectFiles(fBuilder.getProject(), collectedFiles);
|
collectFiles(fProject, collectedFiles);
|
||||||
|
|
||||||
for (int i= 0; i < collectedFiles.size(); i++) {
|
for (int i= 0; i < collectedFiles.size(); i++) {
|
||||||
IFile curr= (IFile)collectedFiles.get(i);
|
IFile curr= (IFile)collectedFiles.get(i);
|
||||||
|
@ -243,7 +250,7 @@ public class ErrorParserManager {
|
||||||
} else {
|
} else {
|
||||||
path = (IPath)getWorkingDirectory().append(filePath);
|
path = (IPath)getWorkingDirectory().append(filePath);
|
||||||
}
|
}
|
||||||
return (IFile)fBuilder.getProject().getFile(path);
|
return (IFile)fProject.getFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,9 +258,10 @@ public class ErrorParserManager {
|
||||||
*/
|
*/
|
||||||
public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName) {
|
public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName) {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
fBuilder.addMarker (fBuilder.getProject(), lineNumber, desc, severity, varName);
|
fMarkerGenerator.addMarker (fProject, lineNumber, desc, severity, varName);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fBuilder.addMarker(file, lineNumber, desc, severity, varName);
|
fMarkerGenerator.addMarker(file, lineNumber, desc, severity, varName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue