Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Indexing containment references?
Indexing containment references? [message #1593257] Fri, 30 January 2015 14:13 Go to next message
Nils Ruhr is currently offline Nils RuhrFriend
Messages: 9
Registered: January 2015
Junior Member
Hi,

I've noticed, that the DefaultResourceDescriptionStrategy creates IReferenceDescriptions only for non-containment references:
See isIndexable and isResolvedAndExternal methods.

Is there a reason why containment-references are not indexed by default?

I'd like to index my containment-references. Is overriding of the isIndexable and the isResolvedAndExternal methods the correct way?

Thanks.
Re: Indexing containment references? [message #1593790 is a reply to message #1593257] Fri, 30 January 2015 22:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Why do you want to have containment refs in the index. Can you elaborate on your usecase

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Indexing containment references? [message #1594492 is a reply to message #1593790] Sat, 31 January 2015 09:47 Go to previous messageGo to next message
Nils Ruhr is currently offline Nils RuhrFriend
Messages: 9
Registered: January 2015
Junior Member
Hi.

I have a simple grammar that looks similar to this one:

Package:
'package' name=ID types+=Type;

Type :
'type' name=ID
'{' properties += Property* '}';

Property:
type=[Type|QualifiedID] name=ID;


The model would look like this

package foo
type int { }
type Person { Address address }
type Address { int code String name }


I'd like to find all properties of a particular type for a given type via the index:
In a dialog the user types in a name of a type (e.g. "Address") and the dialog lists all "int"-properties of the given type (in the example model it would be the property "code").
Re: Indexing containment references? [message #1594509 is a reply to message #1594492] Sat, 31 January 2015 10:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i think the cleaner option would be to store the information in the userdata map of the IEObjectDescriptions of the Property.
or even simply filter the Properties by their qualifiedNames (the Types name will be the first part of the qualified name)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Indexing containment references? [message #1594747 is a reply to message #1594509] Sat, 31 January 2015 13:53 Go to previous messageGo to next message
Nils Ruhr is currently offline Nils RuhrFriend
Messages: 9
Registered: January 2015
Junior Member
Thank you, your solution sounds reasonable!

Here's a follow-up question:
I'm actually only interested in the int-properties (the type "int" will be shipped as a library-type). While creating descriptions for the properties in the ResourceDescriptionStrategy, am I allowed to access the "type"-reference?
I'm asking this because I've sometimes encountered some weird problems because of accessing non-containment references while creating EObjectDescriptions.

[Updated on: Sat, 31 January 2015 13:57]

Report message to a moderator

Re: Indexing containment references? [message #1594783 is a reply to message #1594747] Sat, 31 January 2015 14:25 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you can access it by node model only: means: the text.

neber the less you could use the reference descriptions for that


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext and SVN - recovering from missing files when Xtext regenerates the src-gen folder
Next Topic:Assign one terminal rule to two properties
Goto Forum:
  


Current Time: Thu Apr 25 07:46:36 GMT 2024

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

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

Back to the top