Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Containment reference in EMF Compare(Change the default implementation for Containment references.)
icon5.gif  Containment reference in EMF Compare [message #1724451] Wed, 24 February 2016 04:16 Go to next message
Harish Goutham is currently offline Harish GouthamFriend
Messages: 1
Registered: February 2016
Junior Member
Hi All,
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:

Quote:
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
protected void computeDifferences(Match match, EReference reference, boolean checkOrdering)
in DefaultDiffEngine, this did not help.

If anybody can point out where I have to change the default implementation, it would be very helpful.

Thanks in advance.

Regards
Harish
Re: Containment reference in EMF Compare [message #1725279 is a reply to message #1724451] Wed, 02 March 2016 09:01 Go to previous message
Philip Langer is currently offline Philip LangerFriend
Messages: 99
Registered: March 2015
Location: Vienna, Austria
Member

Hi Harish,

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,

Philip


--
Philip Langer

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:Custom Matching Strategy
Next Topic:Stop EMFCompare using URIs
Goto Forum:
  


Current Time: Tue Mar 19 02:20:22 GMT 2024

Powered by FUDForum. Page generated in 0.01539 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top