Community
Participate
Working Groups
The current implementation of caseEnumerationLiteral sets the values of the enumeration literals to a fixed value according to their position inside the enumeration they are owned by: eEnumLiteral.setValue(enumeration.getOwnedLiterals().indexOf(enumerationLiteral)); Ecore models do indeed allow to specify individual (customized) values for enumeration literals (attribute value of EEnumLiteral). This feature can - regarding the current implementation - not be used if generating an ecore model from a uml2 model, so I would propose to change that so that a literal value is taken from the uml2 model - if specified (e.g. via a LiteralInteger set as specification of the EEnumLiteral). A concrete use case for this is that I want to define enumeration literals in my EMF-model (in my example its an EEnum named OrienationKind) whose literal values should match the values of constants defined in an already existent Java interface (in my case this is org.eclipse.draw2d.PositionConstants). So I want e.g. to have a literal HORIZONTAL with value 64 and a literal VERTICAL with value 128, which is currently not possible via uml2 import (they always get the values 0 and 1). One Note: The deluxe version would be that I could not only specify the integer values for the literals in my uml2 model via an IntegerLiteral, but that I could indeed provide an OpaqueExpression, where I could specify that the value of the literal will be directly determined from the value of the Interface constant.
Created attachment 50091 [details] proposed fix Would the attach patch meets your needs?
The fix has been committed to CVS.
Fixed in M200609141745.
Move to verified as per bug 206558.