Sort items in Eclipse by visibility without sorting alphabetically

I am curious if it is possible to sort diefferent types such as fields, methods, etc., but not alphabetically . I know that I can sort the participants using Source -> Cleanup . But he continues to sort it also in alphabetical order. I just want to sort by visibility and save the rest of the old order.

Example:

 public class Person { private Person(final Long id, final String name, final String surname) { } public Person() { } private Long id; private String surname; private String name; public final static String SOME_CONSTANT = "SOME_CONSTANT"; } 

After sorting it should look like this:

 public class Person { public final static String SOME_CONSTANT = "SOME_CONSTANT"; private Long id; private String surname; private String name; public Person() { } private Person(final Long id, final String name, final String surname) { } } 

But I get:

 public class Person { public final static String SOME_CONSTANT = "SOME_CONSTANT"; private Long id; private String name; private String surname; public Person() { } private Person(final Long id, final String name, final String surname) { } } 
+4
source share
1 answer

A pure alphabetic appearance is not possible in Eclipse without a plugin. Have you tried configuring Source-> Sort Members (Settings-> Java-> Appearance-> Sort Members)?

However, you can find some alternatives in this post: Eclipse organize methods in alphabetical order

+2
source

All Articles