StrutsBundle.message("inspections.validator.model.validator.progress"),
ValidatorModelInspection.class, ValidatorConfigModelInspection.class);
}
public Collection<VirtualFile> getFilesToProcess(final Project project, final CompileContext context) {
final PsiManager psiManager = PsiManager.getInstance(project);
final ValidatorManager validatorManager = ValidatorManager.getInstance(project);
// cache S2facet/validation settings per module
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
final FactoryMap<Module, Boolean> enabledForModule = new FactoryMap<Module, Boolean>() {
protected Boolean create(final Module module) {
return isEnabledForModule(module) &&
StrutsFacet.getInstance(module) != null;
}
};
// collect all validation.xml files located in sources of S2-modules
final Set<VirtualFile> files = new THashSet<VirtualFile>();
for (final VirtualFile file : context.getProjectCompileScope().getFiles(StdFileTypes.XML, true)) {
if (StringUtil.endsWith(file.getName(), FILENAME_EXTENSION_VALIDATION_XML)) {
final PsiFile psiFile = psiManager.findFile(file);
if (psiFile instanceof XmlFile &&
validatorManager.isValidatorsFile((XmlFile) psiFile)) {
final Module module = ModuleUtilCore.findModuleForFile(file, project);
if (module != null &&
enabledForModule.get(module)) {