Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to show List in a property view
how to show List in a property view [message #228840] Tue, 05 May 2009 09:19 Go to next message
Akansha is currently offline AkanshaFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,
I am trying to build an application in which there is an EClass which has
an EReference to itself. For e.g.

Fruit(EClass)
|--->name(EAttribute)(EType is EString)
|--->otherFruits(EReference) (and its EType is Fruit)

Basically what I want is when i drop a node FRUIT on GMF Editor, then its
OTHERFRUITS property should show list of other FRUIT nodes already
present. But when i am implementing it actually, only NAME property is
coming up in properties view not OTHERFRUITS property. What shall I do?
Please help me.

Thanks,
Akansha
Re: how to show List in a property view [message #228864 is a reply to message #228840] Tue, 05 May 2009 09:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

Hello Akansha,

you should check your genmodel file (the file generated from the ecore
file). There should be an entry for each feature of each class where you
can set whether it should be displayed (read-only or editable) in the
properties sheet. Afterwards, you'll have to regenerate the edit code
(right-clicking on the package element in the genmodel file).

Regards,
Tobias


Akansha schrieb:
> Hi, I am trying to build an application in which there is an EClass
> which has an EReference to itself. For e.g.
> Fruit(EClass) |--->name(EAttribute)(EType is EString)
> |--->otherFruits(EReference) (and its EType is Fruit)
> Basically what I want is when i drop a node FRUIT on GMF Editor, then
> its OTHERFRUITS property should show list of other FRUIT nodes already
> present. But when i am implementing it actually, only NAME property is
> coming up in properties view not OTHERFRUITS property. What shall I do?
> Please help me.
> Thanks, Akansha
>
Re: how to show List in a property view [message #228888 is a reply to message #228864] Tue, 05 May 2009 10:34 Go to previous messageGo to next message
Akansha is currently offline AkanshaFriend
Messages: 14
Registered: July 2009
Junior Member
Thanks a lot. It worked :D
Re: how to show List in a property view [message #229106 is a reply to message #228888] Thu, 07 May 2009 08:34 Go to previous messageGo to next message
Akansha is currently offline AkanshaFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,
Consider the following situation:

Service
|---type:Type

and Type can be any of four TypeA, TypeB, TypeC or TypeD EClasses. How to
do that in ECore file. Any pointers.

Thanks,
Akansha
Re: how to show List in a property view [message #229114 is a reply to message #229106] Thu, 07 May 2009 08:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

I've already noticed your other thread, and if I understand you correct
this should be the default behaviour...

I understood the following:
- you have a number of "Type*" nodes on your canvas, inheriting from a
common supertype "Type"
- you have another element with a reference of type "Type"
- you want the property sheet to display a list of all available
instances of Type (including instance of subclasses)

What is currently displayed when you expand the combo box for that
property? Is Type really a supertype of the four Type*?

Regards,
Tobias


Akansha schrieb:
> Hi,
> Consider the following situation:
>
> Service
> |---type:Type
>
> and Type can be any of four TypeA, TypeB, TypeC or TypeD EClasses. How
> to do that in ECore file. Any pointers.
>
> Thanks,
> Akansha
>
Re: how to show List in a property view [message #229137 is a reply to message #229114] Thu, 07 May 2009 10:46 Go to previous messageGo to next message
Akansha is currently offline AkanshaFriend
Messages: 14
Registered: July 2009
Junior Member
Actually structure of my ecore file was different but i modified it
according to what you mentioned and its showing up in list now. But one
more problem is there, apart from EClasses i have EEnum (containing EENum
Literals) also which i want to show in that list. So what i did is created
an EClass and added one EAttribute in it with its Etype referring to EENum
and set its super type as TYPE. But the property list is not showing the
EEnum literals. Where i am wrong ?
Re: how to show List in a property view [message #229145 is a reply to message #229137] Thu, 07 May 2009 11:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

Hello Akansha,

again I am not sure whether I understood you correctly. What you want is
that for that attribute Operation.type both all instances of Type
(including TypeA etc.) are displayed, /and/ the literals of that
enumeration, right?

What exactly do you want to achieve? Shall the enums be predefined
values for types (like primitive types in Java as opposed to Java
classes)? I don't think this is possible this way. Maybe you could
create a number of Type instances on diagram creation, representing the
values of the enumeration using a fifth Type type which has no graphical
representation in the diagram.

Regards,
Tobias


Akansha schrieb:
> Actually structure of my ecore file was different but i modified it
> according to what you mentioned and its showing up in list now. But one
> more problem is there, apart from EClasses i have EEnum (containing
> EENum Literals) also which i want to show in that list. So what i did is
> created an EClass and added one EAttribute in it with its Etype
> referring to EENum and set its super type as TYPE. But the property list
> is not showing the EEnum literals. Where i am wrong ?
>
Re: how to show List in a property view [message #229153 is a reply to message #229145] Thu, 07 May 2009 11:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

Another Idea: In your .edit plugin, you can change the method
addTypePropertyDescriptor of class OperationItemProvider and overwrite
the method getComboBoxObjects of the created ItemPropertyDescriptor. I
am not sure how exactly to do this, but this way you could add all the
Type elements to the list, as well as a number of fixed types --
however, this way the attribute Operation.type would have to be of type
String or Object...

Hope this helps,
Tobias


Tobias schrieb:
> Hello Akansha,
>
> again I am not sure whether I understood you correctly. What you want is
> that for that attribute Operation.type both all instances of Type
> (including TypeA etc.) are displayed, /and/ the literals of that
> enumeration, right?
>
> What exactly do you want to achieve? Shall the enums be predefined
> values for types (like primitive types in Java as opposed to Java
> classes)? I don't think this is possible this way. Maybe you could
> create a number of Type instances on diagram creation, representing the
> values of the enumeration using a fifth Type type which has no graphical
> representation in the diagram.
>
> Regards,
> Tobias
>
>
> Akansha schrieb:
>> Actually structure of my ecore file was different but i modified it
>> according to what you mentioned and its showing up in list now. But
>> one more problem is there, apart from EClasses i have EEnum
>> (containing EENum Literals) also which i want to show in that list. So
>> what i did is created an EClass and added one EAttribute in it with
>> its Etype referring to EENum and set its super type as TYPE. But the
>> property list is not showing the EEnum literals. Where i am wrong ?
>>
Re: how to show List in a property view [message #229161 is a reply to message #229145] Thu, 07 May 2009 11:49 Go to previous messageGo to next message
Akansha is currently offline AkanshaFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,
You understood me correctly. What I want is that for attribute
Operation.type both all instances of Type (including TypeA etc.) are
displayed and the predefined literals of that enumeration. For better
understanding you can consider that java primitive types constitute Enum
literals and Java classes are other Types (TypeA, TypeB,etc). So what i
want is the display of Java classes as well as primitive java types in the
list.
Re: how to show List in a property view [message #229184 is a reply to message #229161] Thu, 07 May 2009 13:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

I think you should have a look at how this was realized in the EMF ecore
editor, since there you have exactly the same functionality: A dropdown
list featuring a number of predefined classes (such as EObject, EEList,
EJavaObject, ...) and your own classes. I think, they are using Strings
as representation for these, and not references to the actual objects.
Maybe you can build upon this...

Tobias


Akansha schrieb:
> Hi,
> You understood me correctly. What I want is that for attribute
> Operation.type both all instances of Type (including TypeA etc.) are
> displayed and the predefined literals of that enumeration. For better
> understanding you can consider that java primitive types constitute Enum
> literals and Java classes are other Types (TypeA, TypeB,etc). So what i
> want is the display of Java classes as well as primitive java types in
> the list.
Re: how to show List in a property view [message #229270 is a reply to message #229184] Fri, 08 May 2009 05:47 Go to previous messageGo to next message
Akansha is currently offline AkanshaFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,

Is it possible to make editable dropdown i.e. if user does not want to
select from list he can write his own value in dropdown.

Thanks,
Akansha
Re: how to show List in a property view [message #229278 is a reply to message #229270] Fri, 08 May 2009 09:21 Go to previous message
Akansha is currently offline AkanshaFriend
Messages: 14
Registered: July 2009
Junior Member
Any body there to reply :(
Previous Topic:How to get the EditPart of a Node from its View object?
Next Topic:How to know if a diagram is validated OK
Goto Forum:
  


Current Time: Thu Nov 23 13:27:50 GMT 2017

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

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