void (final Map<String, Set<PsiFile>> valueToFiles, final InspectionManager manager, final List<? super ProblemDescriptor> problemDescriptors, final PsiFile psiFile, final ProgressIndicator progress) { for (final String value : valueToFiles.keySet()) { if (progress != null){ progress.setText2(PropertiesBundle.message("duplicate.property.value.progress.indicator.text", value)); progress.checkCanceled(); } if (value.length() == 0) continue; StringSearcher searcher = new StringSearcher(value, true, true); @Nls StringBuilder message = new StringBuilder(); final int[] duplicatesCount = {0}; Property[] propertyInCurrentFile = new Property[1]; Set<PsiFile> psiFilesWithDuplicates = valueToFiles.get(value); for (final PsiFile file : psiFilesWithDuplicates) { CharSequence text = file.getViewProvider().getContents(); LowLevelSearchUtil.processTexts(text, 0, text.length(), searcher, offset -> { PsiElement element = file.findElementAt(offset); if (element != null && element.getParent() instanceof Property property) { if (Objects.equals(property.getValue(), value) && element.getStartOffsetInParent() != 0) { if (duplicatesCount[0] == 0){ message.append(PropertiesBundle.message("duplicate.property.value.problem.descriptor", property.getValue())); } surroundWithHref(message, element, true); duplicatesCount[0]++; if (propertyInCurrentFile[0] == null && psiFile == file) { propertyInCurrentFile[0] = property; } } } return true; }); } if (duplicatesCount[0] > 1) { PsiElement elementToHighlight = ObjectUtils.notNull(propertyInCurrentFile[0], psiFile); problemDescriptors.add(manager.createProblemDescriptor(elementToHighlight, message.toString(), false, null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING)); } } }