PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new PsiElementVisitor() { @Override public void visitFile(@NotNull PsiFile file) { var propertiesFile = findPropertiesFile(file); if (propertiesFile == null) return; var resourceBundle = propertiesFile.getResourceBundle(); final String resourceBundleBaseName = resourceBundle.getBaseName(); if (!isResourceBundleAlphaSortedExceptOneFile(resourceBundle, propertiesFile)) { holder.registerProblem(file, PropertiesBundle.message("inspection.alpha.unsorted.properties.file.description1", resourceBundleBaseName), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new PropertiesSorterQuickFix(false)); return; } if (!propertiesFile.isAlphaSorted()) { PropertiesSorterQuickFix fix = new PropertiesSorterQuickFix(true); holder.registerProblem(file, PropertiesBundle.message("inspection.alpha.unsorted.properties.file.description"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, fix); } } }; }