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.
When you create a new entry or duplicate an existing entry in the Templates dialog, the file that will be created on your local disk will not be renamed even though the dialog displays the new name. I ran into this issue with licenses. I created a new license by duplicating the default Apache 2.0 license, renamed it for LGPL 2.1 to license-lgpl-2.1.txt. The new name appeared in the dialog, but on the disk, the name was still the one created during the copy: license-apach20_1.txt. So when I want to use the new license in a project and create a new Java file with the wizard, instead of getting a nice header I get an error text reading: "Error loading file..."
Created attachment 92320 [details] Rename bug screenshot As you can see, the file was renamed to license-toto.txt but the hint shows the old name license-apache20_1.txt
Not a stopper for NB 6.8
IMHO it's intentional. Rename changes just display name of template, e.g. shown in New File wizard. Rename in the disk caused several serious problems (compare issue 152973 in NB6.5).
But this is a serious problem for people working with project licenses. To anyone, "rename" means "rename", not something half way, like "display name rename". I think this should be fixed somehow.
That's true: renaming halfway just breaks use of licenses in with code templates. Even worse, if I didn't know well NB, I would never have known whats going wrong and how to fix it. Very bad NB experience. If actually renaming a file on disk leads to other problems, then the templating engine should look for the name that is displayed in the "Template" dialog and use the file pointed whatever the name. Honestly this doesn't look like a good idea though: difficult to understand, what if you share the license among developer groups and hard to support to third party like the templating engine(s) that would like to include the resource.
Well, I read through issue 152973. It is not the point here. The discussion there is renaming an existing default template. Here I complain that when I create a new template or duplicate an existing a one, I expect it to be actually renamed especially if it was obtained by "Duplicate". When you tweak the content of say the Java class template, NB is not going to modify the original file, instead it copies the file into my home folder where it can be modified. From then it superseeds the original file. Nothing is broken. So using the same logic, one should not be allowed to rename a "default" template (one that it provided by modules). Their name should be read-only, because they should always exist, otherwise the new file wizard might not work. I would expect from the templates UI: 1) default templates have their name read-only. The content should remain editable. 2) I need a custom template? Then just duplicate the file and rename (actualy) the copy.
It is maybe not a P1 bug, but certainly a very important one.
Sorry but this one cannot just not be fixed! It is a bug. The templating functionality is BROKEN!
I agree that it deserves to be solved, however it seems like P3 to me, templates manager behaves this way since beginning and IIRC this issue has already been closed at least once before (I cannot find the duplicate, though). > I need a custom template? Then just duplicate the file and rename (actualy) > the copy. If it is about renaming duplicate files, 'Duplicate' action could offer renaming before creating the copy. I recall that generic fix for renaming arbitrary action was problematic.
This really suprises me. Has ever someone used this functionality out there? She should have noticed the problem immediately. It is just plain broken and unusable. For example most licenses are not available from the Templates today. You have to put your one and this just don't work because of the file naming issue. Maybe no one reported it until now. Thos who have seen the problem and were not able to find a solution, just don't use the feature anymore...
+1 Have a look at the comments in this blog entry to see the frustration that this one specific issue is causing: http://blogs.sun.com/geertjan/entry/project_level_license_settings_in
Excellent! Now there is a way to rename the file on disk from within NetBeans. As explained in the comments http://blogs.sun.com/geertjan/entry/project_level_license_settings_in you can change the file name from the properties dialog. Just right click on your template file, choose properties and then you see both the display and the file name. Changing the file name renames the file on disk. However the dialog throws an error if you try to replace an existing file. Not a big deal. Still, the "Rename" button should really do what it means and users expect.
*** Bug 178737 has been marked as a duplicate of this bug. ***
*** Bug 178345 has been marked as a duplicate of this bug. ***
*** This bug has been marked as a duplicate of bug 163534 ***