Freemarker filetype with netbeans
One of my favorite development platforms is Netbeans. Ich was often dissapointed that there were no support for the Freemaker template language in any version of Netbeans. For a while there are some plugins available. The last one which could also be installed with the plugin manager of Netbeans seemed to be very useful. But this was fatally wrong. The plugin slows down the speed of the editor that it is incredible to work with. Either code completion of CSS and HTML were not working correctly.
My idea was to create a plugin with the file type of the freemarker template extension ‚ftl‘. And the mime type of text/html or xhtml.
1. Create a new project Netbeans Modules -> Module, click next.
2. Set project name to e.g. freemarkerfiletype, click next.
3. Name the Code Name Base to e.g. org.freemarkerfiletype, click finish
4. Right click on project name New -> Other, Module Development -> File Type, click next
5. Set MIME Type to text/xhtml and extension(s) to ftl, click next
6. Set Class Name Prefix to Freemarker, choose an icon and click finish
7. Edit the generated FreemarkerTemplate.ftl file to you own.
8. Right click in project -> Create NBM
9. That’s it.
Install the new plugin and restart the ide.
You will find the new file type under File->Categories->Other ‚FreemarkerTemplate.ftl‘
Now it is working as a xhtml file. You will see that there is no support for the freemarker specific tags, that’s an issue for later.