How to add your own action to the generate menu (ctrl + insert)

When pressing ctrl + insert in a java file, you get the little generate window, where you can generate:
- constructor
- getter
- setter
- getter and setter
- equals() and hashcode()

I would like to add my own option:
- toString()

How do I do that?

0
2 comments
Avatar
Permanently deleted user

Through trial and error I found what you need to do to get an action in the generate menu. Use the following in the plugin.xml.

<add-to-group group-id="GenerateGroup" anchor="after" relative-to-action="GenerateSetter"/>

The ActionManager.xml file seems to list all the groups you can add to.

On another note, I'm building another plugin based on your toString plugin, I hope you don't mind?

Glen

1
Avatar
Permanently deleted user

Through trial and error I found what you need to do
to get an action in the generate menu. Use the
following in the plugin.xml.

Yeah a great way, takes alot of IDEA restarts ;)

<add-to-group group-id="GenerateGroup" anchor="after"
relative-to-action="GenerateSetter"/>

Thanks alot, the right place to have the plugin.

On another note, I'm building another plugin based on
your toString plugin, I hope you don't mind?

Not at all. It's nice if the community can learn, help and inspire each other.

Looking forward to see the plugin on the community page when it's released.

0

Please sign in to leave a comment.