AdapterFactoryLabelProvider doesnt work in TableViewer [message #418591] |
Mon, 21 April 2008 12:25  |
Eclipse User |
|
|
|
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 #418760 is a reply to message #418625] |
Mon, 28 April 2008 17:12  |
Eclipse User |
|
|
|
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
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.08880 seconds