Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352981 - UML Comparison Engine doesnt handle conflictual UpdateAttribute and UpdateReference
Summary: UML Comparison Engine doesnt handle conflictual UpdateAttribute and UpdateRef...
Status: CLOSED FIXED
Alias: None
Product: EMFCompare
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: EMF Compare CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-25 05:09 EDT by Mikaël Barbero CLA
Modified: 2011-09-27 10:47 EDT (History)
1 user (show)

See Also:


Attachments
The new fixtures as patch to the tests plug-in (548.99 KB, application/octet-stream)
2011-07-25 05:09 EDT, Mikaël Barbero CLA
laurent.goubet: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
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