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 114625

Summary: Regression: unable to customize user property
Product: platform Reporter: m_potociar <m_potociar>
Component: FavoritesAssignee: Jaroslav Tulach <jtulach>
Status: VERIFIED FIXED    
Severity: blocker CC: anebuzelsky, gsporar, hmichel, jpokorsky, jrechtacek, mpetras
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description m_potociar 2007-09-04 13:36:03 UTC
In NB5.x it was possible to customize user property using a string table in advanced options. This customization affects
code generation from file templates as this property is expanded into javadoc as a value of @author anotation.

I used to customize the user property to contain more details: "Name Surname (name.surname at myemail.com)"

In NB6, this string table is not available and there is no UI that would allow me to customize the property. For
experienced NB5.x users it might be a significant usability issue.

There is one workaround I eventually found after I spent some time unsuccessfully trying to get some help directly from
NB core developers:
- start netbeans with additional "-J-Duser.name="Name Surname (name.surname at myemail.com)" parameter
This workaround is rather ugly though and not easy to figure out.
Comment 1 Jaroslav Tulach 2007-09-05 13:16:22 UTC
Jan, I think it would be great is there was a file general.freemarker that would be included by all templates, 
especially the Java one and which could user modify to contain user.name="...". This file would be visible in 
Tools/Templates and user could change it.

Do you think this is good idea to create such file?
Comment 2 Jan Pokorsky 2007-09-05 14:29:39 UTC
It seems to be better than the present state. I just do not understand why you assign it to the java module. IMO the
file should be registered by the FreeMarker integration module in order to be available to all FreeMarker clients. Have
you considered possibility to read general.freemarker file content to the scripting environment directly without
necessity to import the file? Later someone might also require to have certain properties project specific. The template
manager will be unusable to edit such properties then.

