void (@NotNull ActionContext context, @NotNull PsiDocComment element, @NotNull ModPsiUpdater updater) { String commentText = element.getText(); String prefix = commentText.substring(0, myStartOffsetInDocComment); String urlAndMaybeText = commentText.substring(myStartOffsetInDocComment, myEndOffsetInDocComment); String suffix = commentText.substring(myEndOffsetInDocComment); int urlEnd = urlAndMaybeText.indexOf(' '); String text; if (urlEnd > 0) { text = urlAndMaybeText.substring(urlEnd).trim(); urlAndMaybeText = urlAndMaybeText.substring(0, urlEnd); } else { text = "..."; } String wrappedLink = "<a href=\"" + urlAndMaybeText + "\">" + text + "</a>"; CommentTracker ct = new CommentTracker(); PsiElement replacement = ct.replace(element, prefix + wrappedLink + suffix); int start = replacement.getTextRange().getStartOffset() + prefix.length() + urlAndMaybeText.length() + 11; updater.select(TextRange.from(start, text.length())); }