Archive for the ‘Eclipse’ Category
Templating with Eclipse
Today I came over a a post on dzone.com 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.
- http://firstclassthoughts.co.uk/java/eclipse_tip_templates_public_static_final.html
- http://www.phpeclipse.de/tiki-index.php?page=Howto+use+the+templates+system
- http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse.jdt.doc.user/concepts/ctemplates.htm
I guess if I had read the PHPEclipse manual when I first started using Eclipse, I would probably been using it from the start
Good luck with your Eclipse templates, I know I will be using them extensively.