PsiElement (StringBuffer newText) { PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(getProject()); PsiComment comment = elementFactory.createCommentFromText(newText.toString(), null); PsiElement tag = PsiTreeUtil.getChildOfType(comment, PsiDocTag.class); PsiElement ref = PsiTreeUtil.getChildOfType(tag, PsiDocMethodOrFieldRef.class); assert ref != null : newText; return replace(ref); }