Skip to main content



      Home
Home » Modeling » EMF » Doubt in getText() of ItemProviders
Doubt in getText() of ItemProviders [message #638379] Thu, 11 November 2010 01:00 Go to next message
Eclipse UserFriend
Hi,


This question is regarding the ItemProviders generated through EMF edit.How is the getText() method of an item provider is generated.How does EMF decide which attribute of the Model object to put in the getText() method.
For example In the given Library model for Library it is the name and for the book it is the title.
On what basis the attribute is selected ?

Best regards,
Vaibhav
Re: Doubt in getText() of ItemProviders [message #638394 is a reply to message #638379] Thu, 11 November 2010 02:46 Go to previous messageGo to next message
Eclipse UserFriend
On 11.11.10 07.00, vaibhav wrote:
>
> This question is regarding the ItemProviders generated through EMF
> edit.How is the getText() method of an item provider is generated.How
> does EMF decide which attribute of the Model object to put in the
> getText() method.
> For example In the given Library model for Library it is the name and
> for the book it is the title.
> On what basis the attribute is selected ?

I believe it just selects the first attribute, and I don't think there
is a way of making it select a different one. You have to change the
code (and remember to set @generated NOT).

Hallvard
Re: Doubt in getText() of ItemProviders [message #638459 is a reply to message #638394] Thu, 11 November 2010 06:35 Go to previous messageGo to next message
Eclipse UserFriend
If you modify the generated code, you could also reflectively look up the EStructuralFeatures and return a value dynamically. For example does the feature name contain "name" or "id" then return this.

Regards,
Nirmal
Re: Doubt in getText() of ItemProviders [message #638470 is a reply to message #638459] Thu, 11 November 2010 07:30 Go to previous messageGo to next message
Eclipse UserFriend
Guys,

It's determined by GenClass's Label Feature property, which defaults to
the first attribute or an attribute called "name" or "id" if it hasn't
been explicitly set in the properties view.


Nirmal Sasidharan wrote:
> If you modify the generated code, you could also reflectively look up
> the EStructuralFeatures and return a value dynamically. For example
> does the feature name contain "name" or "id" then return this.
>
> Regards,
> Nirmal
Re: Doubt in getText() of ItemProviders [message #638786 is a reply to message #638470] Fri, 12 November 2010 10:18 Go to previous message
Eclipse UserFriend
Thanks Edmerks Smile
This is exactly i wanted to know.

Best Regards,
Vaibhav
Previous Topic:XMI Serialization - Pure EObject instead of my Business Object
Next Topic:Doubt regarding root EClass of Ecore Model
Goto Forum:
  


Current Time: Sat Jul 05 10:30:21 EDT 2025

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

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

Back to the top