Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an Eclipse shortcut to sort members by modifier?

Tags:

java

eclipse

I'm looking for a shortcut, preference or plugin in Eclipse which will sort Java members by visibility modifier. Specifically, I'm looking for the class to be sorted like this:

public someClass {
   //public variables go first followed by 
   //protected and default variables and lastly
   //private variables

   //public methods above
   //proteted and default methods with
   //private methods at the bottom
}

I'm not fussed about alphabetically, only the visibility modifier.

like image 769
Chris Knight Avatar asked Nov 04 '10 15:11

Chris Knight


People also ask

What is Ctrl D in Eclipse?

Ctrl + D. Deletes current line in the editor. Command + Shift + O.

What is the use of Ctrl Shift T in Eclipse?

Switching between Open Editors Ctrl + Page Up and Ctrl + Page Down—Navigate to previous or next file from the list of open files. Ctrl + Shift + T—Display a list of classes from the workspace. Ctrl + Shift + R—Display a list of resources from the workspace.

What are the shortcut keys in Eclipse?

The Key Assist action which can be invoked by clicking Ctrl + Shift + L shows us all the accelerators or shortcut keys available in Eclipse. The key combination assigned to an action can be changed using the Keys preference page. There are many commands or actions in Eclipse for which there are no shortcut keys.

How do you use Ctrl 2 L in Java?

One of my most used shortcut is ctrl-2 L, which will automatically assign a variable with a name and import the necessary class. new View(); and press Ctrl-2 L, which results in: View view = new View();


1 Answers

Window->preferences->Java->Appearance->Members Sort

like image 84
Bivas Avatar answered Nov 02 '22 20:11

Bivas