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)) {
files.add(file);
}
}
}
}
// add validator-config.xml if not default one from xwork.jar
final Set<VirtualFile> descriptorFiles = new THashSet<VirtualFile>();
for (final Module module : ModuleManager.getInstance(project).getModules()) {
if (enabledForModule.get(module)) {
final PsiFile psiFile = validatorManager.getValidatorConfigFile(module);
if (psiFile != null &&
validatorManager.isCustomValidatorConfigFile(psiFile)) {
InspectionValidatorUtil.addFile(descriptorFiles, psiFile);
}
}
}
files.addAll(InspectionValidatorUtil.expandCompileScopeIfNeeded(descriptorFiles, context));