Wednesday, November 7, 2012

7 basic tips to be a Pro Code Surfer with Eclipse

In this short article I want to show to the “newbies” of Eclipse some basic tips that are essential in big projects when we need to “surf” trough a lot of “waves” of code.

1. Look for resources

Forget that old folder/package hierarchy navigation style. If you know the name of the resource you are looking for, or at least part of it, use the resource opener feature (CTRL + SHIFT + “R”). You can use wild cards in case you forgot the full name.

2. Open type.

Want to go beyond the frontiers of your (*.java)'s? If you want to open a file contained in a JAR, a .class for example, then the open type feature lets you do that (CTRL + SHIFT + “T”). Of course you can only open a .class as long as you have the .java in the same jar or you had configured a Java decompiler (out of the scope for this day).

3. Class/Object code appearances

Sometimes you want to see in a big scale where are the appearances of a certain class or object. By simply double clicking the class or object the IDE will highlight all the appearances making it easier for us instead of going line by line or using the find command.

4. If inside a class there is a reference of another one, just press and hold CONTROL key, the class will be underlined letting you know that you can click it and then travel to that one.

5. References

Want to know how popular is your class or method? Use the references opener to find it out. Select your class or method, right mouse click > References > [Workspace | Project | ...]

6. Call Hierarchy

A long line between your method and its originator? Do not try to be a paleontologist, use the call hierarchy to find its origins. Right click on your method > Open Call Hierarchy (or CTRL + SHIFT + “H”) and “voila”.

7. File Search

When the thing your are looking for is pretty much hidden in your code, including XML, JavaScript, JSP, *, then what you need is a file search: CTRL + “H”

No comments:

Post a Comment