[XPAND] Xpandfacade with metamodel .ecore [message #1093594] |
Sat, 24 August 2013 10:01  |
Eclipse User |
|
|
|
HI ALL ,
I am new with xapnd language , and I am wondering if there is any good documentation about xpnadfacade and how to use it .
I have actually a template written in xpand language to generate code out of .ecore file . all work fine when I run it using the workflow as " run as " after some modification for workflow file to run on .ecore file for sure.
but I want to use the template without workflow from java code . I reached to xpandfacade as the solution but I do not know how to specifiy my .ecore file as it is parameter in my application and the user will choose .ecore file from enry form I offer .
sample of my code
Shell shell = new Shell(Display.getDefault());
FileDialog modelDialog = new FileDialog(shell, SWT.OPEN);
modelDialog.setFilterExtensions(new String[] { "*.ecore" });
modelDialog.setText("Select Model to transform...");
String modelSelected = modelDialog.open();
now I have my model as string in modelSelected variable .
after creating xpand context i use
xpandfacade.evaluate(java.lang.String definitionName,
java.lang.Object targetObject,
java.lang.Object... params)
definitionName : I use the template path separated by ::
but I do not know what is targetObjec, and params . and how I specify my model with this function ?
sorry for my bad english ,hope to see some responses soon .
|
|
|
Re: [XPAND] Xpandfacade with metamodel .ecore [message #1095564 is a reply to message #1093594] |
Tue, 27 August 2013 08:12   |
Eclipse User |
|
|
|
Hi,
i am not quite sure what your question is targeting. is it how to i read a ecore model?
targetObject is the Object or List of Object that shall be processed.
params are the parameters that go into the transformation (if you have any ..)
«DEFINE definionName FOR Entity(String a, Boolean b)»«ENDDEFINE»
|
|
|
|
Re: [XPAND] Xpandfacade with metamodel .ecore [message #1096301 is a reply to message #1096050] |
Wed, 28 August 2013 07:58   |
Eclipse User |
|
|
|
Hi,
are you asking how to read the model or how to tell xpand to use the specific metamodel?
for the first one you can use std emf facilities - not xpand related.
for the second you can call registerMetamodel on the executioncontext. with a new EmfMetaModel instance onwich you called setMetaModelFile (basically the same as you did in your workflow)
|
|
|
|
Powered by
FUDForum. Page generated in 0.03900 seconds