• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Wednesday's cool Eclipse feature of the day

 
Author
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 2379
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I feet Eclipse has many this sort of hidden cards
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Karthik Veeramani
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you go to: 'Window->Preferences->Java->Editor->Templates' you'll see at complete view of the 'hidden' feature.
Rene
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Author
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic