Friday September 28, 2007
FreeMarker: Baked into NetBeans IDE 6.0 (Part 1)
If you're a fan of FreeMarker, then there's good news for you. In fact, three pieces of good news. To really get the point, look at the following pics. The first comes from NetBeans IDE 5.5, when you open the Java Class template in the editor:
This is that same entry in the Template Manager, but this time in NetBeans IDE 6.0:
What's going on here?! Well, that's FreeMarker. As you can see, the Java class template in NetBeans IDE 6.0 is defined in FreeMarker. Once you have opened that file in the editor, you can change and save it, and from then onwards your additional FreeMarker script will be used to generate Java classes. You can also create new templates in FreeMarker and then save them in that Template Manager for reuse.
How about some syntax coloring and other editor support? That's the second bit of good news. I've looked around in the Plugin Manager, but couldn't find anything related to this. However, it seems that our good friend Schliemann is in the process of learning FreeMarker, judging from a quick inspection of the NetBeans sources:
Now, what is really interesting is understanding how it all works. NetBeans IDE 6.0 provides built in support for scripting languages. (Read all about it here.) Of all the scripting engines, FreeMarker comes bundled with the IDE out of the box. However, you can also create templates in other scripting languages covered by JSR 223. I, of course, immediately started looking at Groovy in this context, but haven't got very far yet. But isn't this basically one of the purposes of scripting languages—to quickly throw some scripts together and to try them out? Then why not keep them as templates. FreeMarker is specifically created for this, but other scripting languages could be used in this way too. But that's something that requires new modules to be added, i.e., modules that provide the scripting engine of the language in question. And so that's the third piece of good news—conceivably, you could end up writing templates in a whole host of scripting languages.
For more on FreeMarker in NetBeans IDE 6.0, read Migrate to Freemarker from Velocity template engine in your NetBeans Module and FreeMarker support in NetBeans?.
In other news. Want to see how to create a module that provides a FreeMarker file template? Go here and download the sample.
Sep 28 2007, 06:58:07 AM PDT Permalink
Tranks for you the net beans
Posted by Anddy SANCHEZ DE LA CRUZ on September 28, 2007 at 01:29 PM PDT #
What I see in teh NB6 template suggests that the license it includes comes from some kind of variable? Does this mean you can configure it somewhere in your project?
Posted by quintesse on September 29, 2007 at 08:31 AM PDT #
Yes, that's possible, quintesse. As described here:
I am working on a sample that will include this. Watch this space for more info on this point.
Posted by Geertjan on September 29, 2007 at 08:58 AM PDT #
dfsfdsfds
Posted by 213.22.92.74 on February 10, 2008 at 10:07 AM PST #


