| Author |
Wednesday's cool Eclipse feature of the day
|
Ed Burnette
Author
Ranch Hand
Joined: Jun 10, 2003
Posts: 142
|
|
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!
|
Ed Burnette, Author of Hello Android
Blog: ZDNet's Dev Connection - Twitter: @eburnette
|
 |
Ashik Uzzaman
Ranch Hand
Joined: Jul 05, 2001
Posts: 2370
|
|
I feet Eclipse has many this sort of hidden cards
|
Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
|
 |
Karthik Veeramani
Ranch Hand
Joined: Dec 22, 2002
Posts: 132
|
|
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."
|
 |
Karthik Veeramani
Ranch Hand
Joined: Dec 22, 2002
Posts: 132
|
|
|
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!
|
 |
Faisal Khan
Ranch Hand
Joined: Jun 29, 2003
Posts: 285
|
|
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.
|
 |
Rene Larsen
Ranch Hand
Joined: Oct 12, 2001
Posts: 1179
|
|
If you go to: 'Window->Preferences->Java->Editor->Templates' you'll see at complete view of the 'hidden' feature. Rene
|
Regards, Rene Larsen
Dropbox Invite
|
 |
Faisal Khan
Ranch Hand
Joined: Jun 29, 2003
Posts: 285
|
|
Thanks Rene, I just had a brief look through it, its great and I guess the best thing is you can create you own features to make life easy. - FK
|
 |
Ed Burnette
Author
Ranch Hand
Joined: Jun 10, 2003
Posts: 142
|
|
Originally posted by Faisal Khan: are these kind of tips and tricks discussed in the book...?
The template one is discussed in the book. The command shell one I found after the book was written.
|
 |
David Gallardo
Author
Greenhorn
Joined: Jul 07, 2003
Posts: 18
|
|
|
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"
|
 |
 |
|
|
subject: Wednesday's cool Eclipse feature of the day
|
|
|