Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Jens Rabe is currently offline Jens RabeFriend
Messages: 81
Registered: September 2013
Member
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?
Re: More proxy resolving issues [message #1220883 is a reply to message #1220819] Sun, 15 December 2013 10:43 Go to previous messageGo to next message
Jens Rabe is currently offline Jens RabeFriend
Messages: 81
Registered: September 2013
Member
Mmh, using pre-existing models with EOpposites in Xtext and having the dependencies correctly update on saving seems such an exotic task that nobody seems to have an idea, despite more than 18000 views by now. So, as a last resort, I will stick to doing this completely "manually" using elaborate adapter magic - detect the "set" of the new B, resolve old and new B, and adjust their opposite references.
Re: More proxy resolving issues [message #1220917 is a reply to message #1220883] Mon, 16 December 2013 07:29 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 12/15/13 11:43 AM, schrieb Jens Rabe:
> Mmh, using pre-existing models with EOpposites in Xtext and having the
> dependencies correctly update on saving seems such an exotic task that
> nobody seems to have an idea, despite more than 18000 views by now. So,
> as a last resort, I will stick to doing this completely "manually" using
> elaborate adapter magic - detect the "set" of the new B, resolve old and
> new B, and adjust their opposite references.

Yes, it's a troublesome idea to have bi-directional persistent
references. Xcore deals with it by adding the the opposite on the text
level (suring content assist). Not sure if that works with external
files as well or just in the same editor.

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Previous Topic:Trying to use JavaIoFileSystemAccess directly
Next Topic:White space issue
Goto Forum:
  


Current Time: Tue Apr 23 08:40:03 GMT 2024

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

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

Back to the top