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 242840 - Renaming a template that was duplicated from the PHP Class template causes it to loses its description, instantiatingIterator, templateCategory, and templateWizardURL
Summary: Renaming a template that was duplicated from the PHP Class template causes it...
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Jaroslav Havlin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-12 20:13 UTC by evandelacruz
Modified: 2014-07-21 20:57 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description evandelacruz 2014-03-12 20:13:13 UTC
Steps to reproduce:

- Go to Tools > Templates 
- select the PHP Class 
- click duplicate
- the duplicated template (correctly) has the same description as the PHP Class template
- If you create a new file using the newly create template, it shows the correct wizard*
- Now, rename the template to anything
- After renaming the template, it loses its description.  Creating a new file from the template no longer shows the correct wizard*


Expected behavior:

New template should maintain it's category, description, and wizard, even after rename.  Or, alternately (preferably), these settings should be configurable from the Template Editor.


Notes:

Upon inspection of .nbattrs, I can see that the instantiatingIterator, templateCategory, and templateWizardURL are deleted when the template is renamed.

* = I know the wizard is wrong because it no longer offers an option for namespace, even though there are several namespaced files in the same folder


I don't know if this issue is a defect or by-design.  But at the least, it seems counter-intuitive.
Comment 1 evandelacruz 2014-03-12 20:20:53 UTC
Add templateCategory, templateWizardURL and instantiatingIterator back to the .nbattrs file manually doesn't seem to solve the issue.
Comment 2 Tomas Mysik 2014-04-18 09:37:35 UTC
Can you reproduce this issue with all templates or just some PHP one(s)?

Thanks.
Comment 3 evandelacruz 2014-04-18 19:24:33 UTC
(In reply to Tomas Mysik from comment #2)
> Can you reproduce this issue with all templates or just some PHP one(s)?
> 
> Thanks.

I can't say it's *all* templates because I can't test every single one.

However, I just tested the "HTML File" template and the "Java Class" template and I get the same results.  The description works until I rename the template.


Notes: 

1) I am renaming both the "Template Display Name" and the "Template File Name" in the Rename Template dialog

2) My particular use case is that I am creating a new template for a new file type.  Ideally, I'd just be able to simply edit the description to whatever I want.

Thanks.
Comment 4 Tomas Mysik 2014-04-22 07:25:46 UTC
(In reply to evandelacruz from comment #3)
> I can't say it's *all* templates because I can't test every single one.
> 
> However, I just tested the "HTML File" template and the "Java Class"
> template and I get the same results.  The description works until I rename
> the template.

That is pefectly fine, it means that the problem is in Templates support. So reassigning, please evaluate. Thanks.
Comment 5 Martin Entlicher 2014-06-27 14:36:09 UTC
It's not in templates support. The attributes that get deleted on rename are defined in org.openide.filesystems.FileUtil.transientAttributes.
They were added explicitly for a reason.
Moving to filesystems to evaluate/close this issue.
Comment 6 Jaroslav Havlin 2014-07-10 11:37:54 UTC
MultiDataObject preserves template attributes on copy, so it should do so on rename as well, I think.

Fixed: http://hg.netbeans.org/core-main/rev/ffdf3927eac4
Please verify.
Thank you for reporting.
Comment 7 Quality Engineering 2014-07-19 10:17:25 UTC
Integrated into 'main-silver', will be available in build *201407190718* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ffdf3927eac4
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #242840: Renaming a template causes it to lose its attributes
Comment 8 evandelacruz 2014-07-21 20:57:35 UTC
Verified fixed in NetBeans dev 201407210001.

Thanks!