Friday, May 5, 2017

How to use eclipse effectively ?

Almost , most of the developers are using eclipse. But very rare developers only know all the tricky parts of eclipse IDE, means some shortcuts and way of using eclipse effectively. 

Here I am providing lot of wonderful tips and tricks of using eclipse. Remember this handling techniques you must do it again and again. I assure your productivity will increase compared to your earlier.

1. What is Open Type in eclipse ?

    Shortcut is Ctrl + Shift + T, Which will open any class , interface etc., Remember Ctrl + Shift +       R, which will open a files.

2. What is quick outline and How to use that ?

    Shortcut is Ctrl + O,  which will show you all the methods available in the current class. Press once again Ctrl + O,  which will show you inherited members for current class.

You can search method or inherited members also possible at the top search box.

3. What is open Type Hierarchy ?

    Shortcut is Ctrl + T or F4 , which will show you the hierarchy of your files. Means, inheritance class or implements interface. If you will press again Ctrl + T, it will only show you the super type hierarchy.

4. Search with eclipse Java Search File Search Method search etc.,

   You can click Search icon from the toolbar or Shortcut is Ctrl + H or by menu Search -- > Search, which will show you the effective way for search method , package , constructor etc.,

If you dont know the exact name of method or any other searchable word, just use * . eg. *action

5. What is open Declaration ?

    Right click on variable or object whatever it is, click open declaration or Shortcut F3,  which will show you where it was declared.

6. What is open call hierarchy ?

    Really a wonderful feature by eclipse to check where the caller, callees etc., Shortcut is Ctrl +Alt + H,  After call hierarchy window open check the right corner menu to get more like caller Hierarchy, callee hierarchy , history etc.,

7. References in eclipse ?

    Shortcut is Ctrl + Shift + G, it will show you related references from work space , Project , Hierarchy etc.,
    
8. Generate constructors using fields ?

     Like generate setters and getters there is an option to generate constructor also based on your class field. You can travel by Alt + Shift + S or go by Right Click.


9. Templates , how to use ?

   Eclipse templates will give you the best shortcut option for your code, for eg , sysout and putting Ctrl + Space will show you Syste.out.println . Like this you can create your own template.

I will post a separate topic , how to add new template in eclipse. Until then If you want to check about templates, Window - > Preferences - > Java -> Editor -> Templates.

12. Formatting source code by eclipse ?

   Shortcut is Ctrl + Shift + F,  which will format your source code. Suppose if you need your own style format code you can add it by code Style option. 

13. Refactor code in eclipse for local variable constants and method?

   Code refactor is the big topic , and I will post you the separate post for this. Its nothing but, will you an option to rename the method or variable or whatever , it will reflect all place. Moving the code , extract the code also possible.

14. Enable line numbers 

   Line number of the code is useful when you get error which will show nth line number missing ; So if you enable line number , you can go directly to code line.

To enable Right click side bar of the code and select Show Line numbers option.