In right click menu have Source-> generate Getters and Setters
.On selecting the option, the user can select the variables for which getter and setter need to be generated.
I want something similar.
Source-> generate increment code.
User can select the variable names from a list populated from his class attributes.
the generated method will look like
private Integer abc;
public void incrementAbc(){
abc++;
}
I was thinking of extending the popupmenu plugin to create the options in the menus. But how do I make the code to be autogenerated on selection by user. Is using fast code template the answer. I new to plugins and I am confused. PLease do help.
You can define a template in eclipse for that which will create a default variable and implementation, but then it won't bein the source submenu. I think that's the closest you can do. Maybe you could create a template which will create an increment method for the last appropriate class property.
I cannot try without eclipse but this should give you a start: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Fconcepts%2Fconcept-editor-templates.htm&cp=1_2_6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With