Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Custom (runtime) attributes set for EClass
Custom (runtime) attributes set for EClass [message #206066] Thu, 18 September 2008 16:17 Go to next message
Artem is currently offline ArtemFriend
Messages: 2
Registered: July 2009
Junior Member
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 #206131 is a reply to message #206066] Fri, 19 September 2008 11:17 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Artem,

Looks like you have to add child node to MuClass with possibility to store
key-value pairs + create property view handling it.

-----------------
Alex Shatalin
Re: Custom (runtime) attributes set for EClass [message #206284 is a reply to message #206131] Mon, 22 September 2008 15:51 Go to previous messageGo to next message
Artem is currently offline ArtemFriend
Messages: 2
Registered: July 2009
Junior Member
Alex,

Thanks for your reply!
But could you please explain it for me?
> Looks like you have to add child node to MuClass with possibility to store
> key-value pairs + create property view handling it.

To be cleare, I understand nothing.

I've tried to use attribute with type EList<?> but EMF warried me (on
generation step from .ecore to .genmodel) that this type can't be
persisted. Exact message is "Attribute xxxxx is not transient so it must
have a datatype that is serializable". Can you say smth about EList
attributes and GMF? Maybe GMF is so smart that generates code with nice
GUI control for list of values? Or this should be done manually?
Re: Custom (runtime) attributes set for EClass [message #206293 is a reply to message #206284] Mon, 22 September 2008 16:20 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
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
Previous Topic:NoteAttachmentEditPart customization
Next Topic:Get the editPart from an Impl
Goto Forum:
  


Current Time: Mon May 17 04:48:52 GMT 2021

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

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

Back to the top