I have troubles with such a simple thing - setting the package statement in psi java file. I'm able to create the class, add it to the PsiFile. All imports are automatically done, based on the extended class and the exceptions that overridden methods throw, but all this is at the class level. The package in my understanding should go to the PsiJavaFile containing the newly created class, so I create the package statement as Psi object and try to set ti to the psi file object. Whatever I try, I get either an exception or no package statement at all. Does someone know, what is the correct path to go? Any reference to the Psi tree model?