Saturday 31 December 2011

How to do Content Assist, Quick Fix and Class Navigation in Eclipse for Selenium automation


5. Content Assist, Quick Fix and Class Navigation

5.1. Content assist

The content assistant allows you to get input help in an editor. It can be invoked by pressing CTRL+Space
For example type syso in the editor of a Java source file and then press CTRL+Space. This will replace syso withSystem.out.println("").
If you have a reference to an object, for example the object person of the type Person and need to see it's methods, type person. and press CTRL+Space.

Content Assists

5.2. Quick Fix

Whenever Eclipse detects a problem, it will underline the problematic text in the editor. Select the underlined text and press CTRL+1 to see proposals how to solve this problem.
For example type myBoolean = true; If myBoolean is not yet defined, Eclipse will highlight it as an error. Select the variable and press CTRL+1, Eclipse will suggest creating a field or local variable.

Using Quickfix Example

Quick Fix is extremely powerful. It allows you to create new local variables and fields as well as new methods and new classes. I can put try-catch statements around your exceptions. It can assign a statement to a variable and much more.