Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352981

Summary: UML Comparison Engine doesnt handle conflictual UpdateAttribute and UpdateReference
Product: [Modeling] EMFCompare Reporter: Mikaël Barbero <mikael.barbero>
Component: CoreAssignee: EMF Compare <emf.compare-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: laurent.goubet
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
The new fixtures as patch to the tests plug-in laurent.goubet: iplog+

Description Mikaël Barbero CLA 2011-07-25 05:09:13 EDT
Created attachment 200258 [details]
The new fixtures as patch to the tests plug-in

The UML2DiffEngine#applyManagedTypes(DiffElement) method has to be changed with the following which handles Conflicting elements gracefully:

void applyManagedTypes(DiffElement element) {
	for (IDiffExtensionFactory factory : uml2ExtensionFactories) {
		if (factory.handles(element)) {
			AbstractDiffExtension extension = factory.create(element);
			DiffElement diffParent = factory.getParentDiff(element);
			if (element.isConflicting()) {
				ConflictingDiffElement conflictingDiffElement = null;
				if (element.eContainer() != null
						&& element.eContainer() instanceof ConflictingDiffElement) {
					conflictingDiffElement = (ConflictingDiffElement)element.eContainer();
				} else {
					conflictingDiffElement = DiffFactory.eINSTANCE.createConflictingDiffElement();
				}
				conflictingDiffElement.getSubDiffElements().add((DiffElement)extension);
				diffParent.getSubDiffElements().add((DiffElement)conflictingDiffElement);
			} else {
				diffParent.getSubDiffElements().add((DiffElement)extension);
			}
		}
	}
}

Find attached also a bunch of unittests for this behavior.
Comment 1 Laurent Goubet CLA 2011-09-27 10:47:25 EDT
Thanks for the patch, this has now been contributed on master