Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Getting started with Eclipse code templates

Move beyond snippets to increase your productivity

Jeremy Wischusen (cortex@visualflowdesigns.com), Flash, Flex, PHP Web Developer, Visual Flow Designs
Jeremy Wischusen has been designing Web sites since 1997 and programming since 2003. He has worked with Microsoft Gold Certified Partners to deliver software training for such companies as Wyeth Pharmaceuticals and The Vanguard Group. He has also worked on large-scale sites, such as myYearbook.com and for such clients as Dockers, Quicksilver, Major League Baseball, Sports Authority, CBS, and Liz Claiborne through GSI Commerce. He works with front- and back-end systems, designing many projects from start to finish using such technologies as Ajax, jQuery, CSS, XHTML, PHP, Flash, and Flex.

Summary:  This tutorial covers the basic use of Eclipse code templates. It takes a broad approach to expose the key concepts and skills that apply to templates regardless of the particular plug-in they're associated with. You will learn about the benefits of templates, how to create and edit them, and how to use them within the Eclipse IDE to increase your productivity.

Date:  07 Oct 2008
Level:  Intermediate PDF:  A4 and Letter (379 KB | 19 pages)Get Adobe® Reader®

Activity:  91865 views
Comments:  

Manipulating templates

Edit templates

Chances are, you're going to create a few templates that are not exactly what you intended. Fortunately, editing templates is a simple process, and you can edit templates that you create, as well as predefined templates.

Navigate to the HTML templates in the Preferences pane. When you arrive at the data grid, click the ego_trip template and click Edit. You should be looking at the same window you saw when you created your template.

Editing the template is simply a matter of changing the values for any of the fields you desire and clicking OK. Because you have already created a template, I don't spend any more time explaining how to edit it, as the process is basically the same. However, there is a trick worth knowing about.

Renaming templates

In the Name field, change the name of the template from ego_trip to ego_trip_2, then click OK. You should see a window similar to Figure 9.


Figure 9. Confirming the rename command
Confirming the rename command

If your intention is to rename the existing template, simply click No and you're done. If you click Yes, a copy of the existing template is saved with the new name. You can use this to quickly create new templates from existing ones. So, if you have a template that is, say 90 percent of what you need, you can open it, edit it, and save it with a new name, which is much faster than creating a new one each time. Remember that the entire idea behind templates is that you should not have to perform repetitive tasks. You should only be creating a new template from scratch if no template exists that you can customize.

So far, you learned how to create, use, and edit templates. This leaves only one possible task you can perform with them: deleting them.

Delete templates

Deleting a template is as simple as selecting it in the templates data grid in the Preferences pane and clicking Remove.

5 of 9 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source
ArticleID=342826
TutorialTitle=Getting started with Eclipse code templates
publish-date=10072008
author1-email=cortex@visualflowdesigns.com
author1-email-cc=