Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » Programatically merge two models
Programatically merge two models [message #605002] Wed, 14 July 2010 20:47 Go to next message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
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 #605007 is a reply to message #605002] Thu, 15 July 2010 22:06 Go to previous messageGo to next message
Stephan Eberle is currently offline Stephan EberleFriend
Messages: 40
Registered: July 2009
Member

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 #605011 is a reply to message #605002] Thu, 15 July 2010 22:07 Go to previous message
Stephan Eberle is currently offline Stephan EberleFriend
Messages: 40
Registered: July 2009
Member

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:transform EMF Object withJET2
Next Topic:Programatically merge two models
Goto Forum:
  


Current Time: Fri Apr 26 19:49:38 GMT 2024

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

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

Back to the top