void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiElement enclosingTag = element.getParent(); if (enclosingTag == null) return; final PsiElement javadoc = enclosingTag.getParent(); if (javadoc == null) return; final PsiDocComment donorJavadoc = createDonorJavadoc(element); final PsiElement codeTag = extractElement(donorJavadoc); if (codeTag == null) return; for (var e = enclosingTag.getFirstChild(); e != element && e != null; e = e.getNextSibling()) { javadoc.addBefore(e, enclosingTag); } javadoc.addBefore(codeTag, enclosingTag); for (var e = element.getNextSibling(); e != null; e = e.getNextSibling()) { javadoc.addBefore(e, enclosingTag); } final PsiElement sibling = enclosingTag.getNextSibling(); if (sibling != null && sibling.getNode().getElementType() == TokenType.WHITE_SPACE) { javadoc.addBefore(sibling, enclosingTag); } enclosingTag.delete(); }