Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Enumeration type not save
Enumeration type not save [message #491045] Tue, 13 October 2009 02:44 Go to next message
Eric is currently offline EricFriend
Messages: 77
Registered: July 2009
Member
Hello,

I'm creating a enum type for an attribute as follow:

EEnum enumerator = ecoreFactory.createEEnum();
ePackage.getEClassifiers().add(enumerator);
eAttribute.setEType(enumerator);

for (....) {
EEnumLiteral literal = (EEnumLiteral)
ecoreFactory.createEEnumLiteral();
literal.setLiteral(entryType.getLabel());
enumerator.getELiterals().add(literal);
}

However, when I serialize the model the attribute type show as null, it is
not being serialized. Should I use EcorePackage.eINSTANCE.getEEnumerator()

to set the enumemration attribute type instead? By then how can I set the
EEnumLiteral?

Thanks for your help
Re: Enumeration type not save [message #491054 is a reply to message #491045] Tue, 13 October 2009 03:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Eric,

Comments below.

Eric wrote:
> Hello,
>
> I'm creating a enum type for an attribute as follow:
>
> EEnum enumerator = ecoreFactory.createEEnum();
> ePackage.getEClassifiers().add(enumerator);
> eAttribute.setEType(enumerator);
>
> for (....) {
> EEnumLiteral literal = (EEnumLiteral)
> ecoreFactory.createEEnumLiteral();
> literal.setLiteral(entryType.getLabel());
> enumerator.getELiterals().add(literal);
> }
>
> However, when I serialize the model the attribute type show as null, it is
> not being serialized.
Is ePackage contained by a resource?
> Should I use EcorePackage.eINSTANCE.getEEnumerator()
>
> to set the enumemration attribute type instead? By then how can I set the
> EEnumLiteral?
>
> Thanks for your help
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Enumeration type not save [message #491121 is a reply to message #491054] Tue, 13 October 2009 11:59 Go to previous message
Eric is currently offline EricFriend
Messages: 77
Registered: July 2009
Member
Yes, ePackage is contained by a resource. It looks like a new to set a name
for the EEnum otherwise the attribute type is not being set.

"Ed Merks" <Ed.Merks@gmail.com> wrote in message
news:hb0tos$gba$3@build.eclipse.org...
> Eric,
>
> Comments below.
>
> Eric wrote:
>> Hello,
>>
>> I'm creating a enum type for an attribute as follow:
>>
>> EEnum enumerator = ecoreFactory.createEEnum();
>> ePackage.getEClassifiers().add(enumerator);
>> eAttribute.setEType(enumerator);
>>
>> for (....) {
>> EEnumLiteral literal = (EEnumLiteral)
>> ecoreFactory.createEEnumLiteral();
>> literal.setLiteral(entryType.getLabel());
>> enumerator.getELiterals().add(literal);
>> }
>>
>> However, when I serialize the model the attribute type show as null, it
>> is not being serialized.
> Is ePackage contained by a resource?
>> Should I use EcorePackage.eINSTANCE.getEEnumerator()
>>
>> to set the enumemration attribute type instead? By then how can I set the
>> EEnumLiteral?
>>
>> Thanks for your help
>>
>>
>>
Previous Topic:[Teneo] how do I change e_id to <class>_id
Next Topic:[teneo] multiple gmf diagrams?
Goto Forum:
  


Current Time: Thu Apr 25 20:48:57 GMT 2024

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

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

Back to the top