Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Doubt in getText() of ItemProviders
Doubt in getText() of ItemProviders [message #638379] Thu, 11 November 2010 06:00 Go to next message
vaibhav  is currently offline vaibhav Friend
Messages: 22
Registered: September 2010
Junior Member
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 07:46 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 671
Registered: July 2009
Location: Trondheim, Norway
Senior Member
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 11:35 Go to previous messageGo to next message
Nirmal SasidharanFriend
Messages: 120
Registered: July 2009
Location: Germany
Senior Member
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 12:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30540
Registered: July 2009
Senior Member
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 15:18 Go to previous message
vaibhav  is currently offline vaibhav Friend
Messages: 22
Registered: September 2010
Junior Member
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: Mon Oct 14 10:47:11 GMT 2019

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

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

Back to the top