Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » Programatically merge two models(How can I merge to models programatically?)
Programatically merge two models [message #546989] Wed, 14 July 2010 20:47 Go to next message
Eclipse UserFriend
Hi,

If I have two models "A" and "B" of type org.eclipse.uml2.uml.Model. Is there a way to merge the two models programatically?

Model A is the master model, which means conflicting changes would take A's values, BUT I need to use model B for its packaging structure. Which means B may have several packages and I need to make sure that the structure stays the same.

If Anyone knows how to do this, then it would help greatly.

Thanks,
Roshan
Re: Programatically merge two models [message #547196 is a reply to message #546989] Thu, 15 July 2010 22:06 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

you could use EMF Compare and call it programatically in the following way:

try {
MatchModel matchModel =
MatchService.doContentMatch(leftEObject, rightEObject, null);
DiffModel diffModel = DiffService.doDiff(matchModel);

MergeService.merge(diffModel.getOwnedElements(), leftToRight);
} catch (InterruptedException ex) {
// TODO Handle exception
}

What you get is an automatic merge based on EMF Compare's built-in
default behavior which may or may not fit with your requirements
described below. However you can tweak EMF Compare in many ways by
contributing your own match and diff engines (which override and
customize the generic ones). Consider to ask e.t.emf for details about that.

Cheers,

Stephan


Le 14/07/2010 22:47, Roshan Soni a écrit :
> Hi,
> If I have two models "A" and "B" of type org.eclipse.uml2.uml.Model. Is
> there a way to merge the two models programatically?
> Model A is the master model, which means conflicting changes would take
> A's values, BUT I need to use model B for its packaging structure. Which
> means B may have several packages and I need to make sure that the
> structure stays the same.
> If Anyone knows how to do this, then it would help greatly.
>
> Thanks,
> Roshan
Re: Programatically merge two models [message #547197 is a reply to message #546989] Thu, 15 July 2010 22:07 Go to previous message
Eclipse UserFriend
Hi,

you could use EMF Compare and call it programatically in the following way:

try {
MatchModel matchModel =
MatchService.doContentMatch(leftEObject, rightEObject, null);
DiffModel diffModel = DiffService.doDiff(matchModel);

MergeService.merge(diffModel.getOwnedElements(), leftToRight);
} catch (InterruptedException ex) {
// TODO Handle exception
}

What you get is an automatic merge based on EMF Compare's built-in
default behavior which may or may not fit with your requirements
described below. However you can tweak EMF Compare in many ways by
contributing your own match and diff engines (which override and
customize the generic ones). Consider to ask e.t.emf for details about that.

Cheers,

Stephan


Le 14/07/2010 22:47, Roshan Soni a écrit :
> Hi,
> If I have two models "A" and "B" of type org.eclipse.uml2.uml.Model. Is
> there a way to merge the two models programatically?
> Model A is the master model, which means conflicting changes would take
> A's values, BUT I need to use model B for its packaging structure. Which
> means B may have several packages and I need to make sure that the
> structure stays the same.
> If Anyone knows how to do this, then it would help greatly.
>
> Thanks,
> Roshan
Previous Topic:Programatically merge two models
Next Topic:Meta-Model Spy Suggestion
Goto Forum:
  


Current Time: Sat Feb 15 05:18:06 GMT 2025

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

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

Back to the top