Kristian Lunde

Archive for the ‘Eclipse’ Category

Templating with Eclipse

without comments

Today I came over a a post on about Eclipse and templating. It turns out that you can write small templates of code snippets you use a lot and bind them to a keyword. When typing the keyword, press “ctrl” and “space” and a list of possible templates available will appear, select the prefered template, press “enter” and the code snippet is inserted into your working code. I works just the same way code completion. This actually means that you do not have to write the boring “for” loops or “if” tests anymore, just write a template and become a more efficient developer.

The original post explains how to set up templates, so I will not go into that in this post, but since I am primarily a PHP developer and the post describes templating for Java, I’ll just give a description of where to go if you use the PHPEclipse.
To edit and create templates for PHP, HTML or css, even javascript you have to use this path:

window -> preferences -> PHPeclipse Web Development -> PHP -> Templates.

To write and edit the templates, just follow the guidelines from Mr. Graversen, or have a look at the links below.

For further reading have a look these sites.

I guess if I had read the PHPEclipse manual when I first started using Eclipse, I would probably been using it from the start :P

Good luck with your Eclipse templates, I know I will be using them extensively.

Written by Kristian Lunde

August 20th, 2008 at 10:18 pm

Get Adobe Flash player