|Re: Get a list of referencing object [message #911773 is a reply to message #909548]
||Wed, 12 September 2012 09:42
| Tu Do
Registered: August 2012
Alexander Nittka wrote on Fri, 07 September 2012 06:05|
do you have cross references only within the same file or do you have cross references to other files as well.
In the first case it is simple. You would navigate through the entire model and check whether "struct" points to the given variable.
The second case is more complicated. The default approach is via the index Xtext creates for all resources. It contains information about objects that can be referred to, but also about actual references in a resource (source and target URI). Basically, you would iterate over the index and check whether those target URIs correspond to the variable's URI.
Could you elaborate on what you are actually trying to achieve (not that you want the referencing objects but why).
Can you give me an example how to iterate through the entire model?
I want the referencing objects to the current object, because I want to collect all relevant information when user hovers on a variable name. i.e. in my example, if the variable is not referenced by any particular "struct", it won't display related information. But if it is being referred, I want to collect all information in "struct", so when a user hovers on a variable name, they can see everything related to a particular variable.
My example is not really perspicuous. In my real use case, the "struct" rule is gonna segmented the referred variable into different sections, each with a specific number of bits for a different purpose based on the predefined length of the currently referred variable.
Powered by FUDForum
. Page generated in 0.02871 seconds