eclipse

Eclipse Shortcuts

Introduction#

Eclipse has many shortcuts to make your life easier.

Comment/Uncomment code

To comment or uncomment code select the lines and use Ctrl + Shift + C or Ctrl + Shift + /

Open Resouce Dialog

To access the Open Resource dialog use Ctrl + Shift + R. From here you can start typing a resource name and it will find all matches in the workspace, this makes it easier to find a file when you don’t know exactly were it is.

To get a println

If you want System.out.println(); but don’t want to type the whole thing out you can just type syso and hit Ctrl + Spacebar. It will type the rest and set the cursor between the parenthesis.

Generate Getters and Setters

Eclipse can generate basic getters and setters for you. Right click in you class file and go to Source - Generate Getters and Setters (ALT+SHIFT+S). This will open a dialog where you can choose which fields you would like to have getters and setters generated for.

Refactor Highlighted Text

Renaming a variable or class is usually a tedious task, by searching for all the locations where it is used. This can be significantly speeded up by highlighting the word, pressing Alt+Shift+R and then typing the new word. Eclipse will automatically rename the word in every file where it is called.

Format xml

When you add entries to an xml or copy from other sources, there often tends to be uneven tabs and spaces around the entries.

When you press Ctrl + Shift + F, you easily align the entire document and remove the extra tabs as well. Thus the text gets formatted and eventually becomes readable.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow