use of org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment in project intellij-community by JetBrains.
the class GrDocCommentUtil method setDocComment.
public static GrDocComment setDocComment(@NotNull GrDocCommentOwner owner, @Nullable GrDocComment comment) {
GrDocComment docComment = owner.getDocComment();
if (docComment != null) {
if (comment == null) {
docComment.delete();
return null;
} else {
PsiElement added = docComment.replace(comment);
assert added instanceof GrDocComment;
return (GrDocComment) added;
}
} else {
if (comment == null)
return null;
PsiElement parent = owner.getParent();
ASTNode node = owner.getNode();
parent.getNode().addLeaf(GroovyTokenTypes.mNLS, "\n ", node);
PsiElement added = parent.addBefore(comment, owner);
assert added instanceof GrDocComment;
return (GrDocComment) added;
}
}
use of org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment in project intellij-community by JetBrains.
the class GrDocTagImpl method setName.
@Override
public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
final PsiElement nameElement = getNameElement();
final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(getProject());
final GrDocComment comment = factory.createDocCommentFromText("/** @" + name + "*/");
nameElement.replace(comment.getTags()[0].getNameElement());
return this;
}
Aggregations