Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [acceleo] Utilisation d 'enum
[acceleo] Utilisation d 'enum [message #545544] Thu, 08 July 2010 08:34 Go to next message
poltrox  is currently offline poltrox Friend
Messages: 16
Registered: June 2010
Junior Member
Bonjour,

est il possible d 'utiliser les enum EMF dans acceleo ?
si oui comment je peux comparer une variable de type enum avec les valeur de l'enum ?

exemple :

J 'ai une enum EnumSide : Banside,CustomerSide
et une classe View qui a un attribut side de type EnumSide

(For (v:view|c.views)
[if (v.side=BankSide)

Cela ne compile pas.L 'utilisation du # d 'ATL non plus.


Merci d 'avance
Re: [acceleo] Utilisation d 'enum [message #545554 is a reply to message #545544] Thu, 08 July 2010 08:55 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 413
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,
In order to resolve this problem you need to provide a bit more information in order to use your enumeration.
Something like this won't work : "if (operation.visibility = public)"
You would have to use this: "if (operation.visibility = VisibilityKind::public)"

So in your case something like this should work: if (v.side=EnumSide::BankSide)
From: http://eclipsemde.blogspot.com/2010/04/ocl-tips-and-tricks.h tml

-----------------------------------------------------------
Salut,
Pour résoudre ton problème tu vas devoir fournir un peu plus d'information pour utiliser l'énumération.
Quelque chose comme ça ne marchera pas : "if (operation.visibility = public)"
Il faut utiliser ça : "if (operation.visibility = VisibilityKind::public)"

Donc dans ton cas, ceci devrait marcher : if (v.side=EnumSide::BankSide)
De : http://eclipsemde.blogspot.com/2010/04/ocl-tips-and-tricks.h tml



Re: [acceleo] Utilisation d 'enum [message #545607 is a reply to message #545554] Thu, 08 July 2010 12:21 Go to previous message
poltrox  is currently offline poltrox Friend
Messages: 16
Registered: June 2010
Junior Member
Merci ca marche Very Happy
Previous Topic:[xpand] fixed indentation
Next Topic:Xtend java extensions with primitive type parameters
Goto Forum:
  


Current Time: Sun Nov 23 12:23:16 GMT 2014

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

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