} else if ("apply".equals(method)) {
if (checkOnly) return Boolean.TRUE;
- if (args.elementAt(0) instanceof String) {
+ if (args.elementAt(0) instanceof Res) {
+ Res res = (Res)args.elementAt(0);
+ res = res.addExtension(".xwt");
+ Template t = Template.buildTemplate(res, "fromResource");
+ if (ThreadMessage.suspendThread()) try {
+ JS.Callable callback = args.length() < 2 ? null : (Callable)args.elementAt(1);
+ t.apply(this, null, null, callback, 0, t.numUnits());
+ } finally {
+ ThreadMessage.resumeThread();
+ }
+ } else if (args.elementAt(0) instanceof String) {
String templatename = (String)args.elementAt(0);
Template t = Template.getTemplate(templatename, null);
if (t == null) {