Related How to:‎ > ‎

Eclipse Shortcuts

Useful Eclipse shortcuts and hints: 

Using Eclipse shortcuts and code generation can make programming faster and more efficient.

Auto Complete:

I’m sure you noticed when you type a variable and then a period, a list pops up with the methods that variable has. However, sometimes you may be in the middle of typing a function or want to get the variables and methods list on ‘this’ without typing ‘this.’ To bring up that list at any time, press

- Control + Space Bar

You can then keep typing to narrow down the list, use arrow keys to navigate the list, tab to view the JavaDocs, or enter to finish typing the name.

Auto Imports:

This is my favorite feature. Lets say you want to use a LinkedList. You either have to import java.util.LinkedList at the top or use the full package name every place you want to use it. Instead, just type “LinkedList list;” You will notice Eclipse will mark it red because it can’t find the class. Then press

- Control + Shift + O for Windows or Linux.

- Command + Shift + O for Mac

This will organize your imports by including classes you need, or removing unused imports.


Generate Getters and Setters:

Right click on your class file and go to ‘Source’ -> ‘Generate Getters and Setters’ and select the getters and setters you want for which variables.

Override / Implement methods:

If you implement an interface or extend a class, Eclipse will give you an error for not implementing required methods. To fix this, just click on the error and click ‘Add unimplemented methods.’ Sometimes it is useful to see a list of methods you can implement or override. To do this, right click on your java file and go to ‘Source’ -> ‘Override/Implement Methods.’ Then select the desired methods.


A lot of times, it can be useful to know what methods use certain methods, variables, or classes. To find where something is used, select the name, and press

- Control + Shift + G for Windows or Linux.

- Command + Shift + G for Mac

 You can also right click on the name, and go to ‘References -> workspace.’ Notice you can also search the project or hierarchy. You can also find where something is declared by selecting ‘Declarations’ instead of ‘References.’