Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » How to invoke a JET transform(invoking JET transform from another project)
How to invoke a JET transform [message #657797] Fri, 04 March 2011 01:46 Go to next message
Priyanshu  is currently offline Priyanshu
Messages: 2
Registered: February 2011
Junior Member
Hi all....I am struggling with a complex situation.I have created a project that contains wizards and from those wizards I am fetching user input and I have put the values in a model.Now I want to create some files when I click the finish button in the wizard. For that I have created a JET.I want to invoke the JET inside the performFinish method of the wizard Page.I have used the runResourceOnTransform method but can u plz tell me how to pass the input model, I mean the xml file dynamically. see when I press the finish button the JET has to be invoked, so that the relevant files are generated. I have maintained two text boxes "project name" and "package name" in the wizard page. the problem that I am facing is i am unable to populate the xml file with the project name and package name, which I have to feed to the JET transformation upon clicking the finish button. Plz help me out
Re: How to invoke a JET transform [message #657892 is a reply to message #657797] Fri, 04 March 2011 09:19 Go to previous message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
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: g.eclipse.jet/plugins/org.eclipse.jet.ui/src/org/eclipse/jet /ui/newproject/ n=1.11&root=Modeling_Project

(method starts on line 75)

This JET FAQ article may be useful, too: ation_from_Java%3F

Previous Topic:[Acceleo 3] Update site problem
Next Topic:workflow runner going out of space
Goto Forum:

Current Time: Thu Aug 28 05:17:21 EDT 2014

Powered by FUDForum. Page generated in 0.02614 seconds