How to use WorkbenchLabelProvider with TableViewer [message #444717] |
Sat, 18 February 2006 22:15  |
Eclipse User |
|
|
|
Can anyone please post an example of how to use the IWorkbenchAdapter
(WorkbenchLabelProvider) with a TableViewer. I don't understand how to get
more than one label for the various columns, since the IWorkbenchAdapter has
only the getLabel() method.
TIA
|
|
|
|
|
|
|
Re: How to use WorkbenchLabelProvider with TableViewer [message #444730 is a reply to message #444725] |
Mon, 20 February 2006 03:32   |
Eclipse User |
|
|
|
Well I do it normally like that, but threre are several ways...
Ctrl-Shift T - open the TypeExplorer
Type in the WorkbenchLabelProvider and open the source for it...
Afterwards search for References Ctrl-Shift-G in workspace..
this will find as well sources in all your dependencies of your plugins.
Another way to do it is that you import all targetPlatform Plugins
into the workspace and search it there
Tom
Todd Hill schrieb:
> Tom - how exactly to I search through the eclipse source?
>
> "tom knube" <spam@knube.org> wrote in message
> news:dtar6f$m9h$1@utils.eclipse.org...
>> Todd Hill wrote:
>>> OK, thanks Tom.
>>> But have you ever tried using the WorkbenchLabelProvider with tables? It
>>> works with TreeViewers, but I was trying to make it work for a
>>> TableViewer.
>>>
>>> I tried to take the Hyberbole example from Chapter 5 of the book "Eclipse
>>> Rich Client Platform" by McAffer and Lemieux, which uses the IAdapter
>>> framework for a TreeViewer and apply it to TableViewer, but I--again--I
>>> don't see how it can handle multiple columns.
>>>
>>> The book made such a case for the decoupling route and implied that it
>>> could be done with any model and a Viewer. . . but maybe not(?)
>>>
>>>
>>>
>>> "tom knube" <spam@knube.org> wrote in message
>>> news:dtaa2a$u3k$1@utils.eclipse.org...
>>>> Todd Hill schrieb:
>>>>> Can anyone please post an example of how to use the IWorkbenchAdapter
>>>>> (WorkbenchLabelProvider) with a TableViewer. I don't understand how to
>>>>> get more than one label for the various columns, since the
>>>>> IWorkbenchAdapter has only the getLabel() method.
>>>>>
>>>>> TIA
>>>> Use ITableLabelProvider for the TableViewer
>>>>
>>>> it has the method
>>>>
>>>> public String getColumnText(Object obj, int index) {
>>>>
>>>> where you have the table column as index and now you can
>>>> return for each column your label string...
>>>>
>>>>
>>>> you will find some examples here
>>>> http://www.java2s.com/ExampleCode/SWT-JFace-Eclipse/Demonstr atesTableViewers.htm
>>>
>> Well, I see the advantage for using the WorkbenchLabelProvider but never
>> tried it to be honest.. Take a look in the Eclipse sources, could be
>> you'll find a hint there. I've seen that they use the
>> WorkbenchLabelProvider as it is with a CheckboxTableViewer :
>>
>> viewer.setLabelProvider(WorkbenchLabelProvider
>> .getDecoratingWorkbenchLabelProvider());
>>
>>
>> I didn't tracked it down further..
>>
>> cheers
>> Tom
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 1.06158 seconds