| Renaming cross links [message #917899] |
Thu, 20 September 2012 10:48 |
Edwin Park Messages: 109 Registered: July 2009 |
Senior Member |
|
|
Hi,
I have an Xtext domain model that I would like to transform by renaming entities. However when I do this the cross-references to those renamed entities are broken.
This can be shown with the Xtext Domainmodel example. Below is a sample program that parses an instance of a Domainmodel and then serialized it back out to a file.
val model = parser.parse(
'''
entity One {
}
entity Two {
first : One
}
'''
)
val entityOne = model.elements.get(0) as Entity
model.eResource.save(new FileOutputStream("original.dmodel"), newHashMap)
/* result:
entity One {
}
entity Two {
first : One
}
*/
So far, so good. The Xtext resource is serialized fine and the cross reference from the Two.first property correctly points to the entity One.
Now let's rename entity One to be called Uno instead:
entityOne.name = "Uno"
model.eResource.save(new FileOutputStream("transformed.dmodel"), newHashMap)
/* result:
entity Uno {
}
entity Two {
first : One
}
*/
Now in the result the entity One has been renamed to Uno, but Two.first property is still pointing to an entity called One, which no longer exists.
What can I do to transform names in Xtext without breaking cross references this way?
Thanks,
Edwin
[Updated on: Thu, 11 October 2012 12:17] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02201 seconds