Custom (runtime) attributes set for EClass [message #206066] |
Thu, 18 September 2008 12:17  |
Eclipse User |
|
|
|
Hi all!
Fist of all, I am new to GMF, so please excuse for probably stupid
questions..
Q: In a model I have a class MyClass with defined attribute 'name'. In
runtime some info arrives (logic pairs of key names and values) and I want
to add it as attributes of MyClass. As a result, I want to have the same
behavior as for legacy attribute 'name': to show new attributes in
property-view on-selection, to show them in graphical MyClass
representation, to persist all data (including new attributes) in xml and
so on. Does GMF able to do it?
In generated code for my model I see factories and other stuff which is
statically bind to content of my model- meta-class names and attributes
each have own (predefined) ids. But maybe there is a way to dynamically
map data model to GUI model?
Thanks,
Artem
|
|
|
|
|
Re: Custom (runtime) attributes set for EClass [message #206293 is a reply to message #206284] |
Mon, 22 September 2008 12:20  |
Eclipse User |
|
|
|
Hello Artem,
>> Looks like you have to add child node to MuClass with possibility to
>> store key-value pairs + create property view handling it.
I mean:
- create one more class MyKeyValuePair with two features: key:EString, value:EString.
- create containment reference in MyClass pointing to the MyKeyValuePair
with multiplicity *.
- generate code using EMF - as a result you'll be able to store corresponding
values in a model
Then you can either implement additional properties page for MyClass getting/editing
all the existing key/value pairs.
Another option - implement appropriate parser visualizing list of key/values
somewhere i a diagram label of MyClass.
Another option - visualize MyKeyValuePair as a child node of MyClass in a
separated compartment. As a result you'll be able to add/remove/edit this
list using the diagram.
GMF is able to generate editing code only for last use case. The rest can
be implemented manually + plugged into the generated diagramming code.
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.03458 seconds