StrutsBundle.message("inspections.struts2.model.validator.progress"),
Struts2ModelInspection.class);
}
public Collection<VirtualFile> getFilesToProcess(final Project project, final CompileContext context) {
final StrutsManager strutsManager = StrutsManager.getInstance(project);
final PsiManager psiManager = PsiManager.getInstance(project);
// cache validation settings per module
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
final FactoryMap<Module, Boolean> enabledForModule = new FactoryMap<Module, Boolean>() {
protected Boolean create(final Module module) {
return isEnabledForModule(module);
}
};
final Set<VirtualFile> files = new THashSet<VirtualFile>();
for (final VirtualFile file : context.getCompileScope().getFiles(StdFileTypes.XML, false)) {
final Module module = context.getModuleByFile(file);
if (module != null &&
enabledForModule.get(module)) {
final PsiFile psiFile = psiManager.findFile(file);
if (psiFile instanceof XmlFile) {
final StrutsModel model = strutsManager.getModelByFile((XmlFile) psiFile);
if (model != null) {
for (final XmlFile configFile : model.getConfigFiles()) {
ContainerUtil.addIfNotNull(configFile.getVirtualFile(), files);
}
}