private void showI18nizeMultipleStringsDialog(@NotNull Project project,
                         @NotNull Map<String, I18nizedPropertyData<HardcodedStringContextData>> keyValuePairs,
                         @NotNull Set<PsiFile> contextFiles,
                         @Nullable ResourceBundleManager bundleManager) {
    ArrayList<I18nizedPropertyData<HardcodedStringContextData>> replacements = new ArrayList<>(keyValuePairs.values());
    I18nizeMultipleStringsDialog<HardcodedStringContextData> dialog =
      new I18nizeMultipleStringsDialog<>(project, replacements, contextFiles, bundleManager,
                                         data -> {
                                           List<PsiElement> elements = data.getPsiElements();
                                           return ContainerUtil.map(elements, element -> new UsageInfo(element.getParent()));
                                         },
                                         null, true);

    if (dialog.showAndGet()) {
      PropertiesFile propertiesFile = dialog.getPropertiesFile();
      Set<PsiFile> files = new HashSet<>();
      for (I18nizedPropertyData<HardcodedStringContextData> data : replacements) {
        for (PsiElement element : data.contextData().getPsiElements()) {
          ContainerUtil.addIfNotNull(files, element.getContainingFile());
        }
      }
      if (files.isEmpty()) {
        return;
      }
      files.add(propertiesFile.getContainingFile());

      WriteCommandAction.runWriteCommandAction(project, getFamilyName(), null, () -> {
        for (I18nizedPropertyData<HardcodedStringContextData> data : replacements) {
          JavaI18nUtil.DEFAULT_PROPERTY_CREATION_HANDLER.createProperty(project,
                                                                        Collections.singletonList(propertiesFile),
                                                                        data.key(),
                                                                        data.value(),
                                                                        new UExpression[0]);
          List<UExpression> uExpressions = data.contextData().getExpressions();
          List<PsiElement> psiElements = data.contextData().getPsiElements();
          for (int i = 0; i < psiElements.size(); i++) {
            PsiElement psiElement = psiElements.get(i);
            UExpression uExpression = uExpressions.get(i);
            Language language = psiElement.getLanguage();
            String i18NText =
              dialog.getI18NText(data.key(), data.value(), JavaI18nUtil.composeParametersText(data.contextData().getArgs()));

            PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
            PsiExpression expression;
            try {
              expression = elementFactory.createExpressionFromText(i18NText, psiElement);
              if (language == JavaLanguage.INSTANCE) {
                JavaCodeStyleManager.getInstance(project).shortenClassReferences(psiElement.replace(expression));
                continue;
              }
            }
            catch (IncorrectOperationException e) {
              LOG.debug(e);
              try {
                expression = elementFactory.createExpressionFromText(dialog.getI18NText(data.key(), data.value(), ""), psiElement);
              }
              catch (IncorrectOperationException exception) {
                continue;
              }
            }

            @Nullable Couple<String> callDescriptor = getCallDescriptor(expression);
            if (callDescriptor == null) {
              LOG.debug("Templates are not supported for " + language.getDisplayName());
              continue;
            }


            UastCodeGenerationPlugin generationPlugin = UastCodeGenerationPlugin.byLanguage(language);
            if (generationPlugin == null) {
              LOG.debug("No UAST generation plugin exist for " + language.getDisplayName());
              continue;
            }
            UastElementFactory pluginElementFactory = generationPlugin.getElementFactory(project);
            List<UExpression> arguments = new ArrayList<>();
            arguments.add(pluginElementFactory.createStringLiteralExpression(data.key(), psiElement));
            arguments.addAll(data.contextData().getArgs());

            UExpression receiver = callDescriptor.first != null
                                   ? pluginElementFactory.createQualifiedReference(callDescriptor.first, uExpression.getSourcePsi())
                                   : null;
            UCallExpression callExpression = pluginElementFactory
              .createCallExpression(receiver,
                                    callDescriptor.second,
                                    arguments,
                                    null,
                                    UastCallKind.METHOD_CALL,
                                    psiElement);
            if (callExpression != null) {
              generationPlugin.replace(uExpression, callExpression, UCallExpression.class);
            }
            else {
              LOG.debug("Null generated UAST call expression");
            }
          }
        }
      }, files.toArray(PsiFile.EMPTY_ARRAY));
    }
  }
private void showI18nizeMultipleStringsDialog(@NotNull Project project,
                         @NotNull Map<String, I18nizedPropertyData<HardcodedStringContextData>> keyValuePairs,
                         @NotNull Set<PsiFile> contextFiles,
                         @Nullable ResourceBundleManager bundleManager)