Re: Simple Jface ListViewer [message #330994] |
Wed, 20 August 2008 17:10 |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Zardosht Hodaie wrote:
> Hi all,
> i'm not sure if this post belongs to this group. if not sorry.
> Here is my problem. I want to have a simple ListViewer to show some
> elements. The SWT List shows only Strings and does not contains the
> unerlying Objects. JFace ListViewer needs a model. I thought ok, i make
> a list of elements, and set it as the input to my Jface listViewer. And
> i thought every time a change the input list, the changes should also be
> reflected in viewer. But i don't know what kind of list should i use for
> this. And if i have to write a ContentProvider myself?
>
> thanks in advance for your help,
> Zardosht.
Note: copying this to the eclipse.platform newsgroup.
I think you can use an ArrayContentProvider to do what you want; it
should handle any array or Collection as input.
Hope this helps,
Eric
|
|
|
|
Re: Simple Jface ListViewer [message #330998 is a reply to message #330997] |
Wed, 20 August 2008 19:03 |
Eclipse User |
|
|
|
Originally posted by: zhodaie.gmail.com
Tom Schindl schrieb:
> The viewer won't update themselves when the underlying list changes
> (because Java-List don't inform about changes). To make this possible
>
> a) ArrayContentProvider:
> List l = ...
> viewer.setContentProvider(new ArrayContentProvider());
> viewer.setInput(l);
>
> ...
> l.add(new ...)
> viewer.refresh();
>
> b) Databinding with ObservableListContentProvider
>
> IObservableList l = ...
> viewer.setContentProvider(new ObservableListContentProvider());
> viewer.setInput(l);
>
> l.add(new ...);
>
> Tom
>
> Eric Rizzo schrieb:
>> Zardosht Hodaie wrote:
>>> Hi all,
>>> i'm not sure if this post belongs to this group. if not sorry.
>>> Here is my problem. I want to have a simple ListViewer to show some
>>> elements. The SWT List shows only Strings and does not contains the
>>> unerlying Objects. JFace ListViewer needs a model. I thought ok, i
>>> make a list of elements, and set it as the input to my Jface
>>> listViewer. And i thought every time a change the input list, the
>>> changes should also be reflected in viewer. But i don't know what
>>> kind of list should i use for this. And if i have to write a
>>> ContentProvider myself?
>>>
>>> thanks in advance for your help,
>>> Zardosht.
>>
>> Note: copying this to the eclipse.platform newsgroup.
>>
>> I think you can use an ArrayContentProvider to do what you want; it
>> should handle any array or Collection as input.
>>
>> Hope this helps,
>> Eric
>
>
Thank you for your help. I got it working. Thank you.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03777 seconds