Yes, you can do this by writing the IntelliJ plugin and extending this class:
com.intellij.openapi.actionSystem.Action
If you are creating an intelliJ plug-in project (just Google intellij plugin development for information on how to get started), press alt-enter somewhere in the project source tree and select Action , you will get a dialog that allows you to configure where it should your action will appear.
You want to place it in relation to another action that already exists, for example, directly below it. In your case, look at a menu group named GenerateGroup (Generate) .
Once your action is defined this way in your plugin.xml, create and run the plugin in the sandbox.
Now, when your action is launched, AnActionEvent will be launched, which contains links to all the information you need (current project, file, cursor position inside the file, psi tree, etc.).
Try to do this so far and come back with any specific questions.
Good luck
source share