Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Type for variable
Type for variable [message #1731625] Sun, 08 May 2016 08:21 Go to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
Hi,

I have the following rule for definig variable
Variable returns Variable:
	(changeable?='changeable')?
	scope=Scope
	(eType=[ecore::EClassifier|QualifiedName])?
	name=EString 
	('=' defaultValue=EString)?
	'{'
		('ordered' ordered=EBoolean)?
		('unique' unique=EBoolean)?
		('lowerBound' lowerBound=EInt)?
		('upperBound' upperBound=EInt)?
		('value' value=[ecore::EObject|EString])?
		('eAnnotations' '{' eAnnotations+=EAnnotation ( "," eAnnotations+=EAnnotation)* '}' )?
		('eGenericType' eGenericType=EGenericType)?
	'}';


its DSl looks like as following
 			variables{
 				LOCAL ecoreI.Begriff Begriff{},
 				LOCAL ecoreI.BildAnlegen BildAnlegen{},
 				//LOCAL EString TRUE{},
 				LOCAL ecoreI.BegriffContainer BegriffContainer{},
 				LOCAL ecoreI.Bild Bild = ""{},
 				LOCAL ecoreI.AudioAnlegen AudioAnlegen{},
 				LOCAL ecoreI.Audio Audio{},
 				LOCAL ecoreI.AntwortenAnlegen AntwortenAnlegen{},
 				LOCAL ecoreI.Antwort AntwortListe {upperBound -1},
 				LOCAL ecoreI.Antwort Antwort = ""{},
 				//LOCAL "EBooleanObject" Ergebnis {},
 				LOCAL ecoreI.Thema Thema {},
 				//LOCAL "EString" EIGENES = "Eigenes"{},
 				LOCAL ecoreI.BegriffEingabe BegriffEingabe {}
 			}



I want to be able to define a variable of type a class which is possible now and also as Type Int or String and ... but it's not possible now. How should I change this line ?
(eType=[ecore::EClassifier|QualifiedName])?


Re: Type for variable [message #1731627 is a reply to message #1731625] Sun, 08 May 2016 10:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

i cannot reproduce this. are you sure the edatatypes you are looking for are actually on the scope e.g. by putting org.eclipse.emf.ecore plugin onto the classpath of the your.mydsl file


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Type for variable [message #1731631 is a reply to message #1731627] Sun, 08 May 2016 13:13 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
Hi,

I have org.eclipse.emf.ecore in plugin dependencies of my.mydsl
index.php/fa/25839/0/

but when I want to use content assist I have all the classes that I have defined in another ecore file ( that 's what I wanted ) I need EString and EInt and .... ( but I don't have them)

index.php/fa/25840/0/





[Updated on: Sun, 08 May 2016 13:13]

Report message to a moderator

Re: Type for variable [message #1731632 is a reply to message #1731631] Sun, 08 May 2016 13:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Once again. Is the ecore file containing these on the class path. It is not
unless you actively put it there


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Type for variable [message #1731633 is a reply to message #1731632] Sun, 08 May 2016 13:51 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
I only made a screenshot because I'm not very professional with xtetx Smile I though maybe I don't undestand it correctly Smile
Re: Type for variable [message #1731634 is a reply to message #1731633] Sun, 08 May 2016 14:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Can you share the complete project containing the your.mydsl file

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Type for variable [message #1731635 is a reply to message #1731634] Sun, 08 May 2016 14:49 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
No Message Body
Re: Type for variable [message #1731637 is a reply to message #1731635] Sun, 08 May 2016 15:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hi, your models should reside inside a source folder - otherwhise classpath based scoping will no work correct

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Type for variable [message #1731638 is a reply to message #1731637] Sun, 08 May 2016 15:43 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
YES,

Thanks a lot. That is exactly what I needed.
What's the difference between src folder and another folder?
Re: Type for variable [message #1731639 is a reply to message #1731638] Sun, 08 May 2016 15:50 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Xtext calculates what is visible in global scope differently

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Disambiguate between reference and ValidID
Next Topic:How to Contribute
Goto Forum:
  


Current Time: Fri Mar 29 10:31:18 GMT 2024

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

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

Back to the top