Home » Modeling » M2T (model-to-text transformation) » Invoking JET2 from within code
Invoking JET2 from within code [message #11454] |
Thu, 12 April 2007 10:42  |
Eclipse User |
|
|
|
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 #11671 is a reply to message #11454] |
Fri, 13 April 2007 08:24   |
Eclipse User |
|
|
|
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 09:07   |
Eclipse User |
|
|
|
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 01:07   |
Eclipse User |
|
|
|
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 09:14  |
Eclipse User |
|
|
|
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
>>>>
>>>>
>>>
>>>
>>
>>
>
>
|
|
|
Goto Forum:
Current Time: Fri May 09 09:58:11 EDT 2025
Powered by FUDForum. Page generated in 0.05851 seconds
|