|
|
Re: Programmatically populated dropdown for string attribute? [message #508686 is a reply to message #508603] |
Tue, 19 January 2010 20:33 |
Christoph Wienands Messages: 55 Registered: July 2009 |
Member |
|
|
Hey Ed,
this was exactly the hint I needed. I couldn't really find any other good description of how to do this but some debugging and library digging did the trick.
In case someone else is trying to solve the same problem, here is how I did it:
1) In the .edit project of your language, identify the item provider that corresponds with the model class which contains the EAttribute you want to dropdownize.
2) In that class, the method 'getPropertyDescriptors' adds property descriptors for each attribute and reference. Find the method that adds the descriptor for the attribute that will get the dropdown.
3) In that method, replace the call to createItemPropertyDescriptor with the instantiation of a custom item property descriptor. Don't forget to mark that method with '@generated NOT'. Otherwise you'll lose those changes after the next EMF regeneration.
4) Create this custom item property descriptor by deriving it from ItemPropertyDescriptor. Now you only have to override the getChoiceOfValues method and programmatically determine and return the values for the combo box.
Have fun, Christoph
[Updated on: Tue, 19 January 2010 20:34] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02818 seconds