Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » General scoping question regarding cross references
General scoping question regarding cross references [message #1384921] Tue, 03 June 2014 07:33 Go to next message
Jan Rosczak is currently offline Jan RosczakFriend
Messages: 53
Registered: July 2009
Location: Hamburg, Germany
Member
Hi,

I have a simple Entity Type model with attributes and relationships.

Entity A has a relationship to Entity B and Entity B has the complement relationship to Entity A.

Now I would like to define the complement of that relationship in Entity A. If I use Content Assist I could for instance return a list of all relationships in Entity B.

What is the best approach for that?

A. In the Scope Provider get a hold of the EObject of Entity B (via the Node Model) and then ask that EObject for its list of relationships.

B. In the Scope Provider return all EObjectDescriptions that are relationships from the global scope and filter that list in the Content Assist (should I access the Entity B EObject there?).

C. In the Scope Provider return all EObjectDescriptions that are relationships from the IResourceDescription of Entity B. How would I do that without loading the Resource that contains Entity B?

Thanks.
Jan
Re: General scoping question regarding cross references [message #1384924 is a reply to message #1384921] Tue, 03 June 2014 07:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14670
Registered: July 2009
Senior Member
Hi in this case you can use the reference directly in the scope
provider


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: General scoping question regarding cross references [message #1384925 is a reply to message #1384924] Tue, 03 June 2014 07:47 Go to previous messageGo to next message
Jan Rosczak is currently offline Jan RosczakFriend
Messages: 53
Registered: July 2009
Location: Hamburg, Germany
Member
That would mean that to resolve such a cross reference I would always have to load the EObject Resource in the Scope Provider in order to get to the list of the allowed relationships. Is this acceptable?
Re: General scoping question regarding cross references [message #1384935 is a reply to message #1384925] Tue, 03 June 2014 08:32 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14670
Registered: July 2009
Senior Member
Hi,

this works automatically if you follow the reference to the entity. thus it is imho acceptable.


IScope scope_X_y(X ctx, EReference r) {
   val e = ... // navigate from ctx to the entity
   return Scopes.scopeFor(e.getRelations())
}

of course you could filter the stuff in the index as well, but the code would be much harder to understand


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:xtext in the web
Next Topic:Adding Property to EMF Objects Dynamically
Goto Forum:
  


Current Time: Sat Apr 27 04:43:22 GMT 2024

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

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

Back to the top