Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » AdapterFactoryLabelProvider doesnt work in TableViewer
AdapterFactoryLabelProvider doesnt work in TableViewer [message #418591] Mon, 21 April 2008 16:25 Go to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,
i am trying to set up a table containing EObject instances:

TableViewer viewer = new TableViewer(myTable);
//viewer.setLabelProvider(new AdapterFactoryLabelProvider(new
MyModelItemProviderAdapterFactory()));
viewer.add(myEObjectList.toArray());

If I use this without a LableProvider the rows are created i can see the
standard toString representations of the EObjects. But if i use the
Labelprovider Second line in the snippet), the rows remain white. I use
the same LabelProvider for a treeview, where it works fine:

public class LabelProvider extends AdapterFactoryLabelProvider implements
ILabelProvider {

public LabelProvider() {
super(new ModelItemProviderAdapterFactory());
}
}

Thanks for any help.
Re: AdapterFactoryLabelProvider doesnt work in TableViewer [message #418599 is a reply to message #418591] Mon, 21 April 2008 20:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Jonas,

Comments below.

Jonas wrote:
> Hi,
> i am trying to set up a table containing EObject instances:
>
> TableViewer viewer = new TableViewer(myTable);
> //viewer.setLabelProvider(new AdapterFactoryLabelProvider(new
> MyModelItemProviderAdapterFactory()));
> viewer.add(myEObjectList.toArray());
Did you set the content provider? I guess not, but that's kind of expected.
>
> If I use this without a LableProvider the rows are created i can see
> the standard toString representations of the EObjects. But if i use
> the Labelprovider Second line in the snippet), the rows remain white.
> I use the same LabelProvider for a treeview, where it works fine:
It works in the standard generated editor as well, right?
>
> public class LabelProvider extends AdapterFactoryLabelProvider implements
> ILabelProvider {
>
> public LabelProvider() {
> super(new ModelItemProviderAdapterFactory());
> }
> }
Does your model support column label providers? In Eclipse 2.4 there's
new support for populating a column viewer based on some property of the
object. Which version are you using?
>
> Thanks for any help.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: AdapterFactoryLabelProvider doesnt work in TableViewer [message #418624 is a reply to message #418599] Tue, 22 April 2008 13:55 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
>> Hi,
>> i am trying to set up a table containing EObject instances:
>>
>> TableViewer viewer = new TableViewer(myTable);
>> //viewer.setLabelProvider(new AdapterFactoryLabelProvider(new
>> MyModelItemProviderAdapterFactory()));
>> viewer.add(myEObjectList.toArray());
> Did you set the content provider? I guess not, but that's kind of expected.

No the list that i am providing is a list of referenced EObjects. So the
standard Content Provider should not work.

>> If I use this without a LableProvider the rows are created i can see
>> the standard toString representations of the EObjects. But if i use
>> the Labelprovider Second line in the snippet), the rows remain white.
>> I use the same LabelProvider for a treeview, where it works fine:
It works in the standard generated editor as well, right?

Yes it does...

>> public class LabelProvider extends AdapterFactoryLabelProvider implements
>> ILabelProvider {
>>
>> public LabelProvider() {
>> super(new ModelItemProviderAdapterFactory());
>> }
>> }
> Does your model support column label providers? In Eclipse 2.4 there's
> new support for populating a column viewer based on some property of the
> object. Which version are you using?

I am using Ganymede M 5 and EMF 2.4
Re: AdapterFactoryLabelProvider doesnt work in TableViewer [message #418625 is a reply to message #418624] Tue, 22 April 2008 14:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Jonas,

I'm not sure what to suggest. Setting a breakpoints in the label
providers getColumText method will maybe help track down where things
are going astray...


Jonas wrote:
>
>>> Hi,
>>> i am trying to set up a table containing EObject instances:
>>>
>>> TableViewer viewer = new TableViewer(myTable);
>>> //viewer.setLabelProvider(new AdapterFactoryLabelProvider(new
>>> MyModelItemProviderAdapterFactory()));
>>> viewer.add(myEObjectList.toArray());
>> Did you set the content provider? I guess not, but that's kind of
>> expected.
>
> No the list that i am providing is a list of referenced EObjects. So
> the standard Content Provider should not work.
>
>>> If I use this without a LableProvider the rows are created i can see
>>> the standard toString representations of the EObjects. But if i use
>>> the Labelprovider Second line in the snippet), the rows remain
>>> white. I use the same LabelProvider for a treeview, where it works
>>> fine:
> It works in the standard generated editor as well, right?
>
> Yes it does...
>
>>> public class LabelProvider extends AdapterFactoryLabelProvider
>>> implements
>>> ILabelProvider {
>>>
>>> public LabelProvider() {
>>> super(new ModelItemProviderAdapterFactory());
>>> }
>>> }
>> Does your model support column label providers? In Eclipse 2.4
>> there's new support for populating a column viewer based on some
>> property of the object. Which version are you using?
>
> I am using Ganymede M 5 and EMF 2.4
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: AdapterFactoryLabelProvider doesnt work in TableViewer [message #418760 is a reply to message #418625] Mon, 28 April 2008 21:12 Go to previous message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi
I finally found the problem:
1. I had to turn on "Create column provider" in genModel
2. Set the lableprovider before populating the table!

Anyway, thanks Ed!
Jonas


Ed Merks schrieb:
> Jonas,
>
> I'm not sure what to suggest. Setting a breakpoints in the label
> providers getColumText method will maybe help track down where things
> are going astray...
>
>
> Jonas wrote:
>>
>>>> Hi,
>>>> i am trying to set up a table containing EObject instances:
>>>>
>>>> TableViewer viewer = new TableViewer(myTable);
>>>> //viewer.setLabelProvider(new AdapterFactoryLabelProvider(new
>>>> MyModelItemProviderAdapterFactory()));
>>>> viewer.add(myEObjectList.toArray());
>>> Did you set the content provider? I guess not, but that's kind of
>>> expected.
>>
>> No the list that i am providing is a list of referenced EObjects. So
>> the standard Content Provider should not work.
>>
>>>> If I use this without a LableProvider the rows are created i can see
>>>> the standard toString representations of the EObjects. But if i use
>>>> the Labelprovider Second line in the snippet), the rows remain
>>>> white. I use the same LabelProvider for a treeview, where it works
>>>> fine:
>> It works in the standard generated editor as well, right?
>>
>> Yes it does...
>>
>>>> public class LabelProvider extends AdapterFactoryLabelProvider
>>>> implements
>>>> ILabelProvider {
>>>>
>>>> public LabelProvider() {
>>>> super(new ModelItemProviderAdapterFactory());
>>>> }
>>>> }
>>> Does your model support column label providers? In Eclipse 2.4
>>> there's new support for populating a column viewer based on some
>>> property of the object. Which version are you using?
>>
>> I am using Ganymede M 5 and EMF 2.4
>>
>>
Previous Topic:AdapterFactories
Next Topic:warning dialog when editing property in properties sheet
Goto Forum:
  


Current Time: Fri Apr 19 06:45:59 GMT 2024

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

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

Back to the top