Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF Compare] Migration from version 1.3 to 2.1(R4E Using EMF Compare 2.1)
[EMF Compare] Migration from version 1.3 to 2.1 [message #1008230] Mon, 11 February 2013 16:16 Go to next message
Jacques Bouthillier is currently offline Jacques BouthillierFriend
Messages: 5
Registered: May 2011
Junior Member
You wrote 2 classes in R4E ( and
R4E was using EMF compare version 1.3.1. We are in the process to migrate and use EMF compare 2.1.
When upgrading the dependencies to use EMF compare 2.1, I discovered the following packages does not exist anymore.

Those 2 classes were using: for () () () for () for

org.eclipse.emf.compare_1.3.1 for

Could you give me a hint on how those packages evolved, where can I find the methods to replace the preceding packages

Some examples could also be appreciated.

Thanks for your help

Jacques Bouthillier
Re: [EMF Compare] Migration from version 1.3 to 2.1 [message #1008591 is a reply to message #1008230] Wed, 13 February 2013 08:51 Go to previous messageGo to next message
Mikael Barbero is currently offline Mikael BarberoFriend
Messages: 55
Registered: July 2009
Hi Jacques,

EMF Compare 2.x is a full overhaul of EMF Compare, as such all the APIs have changed and there may be no equivalence between old and newest APIs. Here are rough equivalence:

Quote: for ()

This two APIs have been unified into a single "Comparison" concept in the plugin This comparison holds references to a tree of "Match", each of them may hold some "Diff". We started to describe concepts in the metamodel here

Quote: for () () ()

All have disappeared and their features are accessible from different points. Could you provide us more information about your need on these classes as long as I can not find any reference to that in any branch of the R4E repository?

Quote: for

There is no such method anymore, you may need to copy/paste the code in your own. The ElementRequestor used within the call graph will need to be refactored to take the new Comparison model into account (see for more details).

org.eclipse.emf.compare_1.3.1 for

We are not referring to a static singleton anymore for the AdapterFactory so this AdapterUtils class has been removed. If you need an adapter factory, you should instantiate it by yourself with the following code:

AdapterFactory af = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)

and by disposing it when not needed anymore (af.dispose()).

BTW we revamped the wiki with information that may be interesting for you. Check the developer guide especially (far from complete, but may give you some hints)

Hope this help.

Best regards,

Mikael Barbero
Re: [EMF Compare] Migration from version 1.3 to 2.1 [message #1011090 is a reply to message #1008591] Mon, 18 February 2013 20:49 Go to previous messageGo to next message
Jacques Bouthillier is currently offline Jacques BouthillierFriend
Messages: 5
Registered: May 2011
Junior Member
In R4E, we need to store the object Id and a small description from the Diff (With version 1.3 of EMF Compare, we were extracting the information from a DiffElement structure ). It seems I have the objectId and not the description in the new data structure " (Diff) or (Match) " . Where can I extract the information needed for R4E ?

With the following code, I can get the Diff and Match element from the comparison, but I don't have the information needed to extract the description

public static List<IR4EUIPosition> createModelDeltas(R4ECompareEditorInput input) throws CoreException {


// Compare the two models
IComparisonScope scope = EMFCompare.createDefaultScope(leftResourceSet, rightResourceSet);
Comparison comparaison =;

// Get the Diff for the left side only

// Construct the predicate
Predicate<? super Diff> predicate = and(fromSide(DifferenceSource.LEFT),
not(hasConflict(ConflictKind.REAL, ConflictKind.PSEUDO)));
// Filter out the diff that do not satisfy the predicate
Iterable<Diff> nonConflictualDifferencesFromLeft = filter(comparaison.getDifferences(), predicate);

Iterator<Diff> iter = nonConflictualDifferencesFromLeft.iterator();
while (iter.hasNext()) {
Diff diffLeft =;
System.out.println("nonConflictualDifferencesFromLeft : " + diffLeft.eContainer());
Match diffMatch = diffLeft.getMatch();
EObject eObj = diffMatch.getLeft();
Resource eObjRes = eObj.eResource();
String objectId = eObjRes.getURIFragment(eObj);
System.out.println("\t eObjLeft .resource: " + eObjRes + "\n\t fragmentId: "
+ objectId + "\t : " + eObjRes.getClass());


Method I used with EMF Compare 1.3 to extract the required information about the objectID and the description
public R4EUIModelPosition(DiffElement aDiff) {
EObject obj = DiffUtil.getElement(aDiff, Side.LEFT, EObject.class);
fObjectID = obj.eResource().getURIFragment(obj);
fDescription = AdapterUtils.getItemProviderText(aDiff);

Re: [EMF Compare] Migration from version 1.3 to 2.1 [message #1011779 is a reply to message #1011090] Wed, 20 February 2013 08:39 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1857
Registered: July 2009
Senior Member

We no longer use a long textual description for the differences. We may create an API to provide such descriptions from EMF Compare core in the future, but for now you will have to construct it yourself. You might want to look at what I wrote in the "user interface" part of this blog post about these descriptions.

The description of "Diff" element on the wiki should help you getting started about where to retrieve the necessary information from. Please raise an enhancement request on the bugzilla if you wish to see an API to that work for you.

Laurent Goubet
Previous Topic: org.eclipse.emf.mwe.utils.Reader is not working
Next Topic:Proper way to update UI from EContentAdapter
Goto Forum:

Current Time: Fri Jun 22 11:47:40 GMT 2018

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

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

Back to the top