How to add an item to Generate (alt+insert) menu?

I'm so new in plugin development. I have Plugin Development Kit, Could somebody give me direction where I could find some info about how to add generators to Generate Menu.
I want to add few generators which add custom getters and setters plus some other methods similar to equals() and heshCode().


Comment actions Permalink

See the Generate toString() plugin that does this.

The source is included in the .jar file.

You can add your action using the plugin.xml file.

And there is some java code that hides the action in the generate menu if it's not a .java file, or the .java file is an Interface.

Comment actions Permalink

I have to admit this is a nice plugin.. And since you have Template Quick Selection List I should only write templates for my cases. But, I'd like to automatically add "extends SomeClassName" and "implements SomeOtherClassName". Is this possible to do using template?

Comment actions Permalink

It would be even better if it could be not toString() generator but "Custom Generator". If I'd be able add as mach templates as I want and choose one to generate the code.
But I'd defiantly need to be able to add extends and implements Classes.

Comment actions Permalink

I have though about it being able to generate all other kind of code than just dumping getter/setter.

You have alot of information about your class in the Velocity template already.

I guess you want to either input/resolve what the two classnames should be for extends and implements? I guess somekind of input box could appear for the user to input missing information.

But I guess it would be much better if JetBrains extended their own template editor for the user to generate whatever code they want.

Comment actions Permalink

The plugin is designed for generating methods to an existing class.

The plugin has a feature to automatic add implements to the class but this is not pr. template but global. There is a input field in the settings for this.

I can't recall if I added this feature also in the template itself. You can check the template documentation and try.

I am at work and unfortunately we use Eclipse only.

But keep reminding me abut this feature and I would try impementing it in a future release.


Please sign in to leave a comment.