|Re: How to invoke a JET transform [message #657892 is a reply to message #657797]
||Fri, 04 March 2011 14:19
| Paul Elder
Registered: July 2009
JET offers a number of APIs to help you. Since you mention it, runTransformOnResource will load an IResource (file, folder, or even Project) from the workspace, and pass it to your JET transformation - this is essentially what happens when you run a JET transform from the launching UI.|
But, for a wizard, I'm guessing that you have not saved your model to disk (and you are not interested in doing so). There are two other variants of runTransform that may help:
runTransformOnString takes your model as a string, parses it, and passes that to your transform. The typical example would be a an XML document. The JET new project wizard does this.
runTransformOnObject takes an already loaded model, and passes it to your JET transformation. What you pass will depend on what kind of model you have. If you have an EMF-based model, pass an EMF Resource (whose contents is your actual model). If you have an XML document, pass the Document object.
You can see how JET itself uses runTransformOnString here:
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.m2t/or g.eclipse.jet/plugins/org.eclipse.jet.ui/src/org/eclipse/jet /ui/newproject/NewProjectWizard.java?view=markup&revisio n=1.11&root=Modeling_Project
(method starts on line 75)
This JET FAQ article may be useful, too:
Powered by FUDForum
. Page generated in 0.02017 seconds