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.
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?
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
We agreed with Jarda he takes care of this. openide/templates could be the right place. Reassigning ...
*** Issue 104358 has been marked as a duplicate of this issue. ***
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.
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
cvs server: scheduling file `test/unit/src/org/netbeans/modules/favorites/templates/PropertiesProviderTest.java' for
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;
new revision: 1.19; previous revision: 1.18
Checking in test/unit/src/org/netbeans/modules/favorites/templates/PropertiesProviderTest.java;
initial revision: 1.1
Checking in src/META-INF/services/org.openide.loaders.CreateFromTemplateAttributesProvider;
initial revision: 1.1
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
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
Checking in src/org/netbeans/modules/favorites/templates/TemplatesAction.java;
new revision: 1.6; previous revision: 1.5
Checking in src/org/netbeans/modules/favorites/templates/PropertiesProvider.java;
initial revision: 1.1
IDE: [25.9.07 17:32] Committing "Favorites" finished
*** Issue 107725 has been marked as a duplicate of this issue. ***
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=....)
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.
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
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
Open new bug please. This one was about templates. Javadoc is generated by completely different infrastructure.
Ok, so setting user property by template works -Verified in 6.0 RC2. I'll file a new one for java/hints.
Where can I define the user name property? There is any GUI? I can't find it...
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.
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.
hmichel: Tools->Templates->User Configuration Properties->User.properties and Open in Editor
Thanks, work like a charm.