public void processDuplicates(@NotNull String referenceText) {
      PsiElement[] duplicatedLinks =
        PsiTreeUtil.collectElements(myFile, element -> MarkdownTokenTypeSets.LINKS.contains(PsiUtilCore.getElementType(element))
                                                   && myUrl.equals(getUrl(element))
                                                   //inside inline links
                                                   && PsiTreeUtil.findFirstParent(element, true, element1 -> PsiUtilCore.getElementType(element1) == INLINE_LINK) == null
                                                   //generated link
                                                   && PsiTreeUtil.findFirstParent(element, element1 -> PsiUtilCore.getElementType(element1) == FULL_REFERENCE_LINK) == null);

      final var showWarning = !ContainerUtil.and(duplicatedLinks, link -> {
        final var children = link.getChildren();
        return (children.length == 0 && myTitleText == null) ||
               (children.length == 3
                && PsiUtilCore.getElementType(children[2]) == LINK_TITLE
                && children[2].getText().equals(myTitleText));
      });
      if (duplicatedLinks.length > 0) {
        final var duplicates = ContainerUtil.map(duplicatedLinks, link -> SmartPointerManager.createPointer(link));
        if (ApplicationManager.getApplication().isUnitTestMode()) {
          replaceDuplicates(myFile, myEditor, duplicates, referenceText, showWarning);
          PsiDocumentManager.getInstance(myFile.getProject()).doPostponedOperationsAndUnblockDocument(myEditor.getDocument());
          Document document = myEditor.getDocument();
          document.setText(document.getText() + "\nTitles Warning: " + showWarning);
        } else {
          ApplicationManager.getApplication().invokeLater(() -> replaceDuplicates(myFile, myEditor, duplicates, referenceText, showWarning));
        }
      }
    }
public void processDuplicates(@NotNull String referenceText)