Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » how to get IItemLabelProvider of an object without knowing its adpater factory in advance
how to get IItemLabelProvider of an object without knowing its adpater factory in advance [message #425413] Tue, 25 November 2008 16:27 Go to next message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Hi,

I have an emf object and I want to get it's relevant item provider to
get text/label and image.
There are number of emf models in the system and they are not known in
advance.

I was thinking that may be if I can use that object to get its adapter
which then I can cast to IItemLabelProvider and then call getText() &
getImage() method on that.

Is there someway to do that? I was looking in
ComposedAdapterFactory.Descriptor.Registry.INSTANCE

Thanks for your help.


- Parvez
Re: how to get IItemLabelProvider of an object without knowing its adpater factory in advance [message #425421 is a reply to message #425413] Tue, 25 November 2008 21:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31007
Registered: July 2009
Senior Member
Parvez,

Comments below.

PC wrote:
> Hi,
>
> I have an emf object and I want to get it's relevant item provider to
> get text/label and image.
> There are number of emf models in the system and they are not known in
> advance.
>
> I was thinking that may be if I can use that object to get its adapter
> which then I can cast to IItemLabelProvider and then call getText() &
> getImage() method on that.
>
> Is there someway to do that? I was looking in
> ComposedAdapterFactory.Descriptor.Registry.INSTANCE
Yes, use that as an argument to creating a new ComposedAdapterFactory,
wrap it in a AdapterFactoryLabelProvider, and you should be all set.
>
> Thanks for your help.
>
>
> - Parvez
Re: how to get IItemLabelProvider of an object without knowing its adpater factory in advance [message #425442 is a reply to message #425421] Wed, 26 November 2008 11:53 Go to previous message
Parvez is currently offline ParvezFriend
Messages: 181
Registered: July 2009
Senior Member
Thanks Ed. It worked:

AdapterFactoryLabelProvider labelFactory = new
AdapterFactoryLabelProvider(new
ComposedAdapterFactory(EMFEditPlugin.getComposedAdapterFacto ryDescriptorRegistry()));


labelFactory.getText(myObj);

- Parvez

Ed Merks wrote:
> Parvez,
>
> Comments below.
>
> PC wrote:
>> Hi,
>>
>> I have an emf object and I want to get it's relevant item provider to
>> get text/label and image.
>> There are number of emf models in the system and they are not known in
>> advance.
>>
>> I was thinking that may be if I can use that object to get its adapter
>> which then I can cast to IItemLabelProvider and then call getText() &
>> getImage() method on that.
>>
>> Is there someway to do that? I was looking in
>> ComposedAdapterFactory.Descriptor.Registry.INSTANCE
> Yes, use that as an argument to creating a new ComposedAdapterFactory,
> wrap it in a AdapterFactoryLabelProvider, and you should be all set.
>>
>> Thanks for your help.
>>
>>
>> - Parvez
Previous Topic:[New Article] How Scalable are my Models?
Next Topic:[CDO] Second CDOResource with name=null
Goto Forum:
  


Current Time: Wed Apr 01 05:53:47 GMT 2020

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

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

Back to the top