Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Eclipse so it adds private fields at the bottom of a Java class?

Tags:

java

eclipse

How to configure Eclipse so it adds private fields at the bottom of a Java class?

By default when I select 'create a field..' the field gets added at the top of the class. Can I configure Eclipse so the fields are added at the bottom instead?

like image 918
Alexander Kulyakhtin Avatar asked Jul 12 '12 20:07

Alexander Kulyakhtin


1 Answers

Window > Preferences

On the left choose: Java > Appearance > Members Sort Order

On the right select Fields and check Sort members in same category by visibility.

After that right-click your project and choose Source > Sort members... to modify the source code. You can configure Eclipse to execute this action automatically on save: go once again to the preferences Window > Preferences and then Java > Editor > Save actions, and click on Configure for additional actions.

like image 186
Adam Stelmaszczyk Avatar answered Sep 28 '22 18:09

Adam Stelmaszczyk