Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Using GMF and dynamic EMF with EEnumLiteral
Using GMF and dynamic EMF with EEnumLiteral [message #536480] Fri, 28 May 2010 12:50 Go to next message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 29
Registered: May 2010
Junior Member
Hello everyone !

I would like to add more flexibility to my Ecore model by using dynamic EMF capability. One of my Ecore classes is called Decision and has a decisionType attribute of type DecisionType which is an EEnum with no literals.

I add literals to the EEnum by program when my GMF-based graphical editor starts up. When I select a Decision instance graphical object in the editor, a combo-box in the Properties view lets me select a value for the decisionType attribute; but instead of getting foo, bar, ding as combo-box displayed values, I get foo=0, bar=1 and ding=2. This would be acceptable, although not very nice, but the main issue is that whatever the selected value is, the decisionType property is never set. Could you please tell me what I am missing ?

Thanks a lot in advance for your time !

Georges
Re: Using GMF and dynamic EMF with EEnumLiteral [message #536492 is a reply to message #536480] Fri, 28 May 2010 13:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33188
Registered: July 2009
Senior Member
Georges,

Comments below.

Georges wrote:
> Hello everyone !
>
> I would like to add more flexibility to my Ecore model by using
> dynamic EMF capability. One of my Ecore classes is called Decision and
> has a decisionType attribute of type DecisionType which is an EEnum
> with no literals.
>
> I add literals to the EEnum by program when my GMF-based graphical
> editor starts up.
A generated model should not be dynamically modified. This just isn't
supported. Are you really saying you have a generated empty Java
enumeration?
> When I select a Decision instance graphical object in the editor, a
> combo-box in the Properties view lets me select a value for the
> decisionType attribute; but instead of getting foo, bar, ding as
> combo-box displayed values, I get foo=0, bar=1 and ding=2. This would
> be acceptable, although not very nice, but the main issue is that
> whatever the selected value is, the decisionType property is never
> set. Could you please tell me what I am missing ?
>
> Thanks a lot in advance for your time !
>
> Georges


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using GMF and dynamic EMF with EEnumLiteral [message #536515 is a reply to message #536492] Fri, 28 May 2010 14:37 Go to previous messageGo to next message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 29
Registered: May 2010
Junior Member
Hello Ed,

Yes, my generated Java enumeration was initially empty. I have slightly modified it by adding a default "None" literal which value is 0.
After getting your reply, I have read again the Dynamic EMF chapter of the EMF book and found this : "Even when using dynamic EMF, once we begin instantiating the model, it is no longer safe to change it."
Should I create a dynamic class or enum that extends a generated one, and add additional features there, like suggested in the book ?

Best regards,

Georges
Re: Using GMF and dynamic EMF with EEnumLiteral [message #536568 is a reply to message #536515] Fri, 28 May 2010 16:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33188
Registered: July 2009
Senior Member
Georges,

Comments below.

Georges wrote:
> Hello Ed,
>
> Yes, my generated Java enumeration was initially empty. I have
> slightly modified it by adding a default "None" literal which value is 0.
> After getting your reply, I have read again the Dynamic EMF chapter of
> the EMF book and found this : "Even when using dynamic EMF, once we
> begin instantiating the model, it is no longer safe to change it."
> Should I create a dynamic class or enum that extends a generated one
Enums aren't extensible.
> , and add additional features there, like suggested in the book ?
A dynamic package with an extending class with a feature of some dynamic
enum also from that package would make sense.
>
> Best regards,
>
> Georges


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using GMF and dynamic EMF with EEnumLiteral [message #536827 is a reply to message #536568] Mon, 31 May 2010 08:00 Go to previous messageGo to next message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 29
Registered: May 2010
Junior Member
Hello Ed,

Thanks a lot for putting me on track; I will go that way.

Best regards,

Georges
Re: Using GMF and dynamic EMF with EEnumLiteral [message #536934 is a reply to message #536827] Mon, 31 May 2010 14:44 Go to previous messageGo to next message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 29
Registered: May 2010
Junior Member
Hello Ed,

I am still trying to implement dynamically a part of my EMF model so that I can set dynamic attributes values through combo-boxes in the Properties view of my graphical editor.

I dynamically extend the Decision class with a DynamicDecision one and I add a decisionType attribute to the derived class. The type of the decisionType attribute is DecisionType which is a dynamic EEnum.

If Decision had no attribute, I couldn't map anything from GMF to Decision. So, I suppose I should add an attribute to the Decision class. Am I wrong ? If an attribute is necessary, what type should this attribute be set to since we do not know the type of the attribute which will be dynamically added to the derived class ?

Could you (or someone else, since this is mainly a GMF-related question) clarify the Dynamic-EMF / GMF relationship, please ?

Thanks a lot in advance for your time !

Georges



Re: Using GMF and dynamic EMF with EEnumLiteral [message #537019 is a reply to message #536934] Mon, 31 May 2010 23:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33188
Registered: July 2009
Senior Member
Georges,

GMF's Tooling is heavily focused on generating what's needed. I'm not
even sure it works with dynamic models. E.g., I don't think there is a
GMF reflective editor. Someone more familiar will need to comment.


Georges wrote:
> Hello Ed,
>
> I am still trying to implement dynamically a part of my EMF model so
> that I can set dynamic attributes values through combo-boxes in the
> Properties view of my graphical editor.
>
> I dynamically extend the Decision class with a DynamicDecision one and
> I add a decisionType attribute to the derived class. The type of the
> decisionType attribute is DecisionType which is a dynamic EEnum.
>
> If Decision had no attribute, I couldn't map anything from GMF to
> Decision. So, I suppose I should add an attribute to the Decision
> class. Am I wrong ? If an attribute is necessary, what type should
> this attribute be set to since we do not know the type of the
> attribute which will be dynamically added to the derived class ?
>
> Could you (or someone else, since this is mainly a GMF-related
> question) clarify the Dynamic-EMF / GMF relationship, please ?
>
> Thanks a lot in advance for your time !
>
> Georges
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:NPE in XXXDiagramEditor.getEditingDomain after migrating to GMF 2.3
Next Topic:Avoiding Delete From Model/Delete from Diagram completely?
Goto Forum:
  


Current Time: Sat Jul 27 05:40:26 GMT 2024

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

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

Back to the top