A programmer uses the keyboard more often than the mouse, and when typing, a right click to select a function also costs much time and effectiveness.
No matter you’re an eclipse user or a new comer to Eclipse, the following list of shortkeys can help you to save much time.
Ctrl + Shift + O : to open Resource.
You can use this shortkey to open almost everything, and the good news is that you can use expression character like * or extension like .java or .html… eg: if I want to search for a Java file that contains “Test” in the file name, I can use the expression like the above: *Test*.java.
Ctrl + / : to comment a line, Ctrl + Shift + / to comment multiple lines
Ctrl + E : to open current editors, you can use expression here to search for file name.
Ctrl + O : to open Inherited Members of class.
Tips: you can also use expression to search and jump to methods or fields.
Ctrl + Shift + O: To organize Imports
Most of the time, Eclipse can automatically imports classes in other packages for you. But sometimes you need to import them manually. Use Ctrl + Shift + O can help you import unique class automatically and for classes that have the same name, it will popup a selector for you.
Ctrl + Shift + R : Rename and Refactor
This short key not only helps you to rename class/file but also refactors any references to the class.
Alt + Shift + L : Extract Local Variable
Alt + Shift + M : Extract Method
Alt + Shift + C : Change Method Signature
The above are three useful short keys for refactoring code, if you don’t remember the short keys, just right click in the editor and select Refactor, a menu likes above will appear to remind you.
Alt + Shift + F : Format code
Sometimes you need this, sometimes you won’t. But it’s a useful short key. If your project have a standard code format, use this short key can help you to organize code for better reading.
Ctrl + 1 : Quick Fix
You will use this Short key most of the time you see a problem
Ctrl + Space : Content Assist
Code completion, code assistance and more, just
Alt + Shift + S then R : To generate getter and setter methods
This is very useful when you create javabeans or entity classes, just declare the fields in private and the short keys will help you to generate corresponding getter and setter pairs.
Ctrl+H. To open search box.
Again you can use expression here to search for everything visible in the project. And to me File Search is enough so I can click Customize to check only File Search for the next Search.
Ctrl+Shift+L. Displays all short keys
This must be the final but useful short key. Use it to study and explorer the all and the rest of useful short keys for yourself.
That’s all I can think of for today. Hope this post helps you, if you know any good short key, please share it with me, thanks.