use of org.metaborg.core.language.LanguagesFileSelector in project spoofax by metaborg.
the class Builder method clean.
@Override
public void clean(CleanInput input, IProgress progress, ICancel cancel) throws InterruptedException {
final FileObject location = input.project.location();
logger.debug("Cleaning {}", location);
FileSelector selector = new LanguagesFileSelector(languageIdentifier, input.languages);
if (input.selector != null) {
selector = FileSelectorUtils.and(selector, input.selector);
}
try {
final FileObject[] resources = location.findFiles(selector);
if (resources == null) {
return;
}
final Set<IContext> contexts = ContextUtils.getAll(Iterables2.from(resources), input.project, languageIdentifier, contextService);
for (IContext context : contexts) {
cancel.throwIfCancelled();
try {
context.reset();
} catch (IOException e) {
logger.error("Could not clean {}", e, context);
}
}
} catch (FileSystemException e) {
logger.error("Could not clean contexts at {}", e, location);
}
}
Aggregations