I have learnt from CS2020 a few useful tricks to make my life easier and an enjoyable one when using the eclipse.
This is a feature, not a tip, but I really like the automatic indentations in eclipse. When copying and pasting codes, they are automatically indented in the context, saving the trouble of indenting them manually.
Here are some useful short-cuts and tips I learnt so far. This list may be expanded in the future.
Multiple edits (of the same variable name)
Alt + Shift + R
Very useful for changing the name of variable halfway
Crtl + Space
This is like tab in linux and sublime text. eg.
sysout in java will be auto-completed as
Ctrl + Shift + F
Automatically add or delete extra spacings to make code neat and clear, also fixes the over-lengthy lines
Auto fix import
Ctrl + Shift + O
Automatically add the necessary imports and delete unnecessary imports for the class
Auto-add getters and setters
Source – Generate Getters and Setters
This automatically add these two classic methods to the class body
Select the code and right click and choose Refactor, extract method
This helps to break down a long method to several sub-methods to make the code more organized, also helps to maintain layers of abstraction by establishing hierarchy in methods.