views:

129

answers:

2

Hi,

i've read in the eclipse help that it is possible to "Delete getters and setters together with a field". I somehow cannot manage to get it work. Does somebody use this feature and could give me a hint what i'm doing wrong? In the eclipse help file the following is written: "When you delete a field from within a view, Eclipse can propose deleting its Getter and Setter methods. If you use a name prefix or suffix for fields, be sure to specify this in the Java > Code Style preference page." The way i understand it, eclipse should somehow ask me if i want to delete the getter and setter methods for a field that i just removed without any special configuration. This seems not to work. Thanks in advance for help.

kukudas

+3  A: 

This doesn't seem to work from the source editor, however, try deleting a field from the Outline View of the class - there it does offer to delete the getter / setter too.

Outline view is available in the JDT under Window: Show View. This also works from the package explorer.

Ninefingers
+1  A: 

Little off topic, but get rid of all your getter/setters. Use http://projectlombok.org/ in stead. It works great in eclipse. To answer your question, it works from the Outline View as someone has suggested. It is because the getter/setter method is linked to the field in the outline view.

fastcodejava