Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » EMF problem
EMF problem [message #512874] Mon, 08 February 2010 04:33 Go to next message
T. Wilhelm is currently offline T. Wilhelm
Messages: 129
Registered: July 2009
Senior Member
Hi all,

maybe i´m in the wrong forum, but i couldn´t find an adequate Forum for EMF topics.

I´m new to EMF and have a very simple question, anyway i couldn´t find a good example in the net. I want to create a class dynamically, create an attribute for the class and set its value. Everything works, except of setting the value. what do i do wrong?

EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
EcorePackage ecorePackage = EcorePackage.eINSTANCE;

 // create an Company class
EClass companyClass = ecoreFactory.createEClass();
companyClass.setName("Company");

// create company name
EAttribute companyName = ecoreFactory.createEAttribute();
companyName.setName("name");
companyName.setEType(ecorePackage.getEString());
       companyClass.getEStructuralFeatures().add(companyName);
        
companyClass.eSet(companyName, "CocaCola");



when i call eSet i get the following error Message:

java.lang.IllegalArgumentException: The feature 'name' is not a valid changeable feature

Can anybody help me?
Thanks alot!
Thomas
Re: EMF problem [message #512893 is a reply to message #512874] Mon, 08 February 2010 05:09 Go to previous message
T. Wilhelm is currently offline T. Wilhelm
Messages: 129
Registered: July 2009
Senior Member
Ok got it Wink

Finally i could find a good example, and discovered my error in reasoning.

Thanks anyway.
Previous Topic:Adding Update Manager
Next Topic:What's the id of the copy entry in the non-text editor popup menu?
Goto Forum:
  


Current Time: Sat Aug 23 07:41:47 EDT 2014

Powered by FUDForum. Page generated in 0.03001 seconds