Monday, December 2, 2013

Eclipse/STS IDE shortcuts

Hi Friends,

After a long gap i.e. near about a year, today I want to blog some of the useful shortcuts that will help us in coding any program using IDEs such as Eclipse and STS (Spring Source Tool Suite).

Its suggested that any java beginner programmer to use notepad/notepad++ as editor to start their coding. However IDEs like Eclipse and STS will increase speed of programming as they are built with lot of shortcuts. Today we are going to discuss some of the very useful shortcuts those will increase our speed of programming.

As STS is built up on Eclipse IDE, most of shortcuts that I explain in this blog are common for both editors.

File Navigation

 CTRL + SHIFT + R - To open a resource (any file like .java, .jsp etc) in the projects present in current workspace of IDE.

CTRL + PAGE UP or PAGE DOWN - Nagivate to previous or next file from within the list of all open files.

CTRL + E - To display all open file list.

ALT LEFT ARROW (<-- alt="" arrow="" or="" right="">) - Navigate to previous or next edit positions from edit history.

Editing shortcuts


CTRL + SPACE - Type assist (For ex: if you type Str and then presse ctrl + space in some x.java file then it will show all available options like java.lang.String class etc. to complete your choice without typing full word)

CTRL + SHIFT + F - Will format the code according to the preferences set in IDE. You can change format preference by navigating to 'preferences' section of IDE.

CTRL + O - Will show list of methods (including inherited) of class (For ex: In X.java you have methods names x(), y(), z() and you pressed ctrl + o in that file then it will show all three methods)

CTRL + SHIFT + O - Will organize your class imports section. It will automatically remove/add any unused/required imports to fix import compile errors.

CTRL + SHIFT + C - Will comment selected lines (like // before starting of each line).

CTRL + SHIFT + / - Will comment selected lines as a block comment (like /* .. */).

CTRL + SHIFT + \ - Will uncomment selected commented block.


When you are free, don't hesitate to try these and post your feedback. Will discuss about some more useful shortcuts in next posts.