Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [Epsilon] running a EOL operation from Java
[Epsilon] running a EOL operation from Java [message #380182] Fri, 26 October 2007 06:27 Go to next message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

Hello,

For the purpose of a Eclipse Plugin Project development (using UML plugin), I
would like to run some simple model manipulation/transformation from Java. I
read how epsilon may be used for that (Running EOL from Java). I am wondering if
I may call an EOL operation in a similar manner.

For example consider a simple operation such (i am not familiar with the EOL syntax)

operation simpleTransformation add(e : NamedElement, newName: String):Bag(NamedElement) {
e.name = newName
return Bag{e};
}

Is it possible to specify the operation to execute, instead of (with regards to
the runfromjava/Main.java example) module.execute(); and retrieve the return
value.

thanks in advance.

--
F. Lagarde
Re: [Epsilon] running a EOL operation from Java [message #380183 is a reply to message #380182] Fri, 26 October 2007 08:52 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

Yes this is possible. Instead of module.execute() you should invoke
module.getOperations().getOperation(...).execute(...). If you need to
run the transformation on a live UML2 model as it is being edited, you
may want to take a look at EWL
(www.eclipse.org/gmt/epsilon/cinema/GMFWizards2.htm)

Cheers,
Dimitrios

François Lagarde wrote:
> Hello,
>
> For the purpose of a Eclipse Plugin Project development (using UML plugin), I
> would like to run some simple model manipulation/transformation from Java. I
> read how epsilon may be used for that (Running EOL from Java). I am wondering if
> I may call an EOL operation in a similar manner.
>
> For example consider a simple operation such (i am not familiar with the EOL syntax)
>
> operation simpleTransformation add(e : NamedElement, newName: String):Bag(NamedElement) {
> e.name = newName
> return Bag{e};
> }
>
> Is it possible to specify the operation to execute, instead of (with regards to
> the runfromjava/Main.java example) module.execute(); and retrieve the return
> value.
>
> thanks in advance.
>
Re: [Epsilon] running a EOL operation from Java [message #380322 is a reply to message #380183] Fri, 26 October 2007 13:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 10/26 about 10h, "Dimitrios" (Dimitrios Kolovos) wrote:

Dimitrios> Hi François, Yes this is possible. Instead of module.execute()
Dimitrios> you should invoke
Dimitrios> module.getOperations().getOperation(...).execute(...).


It seems to be exactly what I need ;-).

I created a basic operation, but I am unable to execute it. I think that its
because I don't load properly the UML metamodel (from a java program).

In my context, the UML model is not in a file but in a resource, and i want to
provide the correct model element during the operation call.

any helps would be appreciated.

--
F. Lagarde
Re: [Epsilon] running a EOL operation from Java [message #380323 is a reply to message #380322] Fri, 26 October 2007 14:02 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

If your model is an already loaded EMF Resource you'll need to use the
InMemoryEmfModel instead of the EmfModel like that:

Resource umlResource = ...;

InMemoryEmfModel model = new InMemoryEmfModel('UML', umlResource);

module.getContext().getModelRepository().add(model);

I hope this helps.

Cheers,
Dimitrios

François Lagarde wrote:
> In the last post, on 10/26 about 10h, "Dimitrios" (Dimitrios Kolovos) wrote:
>
> Dimitrios> Hi François, Yes this is possible. Instead of module.execute()
> Dimitrios> you should invoke
> Dimitrios> module.getOperations().getOperation(...).execute(...).
>
>
> It seems to be exactly what I need ;-).
>
> I created a basic operation, but I am unable to execute it. I think that its
> because I don't load properly the UML metamodel (from a java program).
>
> In my context, the UML model is not in a file but in a resource, and i want to
> provide the correct model element during the operation call.
>
> any helps would be appreciated.
>
Re: [Epsilon] running a EOL operation from Java [message #608177 is a reply to message #380182] Fri, 26 October 2007 08:52 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

Yes this is possible. Instead of module.execute() you should invoke
module.getOperations().getOperation(...).execute(...). If you need to
run the transformation on a live UML2 model as it is being edited, you
may want to take a look at EWL
(www.eclipse.org/gmt/epsilon/cinema/GMFWizards2.htm)

Cheers,
Dimitrios

François Lagarde wrote:
> Hello,
>
> For the purpose of a Eclipse Plugin Project development (using UML plugin), I
> would like to run some simple model manipulation/transformation from Java. I
> read how epsilon may be used for that (Running EOL from Java). I am wondering if
> I may call an EOL operation in a similar manner.
>
> For example consider a simple operation such (i am not familiar with the EOL syntax)
>
> operation simpleTransformation add(e : NamedElement, newName: String):Bag(NamedElement) {
> e.name = newName
> return Bag{e};
> }
>
> Is it possible to specify the operation to execute, instead of (with regards to
> the runfromjava/Main.java example) module.execute(); and retrieve the return
> value.
>
> thanks in advance.
>
Re: [Epsilon] running a EOL operation from Java [message #608178 is a reply to message #380183] Fri, 26 October 2007 13:53 Go to previous message
Eclipse UserFriend
Originally posted by: firstname.name.gmail.com

In the last post, on 10/26 about 10h, "Dimitrios" (Dimitrios Kolovos) wrote:

Dimitrios> Hi François, Yes this is possible. Instead of module.execute()
Dimitrios> you should invoke
Dimitrios> module.getOperations().getOperation(...).execute(...).


It seems to be exactly what I need ;-).

I created a basic operation, but I am unable to execute it. I think that its
because I don't load properly the UML metamodel (from a java program).

In my context, the UML model is not in a file but in a resource, and i want to
provide the correct model element during the operation call.

any helps would be appreciated.

--
F. Lagarde
Re: [Epsilon] running a EOL operation from Java [message #608179 is a reply to message #380322] Fri, 26 October 2007 14:02 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi François,

If your model is an already loaded EMF Resource you'll need to use the
InMemoryEmfModel instead of the EmfModel like that:

Resource umlResource = ...;

InMemoryEmfModel model = new InMemoryEmfModel('UML', umlResource);

module.getContext().getModelRepository().add(model);

I hope this helps.

Cheers,
Dimitrios

François Lagarde wrote:
> In the last post, on 10/26 about 10h, "Dimitrios" (Dimitrios Kolovos) wrote:
>
> Dimitrios> Hi François, Yes this is possible. Instead of module.execute()
> Dimitrios> you should invoke
> Dimitrios> module.getOperations().getOperation(...).execute(...).
>
>
> It seems to be exactly what I need ;-).
>
> I created a basic operation, but I am unable to execute it. I think that its
> because I don't load properly the UML metamodel (from a java program).
>
> In my context, the UML model is not in a file but in a resource, and i want to
> provide the correct model element during the operation call.
>
> any helps would be appreciated.
>
Previous Topic:[Epsilon] running a EOL operation from Java
Next Topic:[TCS]:Creating a Language Project For Plugin Builder
Goto Forum:
  


Current Time: Thu Mar 28 17:10:27 GMT 2024

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

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

Back to the top