use of org.eclipse.n4js.ui.generator.GeneratorMarkerSupport in project n4js by eclipse.
the class BuildInstruction method shouldGenerate.
private boolean shouldGenerate(Resource resource, IProject aProject) {
try {
Iterable<Pair<IStorage, IProject>> storages = storage2UriMapper.getStorages(resource.getURI());
for (Pair<IStorage, IProject> pair : storages) {
if (pair.getFirst() instanceof IFile && pair.getSecond().equals(aProject)) {
IFile file = (IFile) pair.getFirst();
int findMaxProblemSeverity = file.findMaxProblemSeverity(null, true, IResource.DEPTH_INFINITE);
// Easiest way here is to remove that error marker-type and look for other severe errors once more:
if (findMaxProblemSeverity == IMarker.SEVERITY_ERROR) {
// clean
GeneratorMarkerSupport generatorMarkerSupport = injector.getInstance(GeneratorMarkerSupport.class);
generatorMarkerSupport.deleteMarker(resource);
// and recompute:
findMaxProblemSeverity = file.findMaxProblemSeverity(null, true, IResource.DEPTH_INFINITE);
}
// the final decision to build:
return findMaxProblemSeverity != IMarker.SEVERITY_ERROR;
}
}
return false;
} catch (CoreException exc) {
throw new WrappedException(exc);
}
}
Aggregations