[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2t] Re: Run JET template from java error

OK, thinks for your response, I see.
I have run a jet transformation in a plug-in project successfully, but I got an other problem when try to run a template in java, Maybe I don't set the variable correctly.


Run a jet transformation as below:
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("org.eclipse.jet.resource.project.name","com.company.sample.petstore.product");
IProgressMonitor monitor = new NullProgressMonitor();
JET2Platform.runTransformOnObject("com.company.sample.jet", getDoDoc(), variables, monitor);


But jet transformation's start template is fixed,
in order to run different templates in java(plug-in project), I do the following steps:
1 create JET2Context and set model(xml) on it
2 create JET2Writer(new BodyContentWriter())
3 use _jet_domain class(generated by jet engine) as template class
4 invoke _jet_domain generate method


But I get nothing from the writer(BodyContentWriter.getContent()),
I debug the _jet_domain class, it returns false when excute this expression:
'<c:if test="isVariableDefined('org.eclipse.jet.resource.project.name')">',


I alread set the variable when create JET2Context as below:

Map<String, Object> variables = new HashMap<String, Object>();
variables.put("org.eclipse.jet.resource.project.name","com.company.sample.petstore.product");
JET2Context context = new JET2Context(getDoDoc(), copiedVariables);

Now, I don't konw how to do?