how to view the merged model? [message #931885] |
Wed, 03 October 2012 16:06 |
Kosala Yapa Messages: 159 Registered: September 2010 |
Senior Member |
|
|
Hi all,
I have two ecore models, which i am going to merge.
code:
File fileModelA = new File(file1);
File fileModelB = new File(file2);
//register XMI resource factory for all other extensions
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(
).put(Resource.Factory.Registry.DEFAULT_EXTENSION,
new XMIResourceFactoryImpl());
ResourceSet resourceSet = new ResourceSetImpl();
//Loading resources
EObject model1 = ModelUtils.load(fileModelA,resourceSet);
EObject model2 = ModelUtils.load(fileModelB,resourceSet);
//matching models
MatchModel match = MatchService.doContentMatch(model1, model2, Collections.<String, Object> emptyMap());
//Differencing models
DiffModel diff = DiffService.doDiff(match);
// Merges all differences from model1 to model2
List<DiffElement> differences = new ArrayList<DiffElement>(diff.getOwnedElements());
MergeService.merge(differences,true);
now if i display differences, that is empty. This is because of differences are merged.
//display differences
System.out.println("---------------display differences----------------------");
Iterator<DiffElement> it = diff.getDifferences().iterator();
while (it.hasNext()){
System.out.println(it.next());
}
if i did not do merge, that display differences.
Problem: How can I display/view merged model?
Thanks in advance!
K
|
|
|
Re: how to view the merged model? [message #957521 is a reply to message #931885] |
Thu, 25 October 2012 09:33 |
|
Kosala,
Displaying the model is more of an EMF question. Once you have merged the differences, you should either
- save the model to disk and open it in the Ecore editor (or whatever editor you use to create these models), or
- create a "console" printer for the EMF model.
I don't think EMF provides any mean to print a model to the console/standard output, so you'll have to create it yourself. Your best bet is solution 1, opening the file in its own editor.
Laurent Goubet
Obeo
[Updated on: Thu, 25 October 2012 09:33] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04108 seconds