void (@NotNull Project project, CommonProblemDescriptor @NotNull [] descriptors, @NotNull Set<PsiFile> contextFiles, @NotNull Map<String, I18nizedPropertyData<HardcodedStringContextData>> keyValuePairs) { final Set<PsiElement> distinct = new HashSet<>(); final UniqueNameGenerator uniqueNameGenerator = new UniqueNameGenerator(); for (CommonProblemDescriptor descriptor : descriptors) { PsiElement psiElement = ((ProblemDescriptor)descriptor).getPsiElement(); UPolyadicExpression polyadicExpression = I18nizeConcatenationQuickFix.getEnclosingLiteralConcatenation(psiElement); UStringConcatenationsFacade concatenation = UStringConcatenationsFacade.createFromTopConcatenation( polyadicExpression != null ? polyadicExpression : UastContextKt.toUElement(psiElement, UInjectionHost.class) ); if (concatenation != null) { PartiallyKnownString pks = concatenation.asPartiallyKnownString(); if (pks.getSegments().size() == 1) { String value = pks.getValueIfKnown(); if (distinct.add(psiElement) && value != null) { I18nizedPropertyData<HardcodedStringContextData> data = keyValuePairs.get(value); if (data != null) { data.contextData().getPsiElements().add(psiElement); data.contextData().getExpressions().add(concatenation.getRootUExpression()); } else { String key = ObjectUtils.notNull(suggestKeyByPlace(value, concatenation.getRootUExpression()), I18nizeQuickFixDialog.suggestUniquePropertyKey(value, null, null)); ArrayList<PsiElement> elements = new ArrayList<>(); elements.add(psiElement); List<UExpression> uExpressions = new ArrayList<>(); uExpressions.add(concatenation.getRootUExpression()); HardcodedStringContextData contextData = new HardcodedStringContextData(uExpressions, elements, Collections.emptyList()); keyValuePairs.put(value, new I18nizedPropertyData<>(uniqueNameGenerator.generateUniqueName(key), value, contextData)); } ContainerUtil.addIfNotNull(contextFiles, psiElement.getContainingFile()); } } else if (distinct.add(concatenation.getRootUExpression().getSourcePsi())) { ArrayList<UExpression> args = new ArrayList<>(); String value = JavaI18nUtil.buildUnescapedFormatString(concatenation, args, project); String key = ObjectUtils.notNull(suggestKeyByPlace(value, concatenation.getRootUExpression()), I18nizeQuickFixDialog.suggestUniquePropertyKey(value, null, null)); HardcodedStringContextData contextData = new HardcodedStringContextData( Collections.singletonList(concatenation.getRootUExpression()), Collections.singletonList(concatenation.getRootUExpression().getSourcePsi()), args); keyValuePairs.put(value + concatenation.hashCode(), new I18nizedPropertyData<>(uniqueNameGenerator.generateUniqueName(key), value, contextData)); ContainerUtil.addIfNotNull(contextFiles, psiElement.getContainingFile()); } } } }