Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Cannot access eAnnotations of EEnumLiteral
[Xpand] Cannot access eAnnotations of EEnumLiteral [message #533056] Wed, 12 May 2010 06:52 Go to next message
Eclipse UserFriend
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl

Hello,

using this Xpand fragment:

«DEFINE expELiterals FOR EEnum-»
«FOREACH eLiterals AS lit-»
«lit.eAnnotations»
«ENDFOREACH-»
«ENDDEFINE»

I'm trying to expand an Ecore to some text. I need to access the
eAnnotations of the EEnumLiterals of an EEnum. However, when I execute
the workflow, I get:

934  ERROR AbstractExpressionsUsingWorkflowComponent - Error in 
Component  of type org.eclipse.xpand2.Generator:
	EvaluationException : Couldn't find property 'eAnnotations' for type 
cif::ActionDirections
(...)

934  ERROR WorkflowRunner     - Workflow interrupted. Reason: Couldn't 
find property 'eAnnotations' for type cif::ActionDirections
(...)


Statically everything is OK, but at runtime the errors pop up.

The input model is cif.ecore, which contains an enumeration called
'ActionDirections'. For some reason variable 'lit' seems to be the
enumeration type defined in cif.ecore instead of an instance of
EEnumLiteral, or at least that's what the printed representation
indicates. «EEnumLiteral.isInstance(lit)» evaluates to true, so 'lit'
does seem to be an EEnumLiteral, but I can't access the 'name',
'literal', 'instance', 'eAnnotations', etc structural features. About
the only thing I can do, is call toString() on it...

Does anyone know how I can access the structural features of
EEnumLiterals from Xpand/Xtend, in particular the eAnnotations?

Any help would be greatly appreciated.

Dennis
Re: [Xpand] Cannot access eAnnotations of EEnumLiteral [message #533071 is a reply to message #533056] Wed, 12 May 2010 07:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hello Dennis,

the EEnumLiteral handling of xpand / xtend seems to be a bit crappy (specially when using ecore as metamodel). would you please file a bug on this?

As a workaround you could use a JAVA extension starting from the EEnum itself. this should work.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xpand] Cannot access eAnnotations of EEnumLiteral [message #533111 is a reply to message #533071] Wed, 12 May 2010 09:43 Go to previous message
Eclipse UserFriend
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl

Reactions below.

Christian Dietrich wrote:
> Hello Dennis,
>
> the EEnumLiteral handling of xpand / xtend seems to be a bit crappy
> (specially when using ecore as metamodel). would you please file a bug
> on this?

I created one. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=312561

> As a workaround you could use a JAVA extension starting from the EEnum
> itself. this should work.

Thanks, I'll give that a try.


Dennis
Previous Topic:[Acceleo] Good way to get operations object from MessageOccurenceSpecification
Next Topic:<Xtend> How to delete a UseCase from a list
Goto Forum:
  


Current Time: Fri Apr 26 15:34:37 GMT 2024

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

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

Back to the top