Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Reference other Xtext model(Make references in one Xtext model in anouther one (with other DSL))
Reference other Xtext model [message #1787252] Tue, 22 May 2018 19:16 Go to next message
Peter Altmayer is currently offline Peter AltmayerFriend
Messages: 7
Registered: April 2018
Junior Member
Hi guys,

I have two different Xtext models. Each with it's own DSL.
Now I want to make references from one model to the other one.
I already could "import" the other model i want to reference by:
- Add a import statement in Xtext model
- Add dependency in MANIFEST file
- Add theese two lines in workflow:
referencedResource = "platform:/resource/org.xtext.example.mydsl/model/generated/MyDsl.genmodel"
fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {}


No errors so far (however, is this the proper way to do?)

The problems occurs when debug the model.
Of course it does not find any elements to reference because it must read a file of the referenced model.
How to achieve that?

Thx for your help!
Re: Reference other Xtext model [message #1787457 is a reply to message #1787252] Fri, 25 May 2018 16:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12244
Registered: July 2009
Senior Member
what do you mean by "must read" and "debug the model"

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reference other Xtext model [message #1787621 is a reply to message #1787457] Wed, 30 May 2018 08:47 Go to previous messageGo to next message
Peter Altmayer is currently offline Peter AltmayerFriend
Messages: 7
Registered: April 2018
Junior Member
Problem solved.
I could not reference my other model because I did not used full qualified names.
But now another problems occurs to me:
I want to reference an element with an INT as name. Example :

Referenced model:
Model:  'ModelA' name=ID '{'
	(parts+=Part)* '}';
			
Part: 'ID' name=INT ;


Referencing model:
import ".../ModelA" as modelA

Model:
	imports+=Import*
	references+=[modelA::Part|FQN]
	;

Import:
	'IMPORT' importURI=STRING;

FQN:
	ID ('.' INT);	


Everything works fine, if the type of Part's name is "ID". But if i use "INT" instead (like in the example above), the references are not resolved anymore.
What's the problem with replacing ID with INT?
Re: Reference other Xtext model [message #1787626 is a reply to message #1787621] Wed, 30 May 2018 09:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12244
Registered: July 2009
Senior Member
you need to adapt the IQualifiedNameProvider (default is DefaultDeclarativeNAmeProvider) for your dsl see https://dietrich-it.de/xtext/2011/07/16/iqualifiednameproviders-in-xtext-2-0.html

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reference other Xtext model [message #1790078 is a reply to message #1787626] Mon, 04 June 2018 12:41 Go to previous message
Peter Altmayer is currently offline Peter AltmayerFriend
Messages: 7
Registered: April 2018
Junior Member
That solved my problem!
Thank you very much ;)
Previous Topic:Xtext scope
Next Topic:XtextReconcilerJob popup error (start > length)
Goto Forum:
  


Current Time: Wed Sep 26 08:39:45 GMT 2018

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

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

Back to the top