ECrossReferenceAdapter missing links [message #988840] |
Mon, 03 December 2012 12:19 |
Markus Riedl Messages: 20 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 #989349 is a reply to message #989217] |
Wed, 05 December 2012 18:38 |
Ed Merks Messages: 33216 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
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04277 seconds