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.
For some file types instantiated from nb templates it is necessary to put the file encoding into the template instance body. Basically the same behaviour like ${name} or ${date} properties is desired. For example JSP page should contain <%@page encoding="xxx"%> directive. The same need is for HTML files and maybe some others, so providing the possibility to use the ${encoding} property in all kinds of templates is beneficial. I have created a patch for openide/templates and openide/loades, added a unit test to openide/templates (I am not sure, maybe the test should be in loaders???), increased spec version of loaders and added an api change entry. Please review the change.
Created attachment 45660 [details] The patch
please ignore changes in /cvs/openide/loaders/test/unit/src/org/openide/loaders/CreateFromTemplateTest.java from the diff, it was added accidentally.
Clearly the test should not be in loaders, because the patch is in templates. In fact I am not sure why you are even listing the API change as in loaders, when the Loaders API is unchanged; the API change is in the recently created Templates API (I guess you could call it - happens to have no Java-level API). Incrementing the spec version of o.o.loaders is pointless since that will not cause anyone to have the right version of o.n.m.templates. Obviously do not forget to update the issue number and date in apichanges.xml when you actually commit. Tip: under the assumption that a fast-track review will pass, I usually put a date in apichanges.xml in the patch which is one week from the date that the issue was submitted for review. Otherwise people frequently forget to update the date, which e.g. messes up the ordering of the API changes RSS feed. Why the @SuppressWarnings("deprecation") in ScriptingCreateFromTemplateTest? Useless overload of tearDown, delete. Why the special DialogDisplayer? You do not need to add a special DataLoaderPool to lookup. It suffices to add the DataLoader itself directly.
is the file encoding value that will be placed in the created jsp file taken from the encoding of the project under which this new file is being created or that of the global encoding value at that point in time ? they might not be the same, since global value might have changed in the mean time or some previous nb6 or pre nb6 project might have been opened and now wants to create a jsp file. ken.frank@sun.com
Let's keep the API change in loaders - my plan was to merge openide/templates to openide/loaders as soon as we require JDK6 and javax.script will be on classpath. That is why it is better to have no API in openide/templates. Y01 Re: enforcing the right version of openide/templates. Maybe openide/loaders could "need" a special token provided by openide/templates? If Jesse agrees, then Marek please increment spec version of openide/templates and let openide/loaders's manifest: OpenIDE-Module-Needs: openide_templates_X_Y and change openide/templates manifest to: OpenIDE-Module-Provides: openide_templates_X_Y Y02 Modify arch.xml with <api/> tag mentioning that we now support new key as a default parameter (the others should be mentioned somewhere already).
Y01 sounds fine to me. (I was unaware of the plan to merge this functionality into loaders in the future.) You could also make openide/templates autoload instead of eager, I think.
(I suppose loaders could OIDE-M-Recommends templates rather than -Needs, since really other functionality in loaders does not depend on templates.)
Created attachment 45882 [details] New diff of the changes
I have attached a new diff fulfiling hopefully all the proposed changes. Ken: The encoding is obtained using the FileEncodingQuery API.
Looks ok to me.
I would recommend as a token: "org.netbeans.modules.templates.v1_0"
Checking in templates/test/unit/src/org/netbeans/modules/templates/ScriptingCreateFromTemplateTest.java; /cvs/openide/templates/test/unit/src/org/netbeans/modules/templates/ScriptingCreateFromTemplateTest.java,v <-- ScriptingCreateFromTemplateTest.java initial revision: 1.1 done Checking in loaders/manifest.mf; /cvs/openide/loaders/manifest.mf,v <-- manifest.mf new revision: 1.35; previous revision: 1.34 done integrated into trunk Checking in loaders/api/apichanges.xml; /cvs/openide/loaders/api/apichanges.xml,v <-- apichanges.xml new revision: 1.31; previous revision: 1.30 done Checking in templates/src/org/netbeans/modules/templates/ScriptingCreateFromTemplateHandler.java; /cvs/openide/templates/src/org/netbeans/modules/templates/ScriptingCreateFromTemplateHandler.java,v <-- ScriptingCreateFromTemplateHandler.java new revision: 1.4; previous revision: 1.3 done Checking in templates/manifest.mf; /cvs/openide/templates/manifest.mf,v <-- manifest.mf new revision: 1.4; previous revision: 1.3 done Checking in arch-openide-datasystems.xml; /cvs/openide/arch/arch-openide-datasystems.xml,v <-- arch-openide-datasystems.xml new revision: 1.38; previous revision: 1.37 done
integrated
Keep API_REVIEW_FAST for tracking purposes.