Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Access EMF Operation in JET?
Access EMF Operation in JET? [message #35469] Tue, 06 November 2007 20:22 Go to next message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
Hi,

Is it possible to access the EOperation in my eCore in JET? I don't know
much about XPath.

For Example,

I have a eCore Object called Root with a single attribute called
outputFolder, I know in my JET template I can access it by using:

<c:get select="$Root/@outputFolder" />

Now, if I add an operation called getOutputFolder() to my eCore model and
in my implementation class I do some logic and return a string. How would
I access that operation in my JET Template?
Re: Access EMF Operation in JET? [message #35770 is a reply to message #35469] Wed, 07 November 2007 13:39 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Roshan:

You have to choices:

1) If you just take control of the getOutputFolder() method in the EMF
generated code, $Root/@outputFolder will work as you expect. Under the
covers, JET is using EObject.eGet() which is calling getOutputFolder().

2) If you must use an EOperation, you'll have to write some Java code in
your template.

There isn't an easy, but there is a way, involving some Java:

<%jet imports="xxx.Root"%>
....

<someTag that sets the 'Root' variable/>

<%
Root root = (Root)context.getVariable("Root");
%>

<%= root.getOutputFolder() %>

Paul

"Roshan Soni" <roshan.soni1@gmail.com> wrote in message
news:23b6b9b97f87f4095f0faa36729b290a$1@www.eclipse.org...
> Hi,
>
> Is it possible to access the EOperation in my eCore in JET? I don't know
> much about XPath.
>
> For Example,
> I have a eCore Object called Root with a single attribute called
> outputFolder, I know in my JET template I can access it by using:
>
> <c:get select="$Root/@outputFolder" />
>
> Now, if I add an operation called getOutputFolder() to my eCore model and
> in my implementation class I do some logic and return a string. How would
> I access that operation in my JET Template?
>
Previous Topic:Bug: Values of Multiplicity Many attribute ignored in EMF to JET mapping
Next Topic:Ecore2proprietaryModel which M2T language to use?
Goto Forum:
  


Current Time: Wed Apr 24 20:20:17 GMT 2024

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

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

Back to the top