Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Xtend - access the EnumLiterals - not possible(Xtend)
Xtend - access the EnumLiterals - not possible [message #947495] Wed, 17 October 2012 02:15 Go to next message
Dan Tololoi is currently offline Dan Tololoi
Messages: 33
Registered: September 2012
Location: Iasi, Romania
Member

Hello all,

I have this following issue into one file.ext that I created to generate some code out of the ecore.

String getString(Type type):
switch (type) {
case Type::Running : "Running_type"
case Type::Waiting : "Waiting_type"
default : "default"
};

Type is an Enum in my ecore and has the EnumLiterals Running and Waiting. I receive the error in the editor : Callable not found:Unknown variable, type or enumeration literal
'Type::Running'.

I have added also the check for the JavaBeansMetamodel to have it activated.
When I access this getString from the Xpand, it always takes the default case, meaning the evaluation was not done for Running or Waiting.

Maybe someone has a clue what else should I do or what should I change in the above syntax.
I add also that I don't want the getType to have it used, because I want to customize the text that I generate.

[Updated on: Wed, 17 October 2012 02:34]

Report message to a moderator

Re: Xtend - access the EnumLiterals - not possible [message #947525 is a reply to message #947495] Wed, 17 October 2012 02:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6133
Registered: July 2009
Senior Member
Hi i cannot reproduce this.
are you sure you did the imports right?

Re: Xtend - access the EnumLiterals - not possible [message #947549 is a reply to message #947525] Wed, 17 October 2012 03:20 Go to previous messageGo to next message
Dan Tololoi is currently offline Dan Tololoi
Messages: 33
Registered: September 2012
Location: Iasi, Romania
Member

Yes, the import is done OK, for other types it works and I also have a context help.
import machine;

and machine is the package name and also the ecore name
Re: Xtend - access the EnumLiterals - not possible [message #947565 is a reply to message #947549] Wed, 17 October 2012 03:39 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6133
Registered: July 2009
Senior Member
Can you share a complete example?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Previous Topic:Problem installing Xpand
Next Topic:Problems running org.eclipse.acceleo:maven:3.2.1 in maven
Goto Forum:
  


Current Time: Mon Jul 28 10:36:00 EDT 2014

Powered by FUDForum. Page generated in 0.06047 seconds