public static void runActionOverSeveralAttributeValuesAfterLettingUserSelectTheNeededOne(final String @NotNull [] namespacesToChooseFrom,
                                                                                           final Project project,
                                                                                           final StringToAttributeProcessor onSelection,
                                                                                           @NlsContexts.PopupTitle String title,
                                                                                           final IntentionAction requestor,
                                                                                           final Editor editor)
    throws IncorrectOperationException {

    if (namespacesToChooseFrom.length > 1 && !ApplicationManager.getApplication().isUnitTestMode()) {
      JBPopupFactory.getInstance()
        .createPopupChooserBuilder(List.of(namespacesToChooseFrom))
        .setRenderer(new XmlNSRenderer())
        .setTitle(title)
        .setItemChosenCallback(selectedValue -> {
          PsiDocumentManager.getInstance(project).commitAllDocuments();
          CommandProcessor.getInstance().executeCommand(
            project,
            () -> ApplicationManager.getApplication().runWriteAction(
              () -> {
                try {
                  onSelection.doSomethingWithGivenStringToProduceXmlAttributeNowPlease(selectedValue);
                }
                catch (IncorrectOperationException ex) {
                  throw new RuntimeException(ex);
                }
              }
            ),
            requestor.getText(),
            requestor.getFamilyName()
          );
        })
        .createPopup()
        .showInBestPositionFor(editor);
    }
    else {
      WriteAction.run(() -> {
        String attrName = namespacesToChooseFrom.length == 0 ? "" : namespacesToChooseFrom[0];
        onSelection.doSomethingWithGivenStringToProduceXmlAttributeNowPlease(attrName);
      });
    }
  }
public static void runActionOverSeveralAttributeValuesAfterLettingUserSelectTheNeededOne(final String @NotNull [] namespacesToChooseFrom,
                                                                                           final Project project,
                                                                                           final StringToAttributeProcessor onSelection,
                                                                                           @NlsContexts.PopupTitle String title,
                                                                                           final IntentionAction requestor,
                                                                                           final Editor editor)