Home » Modeling » TMF (Xtext) » More proxy resolving issues(How to correctly update EOpposites when proxies resolve?)
|More proxy resolving issues [message #1220819]
||Fri, 13 December 2013 19:29
| Jens Rabe
Registered: September 2013
I now solved my EOpposite resolving problem, but ran into another one.|
Let's say, A has a single-valued reference to B, and B has a multi-valued reference to A. Both are EOpposite to each other. I have one A saved in the file myA.a, and one B in myB.b. In the DSL code, they reference each other by their URI without the fragment (At that point, myA.a and myB.b can only contain one object).
The A in myA.a has no B referenced currently, and the B in myB.b has no A referenced.
Now, when I open the myA.a in the Xtext editor, and add the reference to the myB, e.g., as defined in my grammar, writing something like:
b = "platform:/resource/myProject/myB.b"
the internal A in the Xtext editor points to a B which is a proxy and has a proxy URI pointing to the A file, platform:/resource/myProject/myA.a, with an "XtextLink" fragment. As I understand, this is the correct way. The proxy is of the type B, and the "a" reference correctly points back to my A.
Now, when I access this proxy (myA.getB()), the corresponding IEObjectDescriptor is evaluated and the getEObjectOrProxy() method is called. I programmed my scope provider in the way that this method returns another proxy pointing to platform:/resource/myProject/myB.b#/ - i.e., the URI of the concrete B object. The automatic Ecore resolving then sees that this is a proxy too, and recursively resolves it. This means, it loads the B from disk in the context of the A, i.e., using A's resource (and thus, its resource set). However, on disk, the B has no back-reference to the A, and during resolving, this back-reference is not established.
So, I end up with an inconsistent model - myA.b correctly points to myB from the file myB.b, but myB.a is empty, i.e., does not point back to myA.
I tried to hack the myA.getB() method, using a setB() instead of directly assigning the resolved B to b, setting eDeliver to false before, but this leads to strange ConcurrentModificationExceptions in the EObjectValidator.
I think I am still doing something wrong either on the Xtext or on the EMF side, I suppose it has to do with the scoping. Can anyone give me a hint about this?
Current Time: Thu Dec 03 09:16:16 GMT 2020
Powered by FUDForum
. Page generated in 0.01499 seconds