BTW is not this a duplicate of issue #107725
Comment 3 Jan Pokorsky 2007-09-06 10:39:06 UTC
We agreed with Jarda he takes care of this. openide/templates could be the right place. Reassigning ...
Comment 4 Antonin Nebuzelsky 2007-09-07 09:46:51 UTC
TM=6.0beta2
Comment 5 Jan Pokorsky 2007-09-19 14:16:52 UTC
*** Issue 104358 has been marked as a duplicate of this issue. ***
Comment 6 Jaroslav Tulach 2007-09-25 14:54:01 UTC
I'll fix it by changing core/favorites to read Templates/Properties/*.properties files with values define there. I'll 
change projects/projectui to define a file there with value for property user.
Comment 7 Jaroslav Tulach 2007-09-25 16:34:49 UTC
IDE:-------------------------------------------------
IDE: [25.9.07 17:32] Committing "Favorites" started
Directory /shared/data/ccvs/repository/core/favorites/src/META-INF added to the repository
Directory /shared/data/ccvs/repository/core/favorites/src/META-INF/services added to the repository
cvs server: scheduling file `src/META-INF/services/org.openide.loaders.CreateFromTemplateAttributesProvider' for 
addition
cvs server: scheduling file `test/unit/src/org/netbeans/modules/favorites/templates/PropertiesProviderTest.java' for 
addition
cvs server: scheduling file `src/org/netbeans/modules/favorites/templates/PropertiesProvider.java' for addition
cvs server: use 'cvs commit' to add these files permanently
Checking in src/org/netbeans/modules/favorites/Bundle.properties;
/shared/data/ccvs/repository/core/favorites/src/org/netbeans/modules/favorites/Bundle.properties,v  <--  
Bundle.properties
new revision: 1.19; previous revision: 1.18
done
RCS 
file: /shared/data/ccvs/repository/core/favorites/test/unit/src/org/netbeans/modules/favorites/templates/PropertiesProviderTest.java,v
done
Checking in test/unit/src/org/netbeans/modules/favorites/templates/PropertiesProviderTest.java;
/shared/data/ccvs/repository/core/favorites/test/unit/src/org/netbeans/modules/favorites/templates/PropertiesProviderTest.java,v  
<--  PropertiesProviderTest.java
initial revision: 1.1
done
RCS 
file: /shared/data/ccvs/repository/core/favorites/src/META-INF/services/org.openide.loaders.CreateFromTemplateAttributesProvider,v
done
Checking in src/META-INF/services/org.openide.loaders.CreateFromTemplateAttributesProvider;
/shared/data/ccvs/repository/core/favorites/src/META-INF/services/org.openide.loaders.CreateFromTemplateAttributesProvider,v  
<--  org.openide.loaders.CreateFromTemplateAttributesProvider
initial revision: 1.1
done
Checking in nbproject/project.xml;
/shared/data/ccvs/repository/core/favorites/nbproject/project.xml,v  <--  project.xml
new revision: 1.16; previous revision: 1.15
done
Checking in src/org/netbeans/modules/favorites/resources/layer.xml;
/shared/data/ccvs/repository/core/favorites/src/org/netbeans/modules/favorites/resources/layer.xml,v  <--  layer.xml
new revision: 1.23; previous revision: 1.22
done
Checking in src/org/netbeans/modules/favorites/templates/TemplatesAction.java;
/shared/data/ccvs/repository/core/favorites/src/org/netbeans/modules/favorites/templates/TemplatesAction.java,v  <--  
TemplatesAction.java
new revision: 1.6; previous revision: 1.5
done
RCS 
file: /shared/data/ccvs/repository/core/favorites/src/org/netbeans/modules/favorites/templates/PropertiesProvider.java,v
done
Checking in src/org/netbeans/modules/favorites/templates/PropertiesProvider.java;
/shared/data/ccvs/repository/core/favorites/src/org/netbeans/modules/favorites/templates/PropertiesProvider.java,v  
<--  PropertiesProvider.java
initial revision: 1.1
done
IDE: [25.9.07 17:32] Committing "Favorites" finished
Comment 8 Jaroslav Tulach 2007-09-25 16:35:58 UTC
*** Issue 107725 has been marked as a duplicate of this issue. ***
Comment 9 tkellerer 2007-11-01 13:32:25 UTC
I'm reopening this issue as the new system will only affect newly created files. 

When editing an existing class an adding an initial Javadoc comment, NB still uses the current OS user when
automatically adding the @author tag, and there is no way to change that (other than starting NB with -J-Duser.name=....)
Comment 10 Jan Pokorsky 2007-11-01 14:18:26 UTC
Jardo, will you set the system property 'user.name'? Otherwise I will look up the property in registered
CreateFromTemplateAttributesProviders in JavaDataLoader in order to support old templates.
Comment 11 Jan Pokorsky 2007-11-01 14:58:10 UTC
Old templates use new template properties now.

/cvs/java/source/src/org/netbeans/modules/java/JavaDataLoader.java,v  <--  JavaDataLoader.java
new revision: 1.8; previous revision: 1.7
Comment 12 Tomas Danek 2007-11-07 16:47:46 UTC
still not working for case generating javadoc by hints:

- set user property
- create new java class (now @author is generated according to user property)
- delete this javadoc
- generate javadoc by hint (hints have to be enabled) -> @author is system user
Comment 13 Jaroslav Tulach 2007-11-07 23:15:58 UTC
Open new bug please. This one was about templates. Javadoc is generated by completely different infrastructure.
Comment 14 Tomas Danek 2007-11-22 16:49:46 UTC
Ok, so setting user property by template works -Verified in 6.0 RC2. I'll file a new one for java/hints. 
Comment 15 Michel Graciano 2008-02-18 17:40:22 UTC
Where can I define the user name property? There is any GUI? I can't find it...
Comment 16 apanag 2008-05-30 12:45:30 UTC
I've reached here while trying to set the $user parameter.

My suggestion would be to create a more informative help file. 

Then you don't have to worry about how "discoverable" some features are

It would be peace of cake to find them in the help file.
Comment 17 kissedsmiley 2008-12-15 03:37:16 UTC
How about adding a button on the pref/editor/codeTemplates area. This button is "showAllVariables" and it would show all
variables allowed to be used, according to whatever file netbeans is currently using. 
If they are/not editable, then a button could be added to make them so. 
Comment 18 Michel Graciano 2009-10-29 16:52:20 UTC
Where can I define the user name property? There is any GUI? I can't find it...
Comment 19 Jan Pokorsky 2009-10-29 17:57:49 UTC
hmichel: Tools->Templates->User Configuration Properties->User.properties and Open in Editor
Comment 20 Michel Graciano 2009-10-29 18:56:53 UTC
Thanks, work like a charm.