Get referenced object in another model (cyclic resolution or no corresponding inode) [message #1031541] |
Mon, 01 April 2013 18:52  |
Eclipse User |
|
|
|
Hi,
I'm trying to override the name provider in such a way that I can define in a model a new object and its parent object, and having its qualified name computed with the referenced object directly in the model.
I provide here a simplified example. Assume in the first grammar, I have rules like:
MyObject:
'myobject' name=FQN;
FQN:
ID('.'ID)*;
in the other grammar:
MyOtherObject:
'add' name=FQN 'in' referencedObject=[MyObject|FQN];
SomeRefRule:
'refrule' reference=[MyOtherObject|FQN];
How can I override the name provider to build the fully qualified name of MyOtherObject based on MyObject. Ex. in model1.dsl:
in model2.dsl:
add ASubObject in MyObjectName
refrule MyObjectName.ASubObject
I roughly tried to retrieve the referenced object by just:
((MyOtherObject) o.eContainer).getReferencedObject()
which leads to a cyclic resolution of lazy links.
I also tried by NodeModelUtils.findNodesForFeature using the eContainer and DslPackage.Literals.My_Other_Object__REFERENCED_OBJECT but, this returns me MyOtherObject rule and not the MyObject.
Could someone help me with this?
Thanks in advance,
Fabian
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.21124 seconds