Problem with selection of widget in tableviewer [message #328466] |
Mon, 26 May 2008 08:21 |
Eclipse User |
|
|
|
Originally posted by: MeLene3.gmail.com
Hi,
I've added a Link-widget to a table (tableViewer). When I press the link I
need too no which row (FULL_SELECTION on table) was pressed in the table.
The tableViewer.getSelection() is not updated when I press the link. How
can I find which row the link is related to?
I can switch to another widget in the table if someone has a better
suggestion.But I do want to add the widget to each row in the table.
Thanks
-Lene
|
|
|
|
Re: Problem with selection of widget in tableviewer [message #328685 is a reply to message #328473] |
Mon, 02 June 2008 08:38 |
Eclipse User |
|
|
|
Originally posted by: MeLene3.gmail.com
Hi
I've upgraded for eclipse 3.4.
The problem is that I'm already using the ObservableMapLabelProvider
because of the data binding. Of these reason I can't see how I can use
this StyledCellLabelProvider. Do you have another suggestion?
-Lene
|
|
|
|
Re: Problem with selection of widget in tableviewer [message #328691 is a reply to message #328688] |
Mon, 02 June 2008 10:21 |
Eclipse User |
|
|
|
Originally posted by: MeLene3.gmail.com
Thanks for the tip.
I've now copied the logic from the ObservableMapLabelProvider:
private static class LinkLabelProvider extends StyledCellLabelProvider
implements ILabelProvider, ITableLabelProvider {...}
But the problem is that I never reach my update()-method. The reason is
the CellLabelProvider.createViewerLabelProvider().
static CellLabelProvider createViewerLabelProvider(ColumnViewer viewer,
IBaseLabelProvider labelProvider) {
boolean noColumnTreeViewer = viewer instanceof AbstractTreeViewer &&
viewer.doGetColumnCount() == 0;
if (!noColumnTreeViewer
&& (labelProvider instanceof ITableLabelProvider
|| labelProvider instanceof ITableColorProvider
|| labelProvider instanceof ITableFontProvider))
return new TableColumnViewerLabelProvider(labelProvider);
if (labelProvider instanceof CellLabelProvider)
return (CellLabelProvider) labelProvider;
return new WrappedViewerLabelProvider(labelProvider);
}
This method checks if the labelProvider is instance of the
ITableLabelProvider and if so returns a TableColumnViewerLabelProvider.
Will it not be a problem that I want to run the update() for both the
ObservableMap and for the StyledCell? The Observable map will map the
first 4 columns and the 5 and last column will have a link spesfic for
this column.
-Lene
Tom Schindl wrote:
> It's quite easy to copy the logic from the ObservableMapLabelProvider
> into a CellLabelProvider (StyledCellLabelProvider is a subclass from it).
> You can take a look how I did this with ColumnLabelProvider by looking
> at
>
http://publicsvn.bestsolution.at/repos/java/at.bestsolution. dataforms/trunk/src/at/bestsolution/dataforms/util/viewers/
> Tom
> Lene schrieb:
>> Hi
>>
>> I've upgraded for eclipse 3.4.
>> The problem is that I'm already using the ObservableMapLabelProvider
>> because of the data binding. Of these reason I can't see how I can use
>> this StyledCellLabelProvider. Do you have another suggestion?
>> -Lene
>>
|
|
|
|
Powered by
FUDForum. Page generated in 0.06561 seconds