Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [XPAND] Xpandfacade with metamodel .ecore
[XPAND] Xpandfacade with metamodel .ecore [message #1093594] Sat, 24 August 2013 10:01 Go to next message
Adnan AL-SOSWA is currently offline Adnan AL-SOSWAFriend
Messages: 41
Registered: May 2010
Member
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 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
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»


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: [XPAND] Xpandfacade with metamodel .ecore [message #1096050 is a reply to message #1095564] Tue, 27 August 2013 22:45 Go to previous messageGo to next message
Adnan AL-SOSWA is currently offline Adnan AL-SOSWAFriend
Messages: 41
Registered: May 2010
Member
Thank you christian for response.

what I meant that my model that i am working with is actually the .ecore file which is the metamodel . and this .ecore is choosen by user from system , so the model is not included in my plugin. and I want to implement my template file on this metamodel .ecore file
i have for example this path of the model
c:\mymodels\mymodel.ecore , and I have template that access the element in this model
with this path
Template::mytemplate::main

how I can use xpandfacde class with these file mymodel.ecore and the template ?

thanks again and please be patient with me Smile

[Updated on: Tue, 27 August 2013 22:46]

Report message to a moderator

Re: [XPAND] Xpandfacade with metamodel .ecore [message #1096301 is a reply to message #1096050] Wed, 28 August 2013 07:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
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)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: [XPAND] Xpandfacade with metamodel .ecore [message #1098013 is a reply to message #1096301] Fri, 30 August 2013 13:22 Go to previous message
Adnan AL-SOSWA is currently offline Adnan AL-SOSWAFriend
Messages: 41
Registered: May 2010
Member
nice , Thank you very much .
Previous Topic:Adding Modelelemets to the Model during Editing
Next Topic:JET2 Editor Source Code
Goto Forum:
  


Current Time: Sat Nov 09 00:08:01 GMT 2024

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

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

Back to the top