[EMF Compare] Equality Helper not used in match phase [message #1673685] |
Sat, 14 March 2015 08:24  |
Eclipse User |
|
|
|
Hi,
my model has several containment references to classes without an id attribute. Therefore most of the time the default match engine recognizes changes in the references' attributes as addition/ deletion of a new reference.
My goal is that these references are always matched. So after reading the description
www.eclipse.org/emf/compare/documentation/latest/developer/developer-guide.html#Equality_Helper
I implemented a custom Equality Helper.
What I found is that my custom Equality Helper is not used during match phase.
The IdentifierEObjectMatcher uses the idComputation Function and otherwise delegates (by default) to a ProximityEObjectMatcher.
The ProximityEObjectMatcher does not use the Equality Helper on references. Instead it computes the distance based on their contents to check whether the references match.
Am I missing something? Or is it intentional that custom Equality Helpers are not used during the match phase?
Regards,
Christoph
P.S. I know I can achieve my goal by other means like e.g. a post processor.
|
|
|
Re: [EMF Compare] Equality Helper not used in match phase [message #1679537 is a reply to message #1673685] |
Mon, 16 March 2015 13:05   |
Eclipse User |
|
|
|
Hi,
First of all, thanks to use EMF Compare. Unfortunately, there are lacks on EMF Compare to customize easily the EqualityHelper.
The steps to tell to EMF Compare to use you own EqualityHelper are not very easy, but it is possible. You have to :
1- Create your EqualityHelper by implementing org.eclipse.emf.compare.utils.IEqualityHelper (see the default implementation to get help: org.eclipse.emf.compare.utils.EqualityHelper, you can also extends it)
2- Create your EqualityHelperFactory by implementing org.eclipse.emf.compare.match.IEqualityHelperFactory (see the default implementation to get help: org.eclipse.emf.compare.match.DefaultEqualityHelperFactory, you can also extends it)
This factory will use your EqualityHelper
3- Create your MatchEngine by implementing org.eclipse.emf.compare.match.IMatchEngine (see the default implementation to get help: org.eclipse.emf.compare.match.DefaultMatchEngine, you can also extends it)
This matchEngine will use your EqualityHelperFactory
4- Create your MatchEngineFactory by implementing org.eclipse.emf.compare.match.IMatchEngine.Factory (see the default implementation to get help: org.eclipse.emf.compare.rcp.internal.match.DefaultRCPMatchEngineFactory, you can also extends it)
This factory will use your MatchEngine
5- Use the org.eclipse.emf.compare.rcp.matchEngine extension-point to register your MatchEngineFactory.
The ranking must be superior to the existing one. (e.g > 0)
Hope it will help.
Regards,
|
|
|
|
|
Re: [EMF Compare] Equality Helper not used in match phase [message #1688174 is a reply to message #1686744] |
Fri, 20 March 2015 05:11  |
Eclipse User |
|
|
|
Hi,
thank you for raising that enhancement request.
To be more precise:
I have seen my custom EqualityHelper bein called in the differencing phase.
But I have not seen it being called in the matching phase.
My focus is on the matching phase so I have not investigated the other phases further.
This leads to my original question.
Is it intended that custom Equality Helpers are used in the matching phase or not?
I am unsure of this because from the description of the developer guide it would seem so. Yet I am not sure whether that description is up-to-date.
Regards,
|
|
|
Powered by
FUDForum. Page generated in 0.04220 seconds