[EMF Compare] Migration from version 1.3 to 2.1 [message #1008230] |
Mon, 11 February 2013 11:16  |
Eclipse User |
|
|
|
Hi,
You wrote 2 classes in R4E ( R4EUIModelPosition.java and UIEMFCompareUtils.java).
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:
org.eclipse.emf.compare.ui_1.3.1 for
org.eclipse.emf.compare.ui.internal.ModelComparator ()
org.eclipse.emf.compare.ui.ModelCompareInput ()
org.eclipse.emf.compare.ui.services.CompareServices ()
org.eclipse.emf.compare.diff_1.3.1 for
org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot ()
org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSnapshot()
org.eclipse.emf.compare.diagram_1.3.1 for
org.eclipse.emf.compare.diagram.diff.util.DiffUtil.getElement()
org.eclipse.emf.compare_1.3.1 for
org.eclipse.emf.compare.util.AdapterUtils.getItemProviderText()
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 #1011090 is a reply to message #1008591] |
Mon, 18 February 2013 15:49   |
Eclipse User |
|
|
|
Question:
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 = comparator.compare(scope);
// 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 = iter.next();
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 03:39  |
Eclipse User |
|
|
|
Jacques,
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
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.05313 seconds