Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Setting selection in JFace ComboViewer
Setting selection in JFace ComboViewer [message #462552] Thu, 13 October 2005 14:40 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
James Leotta is currently offline James LeottaFriend
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 Go to previous message
Eclipse UserFriend
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
>>>
>>
Previous Topic:How do you listen to editor and view focus events?
Next Topic:OLE: how to set a (OLECHAR **ppchURLOut) parameter?
Goto Forum:
  


Current Time: Wed Sep 30 07:43:39 GMT 2020

Powered by FUDForum. Page generated in 0.02034 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top