How can I edit the comment of a Class in a PsiJavaFile? Christian Schulze Created March 26, 2018 09:26 Hello, is it possible to edit the comment of a Java Class with the PsiJavaFile? regards Chris
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
Hello Anna, no I need to find it first. I have the PsiJavaFile.
Chris
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