Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Cant access modelobjects of a EMF-Editor
Cant access modelobjects of a EMF-Editor [message #653045] Tue, 08 February 2011 08:50 Go to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 8
Registered: September 2010
Junior Member
Hi Guys.

Problem:
With the generated EMF-Editor, i can create new cars (see mymodel) but cant access them with Xtext. I tried to combine 2 Xtext Projects with each other and this works fine.

1.I have a EMF Project with a Ecorefile "mymodel":
(Carports contains Cars)

<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mymodel"
nsURI="http://mymodel/" nsPrefix="mymodel">
<eClassifiers xsi:type="ecore:EClass" name="Carport">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="cars" upperBound="-1"
eType="#//Car" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Car">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="drivers" upperBound="-2"
eType="#//Driver" containment="true"/>
</eClassifiers>

2.Than i made a new Xtext Projekt:

import "platform:/resource/org.emf.test.mymodel/model/mymodel.ecore " as mymodel

Model:
cars+=Car*;

Car:
'mycar' name=[mymodel::Car];


3.The referenced GenModel is part of the MWE2-File

I couldnt find a description in the doc.
If there is one, please give me a hint.

Thanks for your help.



Re: Cant access modelobjects of a EMF-Editor [message #653048 is a reply to message #653045] Tue, 08 February 2011 08:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

you have to build an infrastructure to add the .mymodel files yourself. (Writing a ResourceServiceProvider)

have a look what xtext does for .ecore files in the plugins org.eclipse.xtext.ecore and org.eclipse.xtext.ui.ecore and Adreas Graf described in his blog for .uml files http://5ise.quanxinquanyi.de/2010/10/31/xtext-1-0-0-and-uml- xpand-on-top/

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cant access modelobjects of a EMF-Editor [message #653282 is a reply to message #653048] Wed, 09 February 2011 08:28 Go to previous message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 8
Registered: September 2010
Junior Member
Thank you for your help, it works Smile

Christian Dietrich wrote on Tue, 08 February 2011 09:58
Hi,

you have to build an infrastructure to add the .mymodel files yourself. (Writing a ResourceServiceProvider)

have a look what xtext does for .ecore files in the plugins org.eclipse.xtext.ecore and org.eclipse.xtext.ui.ecore and Adreas Graf described in his blog for .uml files http://5ise.quanxinquanyi.de/2010/10/31/xtext-1-0-0-and-uml- xpand-on-top/

~Christian

Previous Topic:help with rewrite of model after parsing
Next Topic:XpandExecutionContextImpl and registerMetaModel
Goto Forum:
  


Current Time: Thu Apr 25 20:25:20 GMT 2024

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

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

Back to the top