views:

640

answers:

4

I have this code template in Eclipse

@since ${date}

when entered i get something like this :

@since 4.8.2009

But when i add the same template (@since ${date}) to NetBeans it outputs

@since date

Can someone help ?

No answer yet ? Is this not possible in Netbeans ???

A: 

Note: With NetBeans 6.5/6.7, if you do not find that template, you could create it.

See this tutorial.

VonC
Thanks for the answer. i know i can create my own templates, but the problem is with the missing ${date} variable or something equal. ${date} only returns "date"
Ari B
A: 

I'm pretty sure this is not possible in Netbeans, or at least not worth the amount of trouble. It's possible that you could author your own Netbeans module, add a code template to the module (in which you might be able to put the ${date} as an extra variable, I'm not sure), and then add the module to Netbeans. But you could also just type the date in, which, unless you type it several thousand times per day, would probably take less time.

David Hollman
Thanks David for the answer. I guess that you are right. The only solution that i have found is to simply change the code template every day to get the right date.
Ari B
A: 

Your snippet looks like freemarker code. This is used in Netbeans for file templates (Tools -> Templates). If you put ${date} in a file template it will get transformed when the file is created to the current date. If you're trying to use it as a code template I don't know how that works.

JRL
I have noticed this and that´s why i thought that i could find something similar to ${date} for the code templates. Thanks JRL by the way for your findings.
Ari B
A: 

Inserting ${date?date?string("yyyy")} within your template will do the trick (if you want year only)

Akiva Levy
Thanks for the tip i will give it a try.
Ari B