Try this in the Java editor: go to a blank line and type "for" (3 letters without the quotes) and press Ctrl-Space. You'll get several options including: for for - iterate over array for - iterate over array w/temporary variable for - iterate over collection etc... Select the second one, iterate over array. The Java editor will create a for loop for you and take a guess at some variable names. But that's not all. Notice the index variable is highlighted - now without clicking anywhere else start typing something and Eclipse will change the variable name in *all 3 places* it occurs. Now hit tab, and the editor will jump over to the array name and allow you to change that too. Now to really blow your mind, these templates are completely user definable and editable. Select Window > Preferences > Java > Editor > Templates. Scroll down until you see the definition for "iterate over array" under "for" to see how this one is defined. Enjoy!
Ya i found that feature useful... Similar is this feature - block a piece of code, right click and goto Source. Theres a cool option for surrounding with try catch block... i use this very often.
Thanks<br />Karthik<br />SCJP 1.4, CCNA.<br /> <br />"Success is relative. More the success, more the relatives."
Joined: Dec 22, 2002
Theres another feature i found real cool. if we start typing that our class implements a method,eclipse suggests error, saying the methods r not implemented. and as correction, it inserts all the methods in that interface into the code, saving us from typing in so many possible interface methods!
Ed, Thanks for the cool tips, are these kind of tips and tricks discussed in the book or does it require a new Eclipse Hack book. Is it matter of experience or can I go and read more about the hidden dragons inside Eclipse. I can see how you can really speed up your development if you utilise Eclipse. I have beenusing a basic text editor with ANT until now. - FK
The secret to creativity is knowing how to hide your sources.
Tips and tricks are presented throughout the book, where it makes sense. But the best place to get a comprehensive list is in Eclipse. Select Help->Tips and Tricks from the main menu. You can then browse through tips and trick for either the JDT, the platform or the PDE.
Co-author: "Eclipse in Action: A guide for the Java developer"<br />Author: "Java Oracle Database Development"