Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Symptom and Solution for Unresolved Xtext Cross-References(Xtext, cross-references)
Symptom and Solution for Unresolved Xtext Cross-References [message #997464] Mon, 07 January 2013 16:10
Michael Colburn is currently offline Michael Colburn
Messages: 8
Registered: November 2012
Junior Member
The purpose of this post is to pass on a solution to a problem I encountered, in hopes that it will be helpful to someone else in the future.

Situation

1. Your grammar has rules for Objects of type A, that allows a cross-reference to objects of type B.
2. An instance of object type B can have a cross-reference to another instance of object type B.
3. When processing resources from within your implementation of IGenerator, all cross-references resolve correctly.
4. But, if you dynamically load a resource, although the cross-reference from Object type A to Object type B resolves correctly, the cross-references from an instance of Object type b to another instance of type b return null. In other words, references to references return null.

Solution

In my situation, the cause of the null reference was as follows. When creating the URI for a dynamic load of a resource, I was using a file scheme. It turns out that file based URIs will not properly resolve cross-references to cross-references. The solution is to use platform resource based URIs.

It took hours of experimentation and searching the Internet before I realized what was happening, due to this post: http://www.eclipse.org/forums/index.php/t/169567/http://.

Although Xtext and EMF "experts" are probably aware of this and never make the mistake I did (of using a file based URI instead of platform resource URI), I feel it is important to provide information helpful to those of us who do not have as much experience.

Previous Topic:GraphView: loading models from the running platform
Next Topic:Content assistant: don't show default proposal
Goto Forum:
  


Current Time: Wed Sep 17 09:48:33 GMT 2014

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

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