Hi Stephen,
MatchService.doResourcesetMatch should indeed be the way to go in your
case. Whether you merge the differences or not, using anything else to
match resources containing links to other resources would give erroneous
results.
Other than that ... DiffResourceSet.getSubDiffElements() doesn't exist.
DiffResourceSet.getDiffModels() will return a DiffModel for each
resources pair (Resource A from ResourceSet RS1 matched with Resource A'
from ResourceSet RS2 will yield on DiffModel, Resource B from RS1 and
Resource B' from RS2 ....).
DiffModel.getOwnedElements() will return a "root" DiffElement
corresponding to every root of the compared resources, and
DiffElement.getSubDiffElements() on these roots will give you the actual
changes detected, which you can then merge through the MergeService.
DiffResourceSet.getResourceDiffs() will contain DiffElements if there
are more resources in one ResourceSet than there are in the other
(namely, a resource now links to a new "other" resource).
Laurent Goubet
Obeo
P.S : just realized the copier we use to merge differences is contextual
to a DiffModel, not to the DiffResourceSet ... I don't know if we'll
properly restore dangling inter-model links because of that. I'll take a
look when I come back to EMF Compare.
Stephen McCants a écrit :
Anyone have any ideas? We are still stuck.
Thanks!
--Stephen
Stephen McCants wrote:
Hello Laurent,
Thanks for your reply. I just got back from vacation today, so I
just looked at your emails today.
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.
That makes sense, but I think where I may be running into problems is
that A and B are in different resources, but the same resource set.
We are trying a MatchService.doMatch(A1, A2), so that will only see
the changes to A and not to B?
We tried switching to a doResourceSetMatch(...), but that ran into
some problems. We got a DiffResourceSet back, but
DiffResourceSet.getSubDiffElements() returns an empty array so we have
nothing to merge with. Looking into the DiffResourceSet I can see it
has a "root" object that is contained by a DifferenceImpl (of some
type).
Is there an example of how to merge differences between resource sets?
Thanks for your help!
--Stephen
This message has one or more attachments. Select "Save Attachments"
from the File menu to save.
begin:vcard
fn:Laurent Goubet