Programatically merge two models [message #546989] |
Wed, 14 July 2010 20:47  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.05288 seconds