Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF Diff/Merge » Simple Diff between two RootedModelScope
Simple Diff between two RootedModelScope [message #1082208] Thu, 08 August 2013 04:29 Go to next message
Charlie Mordant is currently offline Charlie Mordant
Messages: 81
Registered: July 2010
Member

Hi Olivier,

I'm trying to use EDM to make a diff between two simple scopes: a complete one and a barely complete other (same as the first, but with one element substracted):

Resource objectResource = getResource(myobject);
 EList<EObject> fullModel = new BasicEList<EObject>();
    TreeIterator<EObject> it = objectResource.getAllContents();
    while (it.hasNext()) {
      Object current = it.next();
        fullModel.add((EObject) current);
    }
    IFeaturedModelScope referenceScope = new RootedModelScope(fullModel);
//Make another EList with one element substracted
 IFeaturedModelScope impactedScope = new RootedModelScope(withoutClipBoardContent); 

The I try to call EDM to get the differences:

IComparison comparison = new EComparisonImpl(impactedScope , referenceScope );
    comparison.compute(null,null,null,null);
    Collection<IDifference> differences = comparison.getRemainingDifferences();//.size() == 0 :S


Unfortunately, differences size is 0, can you explain me why, or what I'm doing wrong?

Best regards,
Re: Simple Diff between two RootedModelScope [message #1090649 is a reply to message #1082208] Tue, 20 August 2013 08:53 Go to previous messageGo to next message
Olivier Constant is currently offline Olivier Constant
Messages: 35
Registered: January 2012
Member
Hi Charlie,

This usage of RootedModelScope is not correct since there is no need to build a collection of all model elements. Quoting the Javadoc of the constructor you are using:

/**
* Constructor
* @param roots_p a non-null list of elements whose containment trees are disjoint,
* that is, no element is the ancestor of another one
*/
public RootedModelScope(List<? extends EObject> roots_p)

Regarding your second scope, you may want to check class FilteredModelScope which supports arbitrary content.

Regards,
Olivier
Re: Simple Diff between two RootedModelScope [message #1090779 is a reply to message #1090649] Tue, 20 August 2013 12:26 Go to previous message
Charlie Mordant is currently offline Charlie Mordant
Messages: 81
Registered: July 2010
Member

Hi Olivier,

Thank you for the tips, FilteredScope fits totally my needs! I made a workaround with EmfUtils.copy, but it was far less usable and performant than this scope.

Regards,
Previous Topic:Change the label provider in the GUI
Next Topic:change comparison method?
Goto Forum:
  


Current Time: Fri Aug 22 21:35:46 EDT 2014

Powered by FUDForum. Page generated in 0.03695 seconds