Bug 110910 - Permit file encoding to be substituted in template instances
Permit file encoding to be substituted in template instances
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Data Systems
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Marek Fukala
issues@platform
: API_REVIEW_FAST
Depends on:
Blocks: 107715 107910
  Show dependency treegraph
 
Reported: 2007-07-25 12:14 UTC by Marek Fukala
Modified: 2008-12-22 13:49 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
The patch (13.09 KB, patch)
2007-07-25 12:14 UTC, Marek Fukala
Details | Diff
New diff of the changes (11.11 KB, patch)
2007-07-30 15:50 UTC, Marek Fukala
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2007-07-25 12:14:11 UTC
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.
Comment 1 Marek Fukala 2007-07-25 12:14:57 UTC
Created attachment 45660 [details]
The patch
Comment 2 Marek Fukala 2007-07-25 12:19:43 UTC
please ignore changes in 
/cvs/openide/loaders/test/unit/src/org/openide/loaders/CreateFromTemplateTest.java
from the diff, it was added accidentally.
Comment 3 Jesse Glick 2007-07-25 16:11:26 UTC
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.
Comment 4 Ken Frank 2007-07-25 19:44:55 UTC
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



Comment 5 Jaroslav Tulach 2007-07-27 11:06:00 UTC
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).
Comment 6 Jesse Glick 2007-07-27 17:29:41 UTC
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.
Comment 7 Jesse Glick 2007-07-27 17:31:08 UTC
(I suppose loaders could OIDE-M-Recommends templates rather than -Needs, since really other functionality in loaders
does not depend on templates.)
Comment 8 Marek Fukala 2007-07-30 15:50:29 UTC
Created attachment 45882 [details]
New diff of the changes
Comment 9 Marek Fukala 2007-07-30 15:52:32 UTC
I have attached a new diff fulfiling hopefully all the proposed changes.

Ken: The encoding is obtained using the FileEncodingQuery API.
Comment 10 Jaroslav Tulach 2007-07-30 16:06:58 UTC
Looks ok to me.
Comment 11 Jesse Glick 2007-07-30 17:23:17 UTC
I would recommend as a token: "org.netbeans.modules.templates.v1_0"
Comment 12 Marek Fukala 2007-07-31 12:42:57 UTC
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
Comment 13 Marek Fukala 2007-07-31 12:44:01 UTC
integrated
Comment 14 Jaroslav Tulach 2007-07-31 23:02:46 UTC
Keep API_REVIEW_FAST for tracking purposes.



By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo