Setting selection in JFace ComboViewer [message #462552] |
Thu, 13 October 2005 14:40 |
Eclipse User |
|
|
|
Originally posted by: webapp.gmx.de
Hi,
how can I set the selection in a combobox using the JFace ComboViewer?
There's a method setSelection, but I don't know how to handle it.
Sorry, if this was asked before, but there's no search function available.
Thanks, Rudolf
|
|
|
Re: Setting selection in JFace ComboViewer [message #462602 is a reply to message #462552] |
Fri, 14 October 2005 15:24 |
Eclipse User |
|
|
|
Originally posted by: micasim.gmx.de
Hi Rudolf,
I assume you set a ComboViewer on a SWT Combo and supported it with a
ContentProvider and a LabelProvider.
Then the object(s) in the selection are to be same that would be returned
by the ContentProvider.
The simple way I normally do it:
StructuredSelection selection = new StructuredSelection (list); // where
"list" is a java.util.List or an array of objects. If you just want to
select one object you create the StructuredSelection with just that one
comboViewer.setSelection (selection);
hope this helps,
Michael
On Thu, 13 Oct 2005 16:40:21 +0200, Rudolf Schmidt <webapp@gmx.de> wrote:
> Hi,
>
> how can I set the selection in a combobox using the JFace ComboViewer?
> There's a method setSelection, but I don't know how to handle it.
>
> Sorry, if this was asked before, but there's no search function
> available.
>
> Thanks, Rudolf
>
|
|
|
Re: Setting selection in JFace ComboViewer [message #462605 is a reply to message #462602] |
Fri, 14 October 2005 19:47 |
James Leotta Messages: 202 Registered: July 2009 |
Senior Member |
|
|
Does the StructuredSelection object need to implement the
public boolean equals(Object obj)
method?
Michael Simons wrote:
> Hi Rudolf,
>
> I assume you set a ComboViewer on a SWT Combo and supported it with a
> ContentProvider and a LabelProvider.
> Then the object(s) in the selection are to be same that would be
> returned by the ContentProvider.
> The simple way I normally do it:
> StructuredSelection selection = new StructuredSelection (list); //
> where "list" is a java.util.List or an array of objects. If you just
> want to select one object you create the StructuredSelection with just
> that one
>
> comboViewer.setSelection (selection);
>
> hope this helps,
> Michael
>
> On Thu, 13 Oct 2005 16:40:21 +0200, Rudolf Schmidt <webapp@gmx.de> wrote:
>
>> Hi,
>>
>> how can I set the selection in a combobox using the JFace
>> ComboViewer? There's a method setSelection, but I don't know how to
>> handle it.
>>
>> Sorry, if this was asked before, but there's no search function
>> available.
>>
>> Thanks, Rudolf
>>
>
|
|
|
Re: Setting selection in JFace ComboViewer [message #462608 is a reply to message #462605] |
Fri, 14 October 2005 22:58 |
Eclipse User |
|
|
|
Originally posted by: micasim.gmx.de
Hi Rudolf,
No, not AFAIK and the objects we use don't at least not all do.
Regards, Michael
On Fri, 14 Oct 2005 21:47:00 +0200, James Leotta <jleotta@bascom.com>
wrote:
> Does the StructuredSelection object need to implement the
> public boolean equals(Object obj)
> method?
>
> Michael Simons wrote:
>> Hi Rudolf,
>> I assume you set a ComboViewer on a SWT Combo and supported it with a
>> ContentProvider and a LabelProvider.
>> Then the object(s) in the selection are to be same that would be
>> returned by the ContentProvider.
>> The simple way I normally do it:
>> StructuredSelection selection = new StructuredSelection (list); //
>> where "list" is a java.util.List or an array of objects. If you just
>> want to select one object you create the StructuredSelection with just
>> that one
>> comboViewer.setSelection (selection);
>> hope this helps,
>> Michael
>> On Thu, 13 Oct 2005 16:40:21 +0200, Rudolf Schmidt <webapp@gmx.de>
>> wrote:
>>
>>> Hi,
>>>
>>> how can I set the selection in a combobox using the JFace
>>> ComboViewer? There's a method setSelection, but I don't know how to
>>> handle it.
>>>
>>> Sorry, if this was asked before, but there's no search function
>>> available.
>>>
>>> Thanks, Rudolf
>>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04233 seconds