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