This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 107725

Summary: Missing tool for define own template variables
Product: platform Reporter: tprochazka <tprochazka>
Component: FavoritesAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: gsporar, jpokorsky, mkleint, mpetras
Priority: P4 Keywords: REGRESSION
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description tprochazka 2007-06-21 21:55:16 UTC
In Netbeans 5.5 was in Advanced Options -> Editing -> Java Sources ->
String Table where was: USER=xyz and you can add there own variables and use
it in templates as __USER__. I was using COMPANY, USER_EMAIL, etc.

But in Netbeans 6 is this feature missing, in new template system, you can
use variable ${user}, ${date}, ${time}, etc. But doesn't exist tool for
define own variable. I suggest add this directly to Template Manager.

I missing also code completion and syntax highlighting for templates :-(
Important usability problem is that Template manager close when I open any
template and I must open it again and again :-(
Comment 1 Jesse Glick 2007-06-21 22:21:01 UTC
apisupport/templates is unrelated. Please use the 'ide' component if unsure.
Comment 2 Jesse Glick 2007-06-21 22:30:33 UTC
AFAIK this is as designed; you can create additional files to include which could define various variables or insert
other stuff (see Freemarker docs for syntax). But Jan can clarify.
Comment 3 tprochazka 2007-06-21 22:58:09 UTC
to jglick: sorry, maybe will be better remove "templates" from apisupport component description

to jglick: But it require include something to all templates, this is a bit complicated when I need for example modify 
${user} variable.
Comment 4 Jan Pokorsky 2007-07-09 14:50:11 UTC
The only way how to customize ${user} is to set the system property user.name IMO.

I can speak only for the java module where the old templates support for .java files was implemented in previous
releases. The old Advanced Options -> Editing -> Java Sources -> String Table was removed since it would be unusable by
other templates now.

AFAIK Jarda who introduced the new template support has no plan to implement neither code completion nor syntax
highlighting for Freemarker templates nor UI for templates attributes. But I can be wrong.
Comment 5 Jaroslav Tulach 2007-07-09 16:21:12 UTC
*** Issue 100199 has been marked as a duplicate of this issue. ***
Comment 6 Jaroslav Tulach 2007-07-09 16:21:53 UTC
Imho, the correct way to do this with FreeMarker is to define one file which will be included by all other templates. This file would have content 
like:

# override the user name, if not defined here, it is taken from system
# name=Your name

etc. but this can be done manually by any user - it is not necessary to handle this in the system - thus lowering priority.

Comment 7 tprochazka 2007-07-09 17:22:29 UTC
One file with variables definition is not problem, but problem is include it with all templates. This too complicated 
for most of user. Much better would be if this file will be auto-included with Netbeans template system.
Comment 8 gholmer 2007-08-03 14:39:52 UTC
There needs to be an easy way for users to define these strings, whether it's documenting how to use an external file or
having some kind of editor. My use case is USER="Glenn Holmer &copy;Weyco Group, Inc. 2007".
Comment 9 Trey Spiva 2007-08-03 15:21:52 UTC
I agree, this is a usability issue.  You are going to require uses to modify every template in order to add the user name? 
Comment 10 Jaroslav Tulach 2007-09-25 16:36:01 UTC

*** This issue has been marked as a duplicate of 114625 ***