How can I edit the comment of a Class in a PsiJavaFile?

Hello,

is it possible to edit the comment of a Java Class with the PsiJavaFile? 

regards

Chris 

0

Do you have a comment as PsiComment? Or do you need to find it first?

Given you have a comment, you can `comment.replace(newComment)`. To create new comment you may use e.g. `com.intellij.psi.PsiParserFacade#createLineOrBlockCommentFromText`

Anna

0

Hello Anna, no I need to find it first. I have the PsiJavaFile.

Chris

0

If you have psiJavaFile, you may call `getClasses()` and on the class you may call `getDocComment`. Sorry, I need more details to be able to help. 

Anna

0

请先登录再写评论。