Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ECrossReferenceAdapter missing links
ECrossReferenceAdapter missing links [message #988840] Mon, 03 December 2012 12:19 Go to next message
Markus Riedl is currently offline Markus Riedl
Messages: 14
Registered: November 2012
Junior Member
Hi,

I noticed somewhat strange during the usage of the ECrossReferenceAdapter, maybe someone can give me a hint on how to solve this problem.

My Situation:

I have 3 Models, Model A, B and AB (adapter is registered for the ResourceSet where the modelElements of AB life, i have atm 3 ResourceSets, one for each model);
A and B are models on their own, and AB is some kind of link-model to link elements from A and B.
So an Element from AB has a reference to one element of A and also to B.
Asking the inverses from an Element in Model B (which happens to be UML) gets me not only the inverses in Model B, but also the link from Model AB.
Asking the same for an Element in Model A only gets me the Elements from Model A, but none from the Model AB.

The notifications are generated so the adapter should somehow notice that something has change.

Could this be that in the ResourceSet-Implementation of UML it is somehow considered this case? But the Adapter is registered for the linkmodel ... so why doesn't he know the inverse from model A?

I tried to get a look into the ResourceSetImpl for the UML-Stuff which was my only hinch.

Maybe someone of you some kind of idea.

Greetings Markus
Re: ECrossReferenceAdapter missing links [message #989217 is a reply to message #988840] Wed, 05 December 2012 09:31 Go to previous messageGo to next message
Markus Riedl is currently offline Markus Riedl
Messages: 14
Registered: November 2012
Junior Member
Ok after letting the Problem rest for a day and get a new view on it I found that, at the time the reference is set, it is a proxy.
Afterwards, after the resource (especially the eobject) is loaded, i have the "real" object, but in the CrossReferenceMap the inverse reference is stored for the proxy, so that I don't get the Inverse for the real thing...

Would now be the correct way to handle this to force that the proxy is resolved?

Greetings,
Markus
Re: ECrossReferenceAdapter missing links [message #989349 is a reply to message #989217] Wed, 05 December 2012 18:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26048
Registered: July 2009
Senior Member
Markus,

I would have expected that resolving a proxy would be handled by this:

protected void handleCrossReference(EReference reference,
Notification notification)
{
switch (notification.getEventType())
{
case Notification.RESOLVE:
case Notification.SET:
case Notification.UNSET:
{
EObject notifier = (EObject)notification.getNotifier();
EReference feature = (EReference)notification.getFeature();
if (!feature.isMany() || notification.getPosition() !=
Notification.NO_INDEX)
{
EObject oldValue = (EObject)notification.getOldValue();
if (oldValue != null)
{
inverseCrossReferencer.remove(notifier, feature, oldValue);
}
EObject newValue = (EObject)notification.getNewValue();
if (newValue != null)
{
inverseCrossReferencer.add(notifier, feature, newValue);
}
}
break;
}


On 05/12/2012 10:31 AM, Markus Riedl wrote:
> Ok after letting the Problem rest for a day and get a new view on it I
> found that, at the time the reference is set, it is a proxy.
> Afterwards, after the resource (especially the eobject) is loaded, i
> have the "real" object, but in the CrossReferenceMap the inverse
> reference is stored for the proxy, so that I don't get the Inverse for
> the real thing...
>
> Would now be the correct way to handle this to force that the proxy is
> resolved?
>
> Greetings, Markus
Re: ECrossReferenceAdapter missing links [message #989841 is a reply to message #989349] Sat, 08 December 2012 10:15 Go to previous messageGo to next message
Markus Riedl is currently offline Markus Riedl
Messages: 14
Registered: November 2012
Junior Member
That's the part that bugs me... I just don't get it why there is an Object, with an eProxy uri.
Re: ECrossReferenceAdapter missing links [message #989860 is a reply to message #989841] Sat, 08 December 2012 16:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26048
Registered: July 2009
Senior Member
Markus,

Perhaps it can't be resolved? The debugger will be helpful...

On 08/12/2012 11:15 AM, Markus Riedl wrote:
> That's the part that bugs me... I just don't get it why there is an
> Object, with an eProxy uri.
Re: ECrossReferenceAdapter missing links [message #990064 is a reply to message #989860] Mon, 10 December 2012 17:10 Go to previous messageGo to next message
Markus Riedl is currently offline Markus Riedl
Messages: 14
Registered: November 2012
Junior Member
It can be resolved. The problem is (I think) I load these objects from a changing file (which i have to unload and load to get the updates).
Then at the set-time it is a different object as at the time I'm asking for the crossreferences ...

Greetings Markus
Re: ECrossReferenceAdapter missing links [message #990181 is a reply to message #990064] Tue, 11 December 2012 10:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26048
Registered: July 2009
Senior Member
Markus,

Comments below.

On 10/12/2012 6:10 PM, Markus Riedl wrote:
> It can be resolved. The problem is (I think) I load these objects from
> a changing file (which i have to unload and load to get the updates).
Until you access the model to cause the proxy to resolve (or use a
utility like EcoreUtil.resolveAll to force all proxies to resolve) you
should expect that cross referencer to hold information about the proxies.
> Then at the set-time it is a different object as at the time I'm
> asking for the crossreferences ...
I'm not sure I follow what you're trying to say... Is there still a
question?
> Greetings Markus
Re: ECrossReferenceAdapter missing links [message #990582 is a reply to message #990181] Thu, 13 December 2012 09:49 Go to previous message
Markus Riedl is currently offline Markus Riedl
Messages: 14
Registered: November 2012
Junior Member
Nope, there isn't a question anymore.

Thanks for your help! I really appreciate it.

Previous Topic:[emf compare] compare two jface treeviewer model data
Next Topic:[CDO] NPE at CDOObjectHistoryImpl.filter(CDOObjectHistoryImpl.java:58)
Goto Forum:
  


Current Time: Thu Sep 18 05:48:51 GMT 2014

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

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