Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Re: transform EMF Object withJET2
Re: transform EMF Object withJET2 [message #533916] Mon, 17 May 2010 13:19 Go to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Mohammed,

This is a question for the M2T [JET] newsgroup, copied.

Kenn

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
>
> JET2Platform.runTransformOnObject
>
> 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
> Activator.
> The class JET2Platform is not recognized into this project.
>
>
> Thank you
>
>
Re: transform EMF Object withJET2 [message #533938 is a reply to message #533916] Mon, 17 May 2010 14:07 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Mohammed:

Some questions:

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
transformation.
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
editor?
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
JET2Platform.runTransformOnResource.
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().

Paul


On 2010-05-17 9:19 AM, Kenn Hussey wrote:
> Mohammed,
>
> This is a question for the M2T [JET] newsgroup, copied.
>
> Kenn
>
> 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
>>
>> JET2Platform.runTransformOnObject
>>
>> 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
>> Activator.
>> The class JET2Platform is not recognized into this project.
>>
>>
>> Thank you
>>
>>
Previous Topic:Model based debugging
Next Topic:[JET] how to show the details in progress bar
Goto Forum:
  


Current Time: Sat Apr 20 02:12:57 GMT 2024

Powered by FUDForum. Page generated in 0.03117 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top