" Focus on being productive instead of busy. "

Tim Ferris

Eclipse IDE Tips

I will not be wrong If I say, eclipse is the most used IDE for Java and other development. I'm using eclipse from almost around 2 years now, initially I was Netbeans lover. There is great amount of help available for eclipse on SO. There are some cool shortcuts that can save you lot of time while coding in eclipse

1. Code Completion : Eclipse's code completion saves you from lot of typing, just press ctrl+space to see the suggestions and select the one you want

2. Most used shortcuts : If you want to write the main method in a Java class, one way is to select the main method checkbox while creating the class itself. If you forgot to select the checkbox while creating the class, you can just type main and press ctrl+space and then press enter .

For System.out.println() = sysout
For System.err.println() = syserr
For try { } catch (Exception e) { } = trycatch
For switch (key) { case value: break; default: break; } = switch
For if(){} = if
For if (condition) { } else { } = ifelse

3. Deleting a line : To delete a line just press ctrl+d while your cursor is in that line

4. Commenting multiple lines : To comment multiple lines, just select all those lines and press ctrl+shift+/

5. Uncommenting multiple lines : To uncomment multiple lines, just select all those lines and press ctrl+shift+\

6. Running a project : To run a project just press F11 or ctrl+F11

7. Find/Replace in a File : Press ctrl+f to open the Find/Replace in a file

8. Formatting Code : Press ctrl+shift+f to format the code

9. Deleting current window : To delete currently opened window in eclipse press ctrl+w

10. Full Search : If you want to search in entire project or working set press ctrl+h

11. Generating Source : If you have a bean with lot of fields which requires setter/getters and constructor, you can generate source through GUI

Just play around IDE and you will be able to figure out many other interesting shortcuts in eclipse

If you know some life saving hacks in eclipse, please mention it in the comments below. Sharing is caring !!!