Creating a plugin that will use the PSI for a Java file but no references to JavaPsiFile (and related)

Answered

I'd like to create a plugin that contains a single action that when invoked for a Java file will generate an additional file based on the contents of the Java file. I am assuming that I would get the PsiFile from the ActionEvent and use that to find the specific PsiElements that I care about. I can get the PsiFile but based on reading the docs it sounds like I should cast it to a JavaPsiFile and work with that.

I created a new IntelliJ project with a gradlle file but the only thing that I've added to my build.gradle file is a reference to my action.

However, my project does not appear to have the correct references to that as JavaPsiFile is not available. Do I need to denote in the plugin.xml file that I am working with Java files so that I can get access to the JavaPsiFile and related classes?

0

Please sign in to leave a comment.