Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Invoking JET2 from within code
Invoking JET2 from within code [message #11454] Thu, 12 April 2007 14:42 Go to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

Hi,
This sounds simple but I can't find any pointers.
I have created a GMF diagram and fired off an action to call my Jet
transformation.
What code do I use to start off Jet.
So far I have always used JET2 using the RUN option setup but never from
code.

Any pointers would be good thanks,
Stu
Re: Invoking JET2 from within code [message #11635 is a reply to message #11454] Fri, 13 April 2007 12:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

Ok I have created extention points in my GMF diagram to call Action class.
I have a extention point on my Jet project to transform the diagram data to
java.

Just dont know how to link them.

help :-)


"Stu" <evaandoli@dodo.com.au> wrote in message
news:evlghq$5m1$1@build.eclipse.org...
> Hi,
> This sounds simple but I can't find any pointers.
> I have created a GMF diagram and fired off an action to call my Jet
> transformation.
> What code do I use to start off Jet.
> So far I have always used JET2 using the RUN option setup but never from
> code.
>
> Any pointers would be good thanks,
> Stu
>
>
Re: Invoking JET2 from within code [message #11671 is a reply to message #11454] Fri, 13 April 2007 12:24 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Since you're using GMF, get a reference to the EMF Resource for your model,
then do

Resource resource = ...;

IStatus status = JET2Platform.runTransformOnObject( "your transfrom id",
resource, aProgressMonitor );

or, if you want to predefine some JET variables, ...

Map variables = new HashMap();
variables.put("varNameWithoutTheDollarSign", varValue);
IStatus status = JET2Platform.runTransformOnObject( "your transfrom id",
resource, variables, aProgressMonitor );

The one difference you may find with this approach, compared to running from
the UI is that the "org.eclipse.jet.resource.*" variables will not be
defined - these are defined as part of loading the model from the Eclipse
workspace - but with this approach, you are passing JET an in-memory model,
so no loading takes place

Paul

"Stu" <evaandoli@dodo.com.au> wrote in message
news:evlghq$5m1$1@build.eclipse.org...
> Hi,
> This sounds simple but I can't find any pointers.
> I have created a GMF diagram and fired off an action to call my Jet
> transformation.
> What code do I use to start off Jet.
> So far I have always used JET2 using the RUN option setup but never from
> code.
>
> Any pointers would be good thanks,
> Stu
>
>
Re: Invoking JET2 from within code [message #11777 is a reply to message #11671] Fri, 13 April 2007 13:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

Thanks for the code.

I feel so close and yet . .
When trying to use the JET2Platform class I get the following error:-
Access restriction: The type JET2Platform is not accessible due to
restriction on required library C:
\apps\wipJEE\eclipse\plugins\org.eclipse.jet_0.7.100.v200702 151055.jar

I have org.eclipse.jet as a dependant plugin.

Thanks for any clues

"Paul Elder" <pelder@ca.ibm.com> wrote in message
news:evnsqp$1go$1@build.eclipse.org...
> Since you're using GMF, get a reference to the EMF Resource for your
> model, then do
>
> Resource resource = ...;
>
> IStatus status = JET2Platform.runTransformOnObject( "your transfrom id",
> resource, aProgressMonitor );
>
> or, if you want to predefine some JET variables, ...
>
> Map variables = new HashMap();
> variables.put("varNameWithoutTheDollarSign", varValue);
> IStatus status = JET2Platform.runTransformOnObject( "your transfrom id",
> resource, variables, aProgressMonitor );
>
> The one difference you may find with this approach, compared to running
> from the UI is that the "org.eclipse.jet.resource.*" variables will not be
> defined - these are defined as part of loading the model from the Eclipse
> workspace - but with this approach, you are passing JET an in-memory
> model, so no loading takes place
>
> Paul
>
> "Stu" <evaandoli@dodo.com.au> wrote in message
> news:evlghq$5m1$1@build.eclipse.org...
>> Hi,
>> This sounds simple but I can't find any pointers.
>> I have created a GMF diagram and fired off an action to call my Jet
>> transformation.
>> What code do I use to start off Jet.
>> So far I have always used JET2 using the RUN option setup but never from
>> code.
>>
>> Any pointers would be good thanks,
>> Stu
>>
>>
>
>
Re: Invoking JET2 from within code [message #11883 is a reply to message #11777] Tue, 17 April 2007 05:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

This error resolved itself.
I've built and rebuilt projects and it seemed to go away in the end.


"Stu" <evaandoli@dodo.com.au> wrote in message
news:evnva8$7d9$1@build.eclipse.org...
> Thanks for the code.
>
> I feel so close and yet . .
> When trying to use the JET2Platform class I get the following error:-
> Access restriction: The type JET2Platform is not accessible due to
> restriction on required library C:
> \apps\wipJEE\eclipse\plugins\org.eclipse.jet_0.7.100.v200702 151055.jar
>
> I have org.eclipse.jet as a dependant plugin.
>
> Thanks for any clues
>
> "Paul Elder" <pelder@ca.ibm.com> wrote in message
> news:evnsqp$1go$1@build.eclipse.org...
>> Since you're using GMF, get a reference to the EMF Resource for your
>> model, then do
>>
>> Resource resource = ...;
>>
>> IStatus status = JET2Platform.runTransformOnObject( "your transfrom id",
>> resource, aProgressMonitor );
>>
>> or, if you want to predefine some JET variables, ...
>>
>> Map variables = new HashMap();
>> variables.put("varNameWithoutTheDollarSign", varValue);
>> IStatus status = JET2Platform.runTransformOnObject( "your transfrom id",
>> resource, variables, aProgressMonitor );
>>
>> The one difference you may find with this approach, compared to running
>> from the UI is that the "org.eclipse.jet.resource.*" variables will not
>> be defined - these are defined as part of loading the model from the
>> Eclipse workspace - but with this approach, you are passing JET an
>> in-memory model, so no loading takes place
>>
>> Paul
>>
>> "Stu" <evaandoli@dodo.com.au> wrote in message
>> news:evlghq$5m1$1@build.eclipse.org...
>>> Hi,
>>> This sounds simple but I can't find any pointers.
>>> I have created a GMF diagram and fired off an action to call my Jet
>>> transformation.
>>> What code do I use to start off Jet.
>>> So far I have always used JET2 using the RUN option setup but never from
>>> code.
>>>
>>> Any pointers would be good thanks,
>>> Stu
>>>
>>>
>>
>>
>
>
Re: Invoking JET2 from within code [message #12971 is a reply to message #11883] Wed, 18 April 2007 13:14 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
It must be the little known 'self-correcting-errors' feature of Eclipse ;-)

Actually, I have no idea what's going on there. Here's my approach to weird
Eclipse errors:
1) clean all projects.
2) try closing and opening offending projects. In particular, Java errors
about missing source folders (that aren't missing) seem to resolve this way.
3) try launching Eclipse with a -clean commandline option

Paul

"Stu" <evaandoli@dodo.com.au> wrote in message
news:f01kmk$u6k$1@build.eclipse.org...
> This error resolved itself.
> I've built and rebuilt projects and it seemed to go away in the end.
>
>
> "Stu" <evaandoli@dodo.com.au> wrote in message
> news:evnva8$7d9$1@build.eclipse.org...
>> Thanks for the code.
>>
>> I feel so close and yet . .
>> When trying to use the JET2Platform class I get the following error:-
>> Access restriction: The type JET2Platform is not accessible due to
>> restriction on required library C:
>> \apps\wipJEE\eclipse\plugins\org.eclipse.jet_0.7.100.v200702 151055.jar
>>
>> I have org.eclipse.jet as a dependant plugin.
>>
>> Thanks for any clues
>>
>> "Paul Elder" <pelder@ca.ibm.com> wrote in message
>> news:evnsqp$1go$1@build.eclipse.org...
>>> Since you're using GMF, get a reference to the EMF Resource for your
>>> model, then do
>>>
>>> Resource resource = ...;
>>>
>>> IStatus status = JET2Platform.runTransformOnObject( "your transfrom id",
>>> resource, aProgressMonitor );
>>>
>>> or, if you want to predefine some JET variables, ...
>>>
>>> Map variables = new HashMap();
>>> variables.put("varNameWithoutTheDollarSign", varValue);
>>> IStatus status = JET2Platform.runTransformOnObject( "your transfrom id",
>>> resource, variables, aProgressMonitor );
>>>
>>> The one difference you may find with this approach, compared to running
>>> from the UI is that the "org.eclipse.jet.resource.*" variables will not
>>> be defined - these are defined as part of loading the model from the
>>> Eclipse workspace - but with this approach, you are passing JET an
>>> in-memory model, so no loading takes place
>>>
>>> Paul
>>>
>>> "Stu" <evaandoli@dodo.com.au> wrote in message
>>> news:evlghq$5m1$1@build.eclipse.org...
>>>> Hi,
>>>> This sounds simple but I can't find any pointers.
>>>> I have created a GMF diagram and fired off an action to call my Jet
>>>> transformation.
>>>> What code do I use to start off Jet.
>>>> So far I have always used JET2 using the RUN option setup but never
>>>> from code.
>>>>
>>>> Any pointers would be good thanks,
>>>> Stu
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Previous Topic:Jet directive not found
Next Topic:Could not load JET template loader
Goto Forum:
  


Current Time: Fri Apr 26 19:25:56 GMT 2024

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

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

Back to the top