use of com.intellij.struts2.dom.validator.ValidatorManager in project intellij-plugins by JetBrains.
the class ValidatorModelValidator method getFilesToProcess.
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<>();
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<>();
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));
return files;
}
use of com.intellij.struts2.dom.validator.ValidatorManager in project intellij-plugins by JetBrains.
the class ValidatorConfigResolveConverterImpl method getVariants.
@NotNull
public Collection<? extends ValidatorConfig> getVariants(final ConvertContext context) {
final Module module = context.getModule();
if (module == null) {
return Collections.emptyList();
}
final ValidatorManager validatorManager = ValidatorManager.getInstance(module.getProject());
return validatorManager.getValidators(module);
}
Aggregations