Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Assignment rules and EOperations
Assignment rules and EOperations [message #882142] Tue, 05 June 2012 23:27 Go to next message
Reinaldo Junior is currently offline Reinaldo JuniorFriend
Messages: 36
Registered: March 2011
Member

Is there a way to create an assignment rule that calls an EOperation?
Re: Assignment rules and EOperations [message #882244 is a reply to message #882142] Wed, 06 June 2012 05:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hmmm,

no that i would know.
could you explain by an example what you want to do?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Assignment rules and EOperations [message #882593 is a reply to message #882142] Wed, 06 June 2012 20:05 Go to previous messageGo to next message
Reinaldo Junior is currently offline Reinaldo JuniorFriend
Messages: 36
Registered: March 2011
Member

I have an Ecore model that I cannot change its structure (it is based on UML specification). Among other things, it has some OCL constraints that demand to set two associations with the same values (one of them is a containment association).

Hence my DSL is something like:

Association:
  'association'
  ownedEnd+=Property
  memberEnd+=[Property]
;


I'm trying to find a way to simplify this syntax using one EOperation that makes this "two-step" association. My goal is to have a syntax like this:

Association returns dsl::DslAssociation: //DslAssociation is a subclass of Association
  'association'
  myOperation+=Property
;


I tried to use an EMF Adapter to add new items from ownedEnd to memberEnd.

It worked with a plain Java example (and also worked when I created a model in the Sample Reflexive Ecore Model Editor) but it didnt work with Xtext (it looks like the Xtext's deserialization explicitly sets the memberEnd's value to an empty list after the adapter changed it to reflect changes in ownedEnd's value.

Thank you
Re: Assignment rules and EOperations [message #882612 is a reply to message #882593] Wed, 06 June 2012 21:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

i do not know of such a possibility. maybe hooking into org.eclipse.xtext.linking.impl.AbstractCleaningLinker.afterModelLinked(EObject, IDiagnosticConsumer) may help to set the cross refs manually after the other cross refs are linked. but it do not know if this will work

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Assignment rules and EOperations [message #883035 is a reply to message #882612] Thu, 07 June 2012 17:41 Go to previous messageGo to next message
Reinaldo Junior is currently offline Reinaldo JuniorFriend
Messages: 36
Registered: March 2011
Member

Could you show me an example abut how to hook into org.eclipse.xtext.linking.impl.AbstractCleaningLinker.afterModelLinked(EObject, IDiagnosticConsumer) ?
Re: Assignment rules and EOperations [message #883042 is a reply to message #883035] Thu, 07 June 2012 18:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Google the forum may give you hints on some open source projects
doing this


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Assignment rules and EOperations [message #883161 is a reply to message #883042] Fri, 08 June 2012 00:16 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2012-07-06 20:00, Christian Dietrich wrote:
> Google the forum may give you hints on some open source projects doing this

one result would be cloudsmith/geppetto @ github ;)

Regards
- henrik
Re: Assignment rules and EOperations [message #1153034 is a reply to message #883161] Thu, 24 October 2013 10:31 Go to previous message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hello,
I know this thread is quit old, but I have a similar problem with setting the references for the properties of an UML::Association.

@Reinaldo Junior did you solve your problem with the help of Abstractcleaninglinker.afterModelLinked()?
If so may you give me a rough description how you managed this?

Regards,
Alex
Previous Topic:How to solve QualifiedName ambiguity
Next Topic:UTF 8 encoding
Goto Forum:
  


Current Time: Thu Mar 28 09:48:49 GMT 2024

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

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

Back to the top