|Re: transform EMF Object withJET2 [message #533938 is a reply to message #533916]
||Mon, 17 May 2010 14:07
| Paul Elder
Registered: July 2009
1) Are you able to run the JET transformation against your EMF model
using the Run > Run Configurations dialog?
2) Once you can do #1, you can then consider using API to do the same
thing. Start by deciding HOW you want the user to invoke the
a) Assuming your user will trigger the transformation manually, the user
will typically start by clicking a menu item, toolbar button, etc.... In
that case, you need to create a UI plug-in that defines the UI item, and
the handler (Java code) for that item. The handler will then call
JET2Platform.runTransformOnXXX()... The new plug-in wizard provides
templates for UI contributions, which makes it much easier to get started.
b) Once you have created the UI plug-in, you will need to test it by
creating a run time workbench (select Run > Run Configurations, then
create a new Eclipse Application, and click Run).
c) Once you have tested, you are ready to package your UI plug-in plus
the JET project/plug-in for distribution to others. You need to create a
Feature project for that.
Almost all of the above steps in #2 have more to do with extending
Eclipse by creating plug-ins. The eclipse.platform.* groups may be a
better source of information.
As for actually using JET2Platform.runTransformOnXXX(), here are a
couple of more questions:
3) How is the EMF object created? Are you also creating some sort of
a) If so, then the object is stored as a file in the Eclipse workspace.
That is, it is a workspace resource. You can find and manipulate
resources by adding a dependency on the org.eclipse.core.resources
plug-in, and the start exploring the APIs found in
ResourcesPlugin.getWorkspace().getRoot(). Once you find the IFile
containing your saved model, you can pass it to
b) If you have an editor for your EMF objects, and you want to invoke
the transform against the content of the editor, they you have to find
the EMF Resource object (eObject.eResource() should work), and pass that
to JET via JET2Platform.runTransformOnObject().
On 2010-05-17 9:19 AM, Kenn Hussey wrote:
> This is a question for the M2T [JET] newsgroup, copied.
> Mohammed Jelti wrote:
>> Hello every body.
>> I need your help.
>> I Have an EMF object that i want to transform with JET2 to get some
>> xml files ( i take the emf object and print some attribute in my xml
>> files+predefined text).
>> So my problem is the following.
>> 1/ I created the JET project + templates. i enabled this project to
>> receive an EMF object rather then xml document.
>> 2/ I have my EMF object But i don't know witch project can allow me to
>> call this method
>> and how can i load my object in this projecT.
>> i read that JET2 project must be exported to jar and then be inclued
>> in a plugin-in project. i did IT right now and i have juste one class
>> The class JET2Platform is not recognized into this project.
>> Thank you
Powered by FUDForum
. Page generated in 0.02629 seconds