The Artima Developer Community
Sponsored Link

Java Buzz Forum
Eclipse Tip: Code Templates

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Vasanth Dharmaraj

Posts: 594
Nickname: vazz
Registered: Oct, 2003

Vasanth Dharmaraj is J2EE developer learning Dot Net
Eclipse Tip: Code Templates Posted: May 17, 2004 2:06 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Vasanth Dharmaraj.
Original Post: Eclipse Tip: Code Templates
Feed Title: Vasanth Dharmaraj's Blogs
Feed URL: /SyndicationService.asmx/GetRssCategory?categoryName=Technology%7CJava
Feed Description: my thoughts on dot net, java, linux, formula one, xbox gamming...(my java category)
Latest Java Buzz Posts
Latest Java Buzz Posts by Vasanth Dharmaraj
Latest Posts From Vasanth Dharmaraj's Blogs

Advertisement

Code templates are commonly used code fragments which can be inserted into the source code. Eclipse provides a nice mechanism to do this. Just type 'main' in the Java editor and press 'Ctrl + Space'. You can see the code completion window as shown below. If you choose the second option you can insert a code template.

In the above example you will have the following code inserted.

   public static void main(String[] args) {
       
   }

This is a very simple template. There are more templates which can hold variables editable in linked edit mode and can be a bit intelligent too. For example if you use the 'catch' template it will intelligently add all the exceptions that need to be caught. You can find the list of templates in Window > Preference > Java > Editor > Templates. There are templates for looping through arrays, collections etc.

The nice thing about templates is that you can edit the existing ones to suit your needs and creates new templates. You can import and export templates too. This way you can share the templates with your team.

Read: Eclipse Tip: Code Templates

Topic: Another reason to dig Spring Previous Topic   Next Topic Topic: What's in an envelope?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use