| Containment reference in EMF Compare [message #1724451]
||Wed, 24 February 2016 04:16
| Harish Goutham
Registered: February 2016
For my use case, I have 2 mono-valued containment references that I have to show as a "CHANGE". From the following quote in the developers guide:
Second, any change in a containment reference, even if that reference is mono-valued, that represents a "new" element in the model is considered to be an addition. Note that this second case is an exception to the rule for change differences outlined below.
I deduce that any changes to the containment reference will be shown as "ADD" or "DELETE" and not a "CHANGE".
Tried to override
in DefaultDiffEngine, this did not help.
protected void computeDifferences(Match match, EReference reference, boolean checkOrdering)
If anybody can point out where I have to change the default implementation, it would be very helpful.
Thanks in advance.
|Re: Containment reference in EMF Compare [message #1725279 is a reply to message #1724451]
||Wed, 02 March 2016 09:01
|| Philip Langer
Registered: March 2015
Location: Vienna, Austria
I wouldn't recommend customizing the change kind (add, delete, change, ...) in the diff, because this may have consequences when accepting/rejecting or merging the changes later. If you really just want to customize the way the diff is displayed in the comparison viewer, I'd suggest to customize the label provider.
Therefore, have a look at the extension point org.eclipse.emf.compare.edit.adapterFactory. With this extension point, you can register an adapterFactory for the type org.eclipse.emf.compare.provider.IItemStyledLabelProvider that returns a factory creating your customized subclass of org.eclipse.emf.compare.provider.spec.ReferenceChangeItemProviderSpec. In this subclass you would have to overwrite getStyledText(Object) and display "change" rather than add/delete in your scenario; in all other cases, just forward to the super implementation.
I hope this helps,
Get professional Eclipse developer support:
Powered by FUDForum
. Page generated in 0.02027 seconds