Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Assignment rules and EOperations
Assignment rules and EOperations [message #882142] Tue, 05 June 2012 19:27 Go to next message
Eclipse UserFriend
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 01:43 Go to previous messageGo to next message
Eclipse UserFriend
Hmmm,

no that i would know.
could you explain by an example what you want to do?
Re: Assignment rules and EOperations [message #882593 is a reply to message #882142] Wed, 06 June 2012 16:05 Go to previous messageGo to next message
Eclipse UserFriend
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 17:01 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Assignment rules and EOperations [message #883035 is a reply to message #882612] Thu, 07 June 2012 13:41 Go to previous messageGo to next message
Eclipse UserFriend
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 14:00 Go to previous messageGo to next message
Eclipse UserFriend
Google the forum may give you hints on some open source projects
doing this
Re: Assignment rules and EOperations [message #883161 is a reply to message #883042] Thu, 07 June 2012 20:16 Go to previous messageGo to next message
Eclipse UserFriend
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 06:31 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 19:43:11 EDT 2025

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

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

Back to the top