开发者

Eclipse 3.5 "Delete getters and setters together with a field"

开发者 https://www.devze.com 2022-12-18 17:02 出处:网络
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 h

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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消