Skip to main content



      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 15:16 Go to next message
Eclipse UserFriend
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 12:29 Go to previous messageGo to next message
Eclipse UserFriend
what do you mean by "must read" and "debug the model"
Re: Reference other Xtext model [message #1787621 is a reply to message #1787457] Wed, 30 May 2018 04:47 Go to previous messageGo to next message
Eclipse UserFriend
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 05:40 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Reference other Xtext model [message #1790078 is a reply to message #1787626] Mon, 04 June 2018 08:41 Go to previous message
Eclipse UserFriend
That solved my problem!
Thank you very much ;)
Previous Topic:Xtext scope
Next Topic:XtextReconcilerJob popup error (start > length)
Goto Forum:
  


Current Time: Wed Jun 18 14:56:50 EDT 2025

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

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

Back to the top