Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Defaulting with Xtext
Defaulting with Xtext [message #641500] Thu, 25 November 2010 17:31 Go to next message
Florian Gessner is currently offline Florian GessnerFriend
Messages: 20
Registered: November 2010
Junior Member
Hi all,

I've created a model which contains entities which can be linked with each other via associations. These associations should always be bi-directional.

e.g.
entity a {

}

entity B {
  ref a : A;
}

For the example an association / reference from A to B should automatically be added as B defines a reference to A.

How can I handle this with XText , ... . The automatically created association on the opposite should also be usable in the editor.

Thanks and Best Regards
Florian

[Updated on: Thu, 25 November 2010 17:33]

Report message to a moderator

Re: Defaulting with Xtext [message #641588 is a reply to message #641500] Fri, 26 November 2010 08:53 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 11/25/10 6:31 PM, schrieb Florian Gessner:
> Hi all,
>
> I've created a model which contains entities which can be linked with
> each other via associations. These associations should always be
> bi-directional.
> How can I handle this with XText , ... . The automatically created
> association on the opposite should also be usable in the editor.
>
> Thanks and Best Regards
> Florian

EMF supports bi-directional references only if both sides are not
transient.

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Defaulting with Xtext [message #641641 is a reply to message #641500] Fri, 26 November 2010 12:21 Go to previous messageGo to next message
Florian Gessner is currently offline Florian GessnerFriend
Messages: 20
Registered: November 2010
Junior Member
Hi Sven,

thanks for your response, but I still have no clue how I can solve this.

Is this transient related to the property transient in the ecore model? And are "both sides" in my case the entities?

Thanks and Best Regards
Florian

[Updated on: Fri, 26 November 2010 13:41]

Report message to a moderator

Re: Defaulting with Xtext [message #641645 is a reply to message #641641] Fri, 26 November 2010 13:24 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
"Not having a glue to solve this", is rather an amusing typo, I think Wink

There's a bug lurking in the Bugzilla concerning bi-directional references with EMF with more explanation, and it even points to code which was rolled back but might be able to help you here.


Re: Defaulting with Xtext [message #641892 is a reply to message #641500] Mon, 29 November 2010 07:30 Go to previous messageGo to next message
Florian Gessner is currently offline Florian GessnerFriend
Messages: 20
Registered: November 2010
Junior Member
I still do not have any idea how to solve this topic. Can anyon eprovide me some more information or a link to a correponding webpage?
Is it generally possible to transform the AST into a modified AST?

Thanks and Regards
Florian

[Updated on: Mon, 29 November 2010 08:09]

Report message to a moderator

Re: Defaulting with Xtext [message #737710 is a reply to message #641892] Sat, 15 October 2011 10:39 Go to previous messageGo to next message
Simon Schwichtenberg is currently offline Simon SchwichtenbergFriend
Messages: 127
Registered: September 2011
Senior Member
any updates on that? i am also interessted in bi-directional associations.
Re: Defaulting with Xtext [message #739348 is a reply to message #641500] Mon, 17 October 2011 11:25 Go to previous message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
You could check in the generated .ecore/.genmodel files whether any side of the association (i.e., non-containing EReference) is transient or not. If not, it should work but you'll probably have to add some scoping to get it to actually work.

You can modify the generated .ecore through a post-processor. Modification of the AST after parsing an instance is harder since it's not kept (automagically) in synch with the editor model.


Previous Topic:Regenertion and Scope Class
Next Topic:Deploy lightweight parser/serializer
Goto Forum:
  


Current Time: Fri Apr 19 11:34:16 GMT 2024

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

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

Back to the top