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.
I have some file templates in my project. When the user opens the New File dialog, the proposed name is always prefixed with "new". This constant appears to be hardcoded in SimpleTargetChooserPanelGui. For some of my file templates, I'd like to use a different prefix. For example, for Ruby unit tests, the convention is tc_<name>, and for Ruby test suites, ts_<name>. The way to accomplish this for myself appears to be to register my own templace wizard iterator, and replicate all the code in SimpleTargetChooserPanelGui. I think it would be much better if I could simply add an additional attribute on the templateFile (just like the existing instantiatingIterator, instantiatingWizardUrl, etc. Here's an example: <file name="suite.rb" url="suite.rb"> <attr name="template" boolvalue="true"/> <attr name="SystemFileSystem.localizingBundle" stringvalue=.../> <attr name="templateNamePrefix" stringvalue="ts_"/> The following diff to projects/projectui/**/SimpleTargetChooserPanelGui would accomplish it (although I presume there would need to be additional documentation of this in some arch documents, and perhaps similar implementations in other Wizard panels serving the same purpose, such as openide/loaders/**/TemplateWizard2?): Index: projects/projectui/src/org/netbeans/modules/project/ui/SimpleTargetChooserPanelGUI.java =================================================================== RCS file: /cvs/projects/projectui/src/org/netbeans/modules/project/ui/SimpleTargetChooserPanelGUI.java,v retrieving revision 1.30 diff -u -u -r1.30 SimpleTargetChooserPanelGUI.java --- projects/projectui/src/org/netbeans/modules/project/ui/SimpleTargetChooserPanelGUI.java 13 Jul 2006 08:04:01 -0000 1.30 +++ projects/projectui/src/org/netbeans/modules/project/ui/SimpleTargetChooserPanelGUI.java 26 Dec 2006 18:24:44 -0000 @@ -134,7 +134,12 @@ if (template != null) { if (documentName == null) { - documentName = NEW_FILE_PREFIX + template.getName (); + String prefix = NEW_FILE_PREFIX; + Object customPrefix = template.getAttribute("templateNamePrefix"); + if (customPrefix != null) { + prefix = customPrefix.toString(); + } + documentName = prefix + template.getName (); } documentNameTextField.setText (documentName); documentNameTextField.selectAll ();
is this still needed?
I suppose not