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.
Created attachment 148870 [details] New file from my template. No namespace input. I have created new template file by duplicate from PHP template that come with Netbeans. When i'm going to create new file by using this new template the wizard did not show up namespace input like i selected from Netbeans's PHP class template. This is the template i use in my new template file. ``` <?php <#assign licenseFirst = "/* "> <#assign licensePrefix = " * "> <#assign licenseLast = " */"> <#include "${project.licensePath}"> <#if namespace?? && namespace?length > 0> namespace ${namespace}; </#if> /** * Description of ${name} * * @author ${user} */ class Controller_${name} extends \Controller_BaseController { //put your code here } ``` As you see, the name space code was there but no namespace input show up.
Tome?
Your template uses a general Wizard UI for custom templates, not the one from the PHP support therefore there is no panel for namespace selection (the Wizard specifies its panels, not the template). It means that you need to provide your own WizardDescriptor [1] (or change the existing template bundled with NetBeans). Thanks. [1] http://bits.netbeans.org/dev/javadoc/org-openide-dialogs/org/openide/WizardDescriptor.html
after creating (duplicate from build-in template e.g. PHP Class) the custom template, is namespase selection field present, it disappears after restart the IDE IDE v.8.0.2 Windows 7
the same behavior in v.8.1 (build for PHP): after creating (duplicate from build-in template e.g. PHP Class) the custom template, is namespase selection field present, it disappears after restart the IDE Product Version: NetBeans IDE 8.1 (Build 201510222201) Java: 1.8.0_66; Java HotSpot(TM) 64-Bit Server VM 25.66-b18 Runtime: Java(TM) SE Runtime Environment 1.8.0_66-b18 System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)
(In reply to eddi13 from comment #4) > the same behavior in v.8.1 (build for PHP): > after creating (duplicate from build-in template e.g. PHP Class) the custom > template, is namespase selection field present, it disappears after restart > the IDE Where can I find your source code so I can have a look at it? Or at least provide _exact_ steps what you have done so I know how can I reproduce your issue. Thanks.
Created attachment 158249 [details] Create file from custom template before restart IDE
Created attachment 158250 [details] Create file from custom template after restart IDE Hallo Tomas. I do the following: 1. Tools->Templates select "PHP Class" (build-in template) click "Duplicate" (custom template "PHP Class 1" is created) close Templates 2. rigth click any folder in project -> New -> select File Type "PHP Class 1" -> Next see scrin custom_tpl_before_restart.png 3. restart IDE 4. (same as 2) rigth click any folder in project -> New -> select File Type "PHP Class 1" -> Next see scrin custom_tpl_after_restart.png Field "Namespace" is lost. Best regards, Eduard.
Thanks for the steps, will have a look at it.
This is IMO a bug (or an enhancement?) in Templates support (please see the steps in comment
(In reply to Tomas Mysik from comment #9) > This is IMO a bug (or an enhancement?) in Templates support (please see the > steps in comment Ignore this comment, my BZ login expired...
This is IMO a bug (or an enhancement?) in Templates support (please see the steps in comment #7). The cause is that the copied template does not preserve/duplicate the "instantiatingIterator" attribute. Then, the default one is used instead of the previous custom one (with the namespace field in this case). Please evaluate, thanks.
(In reply to Tomas Mysik from comment #11) > This is IMO a bug (or an enhancement?) in Templates support (please see the > steps in comment #7). The cause is that the copied template does not > preserve/duplicate the "instantiatingIterator" attribute. Then, the default > one is used instead of the previous custom one (with the namespace field in > this case). > > Please evaluate, thanks. Hallo Tomas. Attribute "instantiatingItrator" is copied, I guess he did not readed. I watched file .nbattrs. If I understand correctly, the content is read at the start of the IDE, and is overwritten when you save / delete custom templates. Advanced steps (added 3a and info to instantiatingIterator): 1. Tools->Templates select "PHP Class" (build-in template) click "Duplicate" (custom template "PHP Class 1" is created) close Templates <fileobject name="PHPClass_1.php">...<attr name="instantiatingIterator" newvalue="org.netbeans.modules.php.project.ui.wizards.NewFileWizardIterator"/> is OK. 2. rigth click any folder in project -> New -> select File Type "PHP Class 1" -> Next see scrin custom_tpl_before_restart.png 3. restart IDE <fileobject name="PHPClass_1.php">...<attr name="instantiatingIterator" newvalue="org.netbeans.modules.php.project.ui.wizards.NewFileWizardIterator"/> is OK, however... 3a. Tools->Templates select "PHP Interface" (build-in template) click "Duplicate" (custom template "PHP Interface 1" is created) close Templates... and now you can see the effect: <fileobject name="PHPClass_1.php">...<attr name="instantiatingIterator" newvalue="null"/> <fileobject name="PHPInterface_1.php">...<attr name="instantiatingIterator" newvalue="org.netbeans.modules.php.project.ui.wizards.NewFileWizardIterator"/> This means (IMHO) that the attribute has not been read from the file at the start of the IDE 4. (same as 2) rigth click any folder in project -> New -> select File Type "PHP Class 1" -> Next see scrin custom_tpl_after_restart.png Field "Namespace" is lost. I hope this helps
Sorry, I was not precise. The problem is that after the IDE restart, code from PHP module (the NewFileWizardIterator class) is not called any more. So I guess that it is replaced by some general/common code (wizard iterator) from Templates support. Thanks.
I guess, this code is not called, because the information about it is not loaded in the session configuration. I can not test it, because I can not get the values of templates configuration from the session, but I believe that the problem in the parser of custom templates configuration. And this attribute is simply not read from a file (ignored by the parser). 1. Duplicate PHP Class 2. Duplicate PHP Class <fileobject name="PHPClass_1.php">...<attr name="instantiatingIterator" newvalue="org.netbeans.modules.php.project.ui.wizards.NewFileWizardIterator"/> is OK. <fileobject name="PHPClass_2.php">...<attr name="instantiatingIterator" newvalue="org.netbeans.modules.php.project.ui.wizards.NewFileWizardIterator"/> is OK. because the info in config and session is synchronized 3. restart IDE and here it would be a very useful debug of custom templates configuration, that I can not get. But I suppose, that in the session configuration the attribute instantiatingIterator in all custom templates will be "null" (It will not be read/parsed from the configuration file) it would be great if someone could have tested it. Thanks.
in the version 8.2 the error is not corrected
Hello, Anyone tell me about how to create WizardDescriptor please? Where to put it in? I searched the Google but found no tutorial about this.