create models to show in compare view [message #136524] |
Tue, 19 May 2009 17:31  |
Eclipse User |
|
|
|
hi,
I develop a multi tier appication. The server contain the compare service
and the client should view the reponse. In the server creation of the
MatchModel and the DiffModel work success. But the DiffModel can't display
in the compare view. When I use the default compare plug in and save the
result, it show different as the DiffModel. E.g. it contains both model
the DiffModel and the MatchModel. I try to use the MergeService and it
doesn't work.
some code:
Map options = new HashMap();
MatchModel match = new EcoreMatchEngine().resourceMatch(resourceLeft,
resourceRight, options);
Resource resourceOutputMatch = resourceSet.createResource(URI
.createFileURI("c:/temp/match1.xmi"));
resourceOutputMatch.getContents().add(match);
resourceOutputMatch.save(null);
DiffModel diffModel = new EcoreDiffEngine().doDiff(match);
Resource resourceOutputDiff = resourceSet.createResource(URI
.createFileURI(locateProject+"/temp/diff1.xmi"));
resourceOutputDiff.getContents().add(diffModel);
resourceOutputDiff.save(null);
ModelUtils.save(diffModel, locateProject+"test.emfdiff");
How can I create a reponse.emfdiff which show like the file form the
compare plug in?
thanks
|
|
|
|
Re: create models to show in compare view [message #136934 is a reply to message #136536] |
Thu, 04 June 2009 10:59  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------020000050407010704080208
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Hi Thomas,
Sorry, I've been out of the office and couldn't check the newsgroup for
a while.
You should take a look at the
org.eclipse.emf.compare.examples.standalone example to see the necessary
code to compare two models and save the result in a readable emfdiff.
That said, the code would look something like :
----------8<----------
Map options = new HashMap();
// Matching
MatchModel match = MatchService.doMatch(resourceLeft, resourceRight,
options);
// Differencing
DiffModel diff = DiffService.doDiff(match);
// Create result instance
ComparisonResourceSnapshot snapshot =
DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
snapshot.setDate(Calendar.getInstance().getTime());
snapshot.setMatch(match);
snapshot.setDiff(diff);
// Save result
ModelUtils.save(snapshot, "result.emfdiff");
---------->8----------
Cheers,
Laurent Goubet
Obeo
Thomas L a
|
|
|
|
Re: create models to show in compare view [message #620993 is a reply to message #136536] |
Thu, 04 June 2009 10:59  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------020000050407010704080208
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Hi Thomas,
Sorry, I've been out of the office and couldn't check the newsgroup for
a while.
You should take a look at the
org.eclipse.emf.compare.examples.standalone example to see the necessary
code to compare two models and save the result in a readable emfdiff.
That said, the code would look something like :
----------8<----------
Map options = new HashMap();
// Matching
MatchModel match = MatchService.doMatch(resourceLeft, resourceRight,
options);
// Differencing
DiffModel diff = DiffService.doDiff(match);
// Create result instance
ComparisonResourceSnapshot snapshot =
DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
snapshot.setDate(Calendar.getInstance().getTime());
snapshot.setMatch(match);
snapshot.setDiff(diff);
// Save result
ModelUtils.save(snapshot, "result.emfdiff");
---------->8----------
Cheers,
Laurent Goubet
Obeo
Thomas L a
|
|
|
Powered by
FUDForum. Page generated in 0.06415 seconds