Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Simple merge case(Running emf compare from code)
Simple merge case [message #670102] Thu, 12 May 2011 16:42
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
I have the following scenario:

Model_old : [A,B,C,D]


Model_new : [A,B,C,X]


Now I would like to create:

Model_merged : [A,B,C,D,X]


So basically its a "union" of Model_old and Model_new.

But currently I don't get the 'D' object from Model_old in Model_merged which instead contains:

Model_merged : [A,B,C,X]


Here is the code I use:

   // potentially modifies model2
  public static EObject compare(EObject model1, EObject model2) {
    DiffModel diff = null;
    MatchModel contentMatch = null;
    Map<String, Object> options = new HashMap<String, Object>();
    try {
      // doContentMatch from current model and down
      contentMatch = MatchService.doContentMatch(model1, model2, options);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    diff = DiffService.doDiff(contentMatch, false);
    final List<DiffElement> differences = new ArrayList<DiffElement>(diff.getOwnedElements());
    // This will merge all references to the right model (second argument).
    MergeService.merge(differences, true);
    return model2;
  }


Is it possible (using any diff/compare tools at all) to create this union between two different models?
Previous Topic:[Ecore Editor] Add Additional Resources programmatically
Next Topic:Identical models have (33) differences
Goto Forum:
  


Current Time: Sat Apr 27 01:37:35 GMT 2024

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

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

Back to the top