How to manage templates in NetBeans I
NetBeans contains many predefined templates for creating new files, but these templates don't have to fit your needs and you want to change or create new templates. I will try to explain it from PHP point of view, but this is generic NetBeans future, no PHP specific. Originally I have prepared one blog entry about this, but then I realized that this is too long. There is the first part, which describes "static" templates.
Basically it's very simple. You can do it from Template Manager, which is opened after invoking Templates item in Tools menu.
As you can see from the picture you can add, delete, rename or sort the templates as you want. You can also open the selected template in editor and change its content or you can create new template category. For example I have created new category My PHP Templates, then I added three PHP files and one html file to this folder. All these files I had somewhere on my local disk. In the moment when you add a file as a template, NetBeans copy the file into your userdir (place where NetBeans store settings) and from this moment NetBeans works with this copy.
All changes, what I have done in the Template Manager, are reflected in the New File Wizard.
There is also other way how to add new template. If you have a file in a project and you think that this file is suitable for new template, then you can invoke Save As Template... action from context menu over the file.
After invoking Save As Template... a simple dialog is opened to choose the category, where the new template will be placed. As in the previous case, the file is copied to your userdir and you can edit or remove the original file without changing template. If you want to change the content of the template, rename or delete the template, you can do it in the Template Manager.
This was easy. In the continue of this I will describe how you can write templates, which are process with a scripting engine and the content is altered during creating new file.

Petr, thanks for blogging about templates in NetBeans. It's helped to identify problems or weakness in handling of file-templates in NetBeans IDE. Many of problems were fixed in NetBeans 7.0 Milestone1. I've blogged about it at http://blogs.sun.com/rechtacek/entry/improved_handling_of_file_templates.
Posted by Jiri Rechtacek on December 05, 2008 at 05:36 PM CET #
tt
Posted by 194.254.15.136 on June 03, 2009 at 02:33 PM CEST #