[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.emft] Re: [EMF Compare] MergeService doesn't copy a child non-containment reference

Laurent,

Do you have an example on how we would implement the extension point? I looked at the extension point and didn't get very far. Some documentation / examples would be helpful.

Bryan

On 2009-08-03 03:59:38 -0500, laurent Goubet <laurent.goubet@xxxxxxx> said:


Hi Stephen,

With two differences as you've described, EMF Compare will indeed need
two steps for this child reference to be copied : you have an added
element A with a reference towards the child C of another added element
B. Merging only A will not copy C since B hasn't been copied yet, but
merging B subsequently will copy C _and_ restore the link from A to C.

We've implemented the merge as such so has to only merge the differences
the user selected, not ones that are not directly linked. MergeService
is final as it simply isn't meant to be subclassed, but you can force
EMF Compare to consider your two differences to be linked (and thus
needing to be merged together) through the use of the
org.eclipse.emf.compare.diff.extension extension point.

Laurent Goubet
Obeo

Stephen McCants a écrit :
Resending with proper subject line.
--Stephen

-------- Original Message --------
Subject: MergeService doesn't copy a child non-containment reference
Date: Thu, 30 Jul 2009 13:39:39 -0500
From: Stephen McCants <stephenmccants@xxxxxxxxx>
Organization: EclipseCorner
Newsgroups: eclipse.technology.emft

Hello,

We have a model and are doing the match, diff and merge.  Everything is
working correctly, except
the merge fails to merge in one object.

The diff correctly identifies an object that has been added to the
model.  That added object has a
non-containment reference to another object.  When we do the merge, it
correctly copies the added
object to the left model (from the right model), but the non-containment
reference is never set.
Instead of being set, it is null.

We traced through the copy code and it is trying to copy it in
EMFComapreEObjectCopier.copyReferences() by calling copyReference().
However, the call to
copyReference() does nothing because we haven't copied it before (so it
isn't returned by get()) and
the mergeLinkedDiff() function returns false.

The reason mergeLinkedDiff() returns false is because the reference
being copied is a child of an
unmatched element and not an unmatched element itself.

We were going to try to override the Copier and make some adjustments to
work around this problem,
but there seems to be no way to do that (MergeService is final and
MergeService.getCopier() always
uses the EMFCompareEObjectCopier()).

Any ideas on what we can do to get the MergeService to copy the
non-containment reference over?

Thanks!

--Stephen



This message has one or more attachments. Select "Save Attachments" from the File menu to save.
begin:vcard