Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [MWE] Use metamodel from other plugin
[MWE] Use metamodel from other plugin [message #701584] Mon, 25 July 2011 09:21 Go to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Hello guys,
I am using a xpand generator in my mwe workflow, which requires a metamodel file.
Until now I always stored the metamodel and the workflow file in the same eclipse plugin.

<workflow>
	<property name='metaecorefile1' value="/model/functionmodel.ecore"/>


	<!-- generate code -->
  	<component id="generator" class="org.eclipse.xpand2.Generator">
  		<expand value="functionmodelGenerator::function::main FOR model"/>
   		
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
     		<metaModelFile value='${metaecorefile1}'/>
  		</metaModel>


Now I want to store the ecore file in a different plugin. It is possible to specify the path to an other plugin or are other mechanism for that case ?


Sincerly
Patrick
Re: [MWE] Use metamodel from other plugin [message #701639 is a reply to message #701584] Mon, 25 July 2011 11:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

Which Mwe Version do you use?
=> if 1.1.0 then use platform:/resource/plugin/.....
Is the second plugin a workspace project too?
=> then use platform:/resource/plugin/.....
Do you use dynamic EMF or do you have to Java Classes Generated too?
=> use the package instead of dynamic emf

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [MWE] Use metamodel from other plugin [message #701785 is a reply to message #701639] Mon, 25 July 2011 15:38 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Yes I am using EMF Modeling Workflow Engine 1.1.0.

I tried <property name='metaecorefile1' value="platform:/resource/com.ksb.mechatronic.modeller/model/functionmodel.ecore"/>,
but when executing the code I get an error:
org.eclipse.emf.mwe.core.ConfigurationException: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Resource '/com.ksb.mechatronic.modeller/model/functionmodel.ecore' does not exist.
The ecore file is in the build path of that plugin.

My second try:

I also have the generated java classes in that other plugin, but they are not recognised by the workflow.
I set the plugin, which contains the ecore file and the generated java classes, as required dependency and
added the generated packages to the imported packages of my generator plugin without success.

What must i do that the workflow knows the types of the imported package ?

Re: [MWE] Use metamodel from other plugin [message #701820 is a reply to message #701785] Mon, 25 July 2011 16:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

do you call standalonesetup.setplatformuri in your wf?

Use the classes:
org.eclipse.xtend.typesystem.emf.EmfMetaModel.setMetaModelPackage(String)

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [MWE] Use metamodel from other plugin [message #702338 is a reply to message #701820] Tue, 26 July 2011 08:29 Go to previous messageGo to next message
Patrick Schmitt is currently offline Patrick SchmittFriend
Messages: 87
Registered: July 2009
Member
Hello Christian,
finally i found the solution Smile
I must not specify the direct path to my metamodel,
i just have to add following code to the workflow to get it working:

<!-- instantiate metamodel -->
<bean id="mm_emf" class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
<!-- <expand value="templates::Root::Root FOR RootDiagram"/> -->

<!-- generate code -->
<component id="generator" class="org.eclipse.xpand2.Generator">
<expand value="functionmodelGenerator::function::main FOR model"/>

<metaModel idRef="mm_emf"/>

What is that code doing? I want to understand it.
Re: [MWE] Use metamodel from other plugin [message #702410 is a reply to message #702338] Tue, 26 July 2011 10:28 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

EmfRegistryMetaModel takes all EMF Metamodel that are registered to EMFs Registry.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:[Acceleo] Does the Acceleo Language support constants?
Next Topic:acceleo : support for variable increment in for loops?
Goto Forum:
  


Current Time: Tue Apr 16 16:46:11 GMT 2024

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

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

Back to the top