java - Nothing is generated and no error although model and module are loaded -
i tried utilize acceleo translate model text in eclipse plugin. model fine , loaded acceleo module looks fine well. still, acceleo not generate anything.
here code:
acceleoservice = new acceleoservice(new previewstrategy()); uri alftospecsharptemplate; seek { alftospecsharptemplate = gettemplateuri("my-valid-uri", new path("/path/to/generate.emtl")); } grab (ioexception e) { e.printstacktrace(); homecoming null; } as.addlistener(new iacceleotextgenerationlistener() {/* print every method name on phone call */}); resourceset mtlset = new resourcesetimpl(); final resource mtlressource = mtlset.getresource(alftospecsharptemplate, true); final module module = (module) mtlressource.getcontents().get(0); list<object> arguments = new arraylist<object>(); map<string, string> result = as.dogenerate(module, "generateelement", mymodel, arguments, null, new basicmonitor()); system.out.println("generation: " + as.hasgenerationoccurred());
the iacceleotextgenerationlistener prints listenstogenerationend() called , nil else. loaded module looks fine in debug. has generateelement-template. generate.mtl looks this:
[comment encoding = utf-8 /] [module generate('http://www.eclipse.org/papyrus/alf/alf')] [template public generateelement(test : test) post (trim())] [file('expr.specs', true)] [test.block.generateelement() /] [/file] [/template]
my problem nil generated, i.e. result empty map. "generation: false" printed console. no error printed.
anyone have thought on going wrong? had working 1 time can't work more.
by debugging through acceleo found mistake. acceleo looks @ templates marked [comment @main /]
. since had no such template acceleo nothing. prepare add together @main
:
[template public generateelement(test : test) post (trim())] [comment @main /] [file('expr.specs', true)] [test.block.generateelement() /] [/file] [/template]
java eclipse acceleo
No comments:
Post a Comment