Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » [xpand] how to get input model from xmi
[xpand] how to get input model from xmi [message #529036] Thu, 22 April 2010 13:06 Go to next message
Eclipse UserFriend
Hi everyone,

I am writing a Java code to trigger the xpand template. I am using XpandFacade.evaluate() method. The first parameter is the template file, and the second one is the input model (root, correct?). Therefore, I am just wondering how can I turn a selected ecore file into a model object here.

Thanks a lot.

Yu
Re: [xpand] how to get input model from xmi [message #529058 is a reply to message #529036] Thu, 22 April 2010 15:03 Go to previous messageGo to next message
Eclipse UserFriend
hello,

yes the second parameter is the model.
loading emf based models is a thing that is done by the emf persistence api. getting the currect selection is a part of jface.

something like

IFile iFile = (IFile) structuredselection.getFirstElement();
URI uri = URI.createPlatformResourceURI(iFile.getPath().toString(), true);
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = resourceSet.getResource(uri, true);
MyModelRootClass model = (MyModelRootClass ) resource.getContents().get(0);
Re: [xpand] how to get input model from xmi [message #529070 is a reply to message #529058] Thu, 22 April 2010 15:58 Go to previous message
Eclipse UserFriend
Thanks Christian. The code works perfect!
Previous Topic:[Acceleo] Multi meta models and i don't know them
Next Topic:[Acceleo] AllInstances problem with 3.0M6
Goto Forum:
  


Current Time: Wed Jul 30 15:58:48 EDT 2025

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

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

Back to the top