Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Referring an xcore enum in xtext
Referring an xcore enum in xtext [message #1732805] Fri, 20 May 2016 10:43 Go to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
Hi,

I have an enum defined in xcore.

class Greeting {
 String name
 eStatus status
}

enum eStatus {
single as "Single"
married as "Married"
widowed as "Widowed"
annulled as "Annulled"
}


Currently, I also do this in my .xtext file.
Model:
	greetings+=Greeting*;
	
Greeting :
	'Hello' name=ID 'is' status=eStatus '!'
	;
enum eStatus :
singla = "Single" |
married = "Married" |
widowed = "Widowed" |
annulled = "Annulled";


How can I just refer to the xcore enum directly?

[Updated on: Fri, 03 June 2016 10:08]

Report message to a moderator

Re: Referring an xcore enum in xtext [message #1734042 is a reply to message #1732805] Fri, 03 June 2016 10:10 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I haven't figured this one out yet. I hope someone can answer. Smile
Re: Referring an xcore enum in xtext [message #1734054 is a reply to message #1734042] Fri, 03 June 2016 11:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
i dont know any answer than actually defining the enum

maybe it is more convenient to have

MyEnum returns xxxx::MyEnum: ID;

+ a value converter
+ adaptations to content assist


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Referring an xcore enum in xtext [message #1734207 is a reply to message #1734054] Mon, 06 June 2016 08:23 Go to previous message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
Hi Christian,
Thanks for the reply.
I will just do it as you suggested.
Previous Topic:Loading operator extension from Jar file
Next Topic:Xtext from ecore model error - couldn't resolve reference to EPackage
Goto Forum:
  


Current Time: Sun Nov 17 12:59:28 GMT 2019

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

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

Back to the top