Paul Croarkin Paul Croarkin - 2 years ago 145
Java Question

Eclipse Custom Variable for Java Code Templates

How do you add a new variable to be inserted into a Java code template. How do I add a variable to the list in Window->Preferences->Java->Code Style->Code Templates->Code->New Java Files->Edit->Insert Variable... ?

Currently my new files get created with:


I'd like them to get created with something like:


where begin_filecomment and end_filecomment appear in the Insert Variable list.

Answer Source

I'm pretty sure that the list of "variables" is generated by Eclipse and there is no way to add a new template variable.

What do you want ${begin_filecomment} and ${end_filecomment} to be? Just type the content into the Edit box - there is nothing that says you cannot put static content in there.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download