How to add a Comment to a PsiJavaFile
Hello,
I want to add a PsiDocComment to a PsiClass. I tried this:
PsiDocComment docComment = psiClass.getDocComment();
if(docComment == null){
PsiDocComment docCommentFromText = JavaPsiFacade.getElementFactory(project).createDocCommentFromText(fileTemplate.getText());
psiClass.add(docCommentFromText);
}else {
boolean writable = docComment.isWritable();
// do stuff
}
and get this:
Must not change PSI outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor
com.intellij.util.IncorrectOperationException: Must not change PSI outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor
at com.intellij.pom.core.impl.PomModelImpl.startTransaction(PomModelImpl.java:359)
I know what this mean but how can I do this the correct way?
regards
Chris
Please sign in to leave a comment.
Please wrap this all into WriteCommandAction.runWriteCommandAction
Merhaba,
How to add a Comment to a PsiJavaFile being contrived to exist for many projects simply so it can be run will be the first to hit the wall, but those projects where the functions to make existing transactions cheaper in real <a href="https://asha24.com/blog/plsql-interview-questions-and-answers/"> world applications </a> will find the elusive real world demand.
This is my question that needs to be answered.option or create a simple materialized view.select IR.rowid MV_INST_LOBR_ROWID, J.rowid Job_ROWID, J.* FROM JOB JLEFT JOIN MV_INST_LOB_R IR ON(IR.I1503_CUST_AC_NO_PT1 = J.I3200_CUST_AC_NO_PT1 AND IR.I1503_CUST_AC_NO_PT2 = J.I3200_CUST_AC_NO_PT2 AND IR.I1503_INST_SEQ_NO = J.I3200_INST_SEQ_NO)WHERE IR.I1503_CUST_AC_NO_PT1 IS NOT NULL AND IR.I1503_CUST_AC_NO_PT2 IS NOT NULLUNION SELECT null, J.rowid Job_ROWID, J.* FROM JOB J WHERE J.I3200_CUST_AC_NO_PT1 IS NULL AND J.I3200_CUST_AC_NO_PT1 IS NULL;Basically, the intention is to get all the records joining MV_INST_LOB_R and JOB tablewhere MV_INST_LOB_R do not have record for the joining condition J.I3200_CUST_AC_NO_PT1 / J.I3200_CUST_AC_NO_PT2I am trying to use this in a materialized view and got below error: SQL Error: ORA-12015: cannot create a fast refresh materialized view from a complex query. I have searched for help on the internet and still have not found a solution.12015. 00000 - "cannot create a fast refresh materialized view from a complex query"*Cause: Neither ROWIDs and nor primary key constraints are supported forcomplex queries.*Action: Reissue the command with the REFRESH FORCE or REFRESH COMPLETECan you help me in converting to simple query, so that I can use simple materialized view.It was cool to see your article pop up in my google search for the process yesterday. Great Guide.Keep up the good work!
Thank you,
Radhey