Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Databinding] Observer for multi-selection from a list
[Databinding] Observer for multi-selection from a list [message #495593] Thu, 05 November 2009 13:01 Go to next message
Ralf Heydenreich is currently offline Ralf Heydenreich
Messages: 116
Registered: July 2009
Senior Member
Hi all,
I'm looking for an example which shows me the implementation of an
Observer for multiple selection of a List. Typically, the examples are
observing only the selectedIndex, like this:

List list = listViewer2.getList();
IObservableList source = (IObservableList) listViewer2.getInput();
IObservableValue listIndexValue =
SWTObservables.observeSingleSelectionIndex(list);
IObservableValue listValue = new ListObservableValue(listIndexValue,
source);

In my model now there I receive the single selected index.

What I want is, if I select multiple values from the list, I want to get
notified about these values (or their indexes) in my model (i.e. a kind
of an ArrayList or so). With observeSingleSelectionIndex I can't get
this (as the name implies).

Any hints are welcome.

Regards,
Ralf.
Re: [Databinding] Observer for multi-selection from a list [message #495933 is a reply to message #495593] Fri, 06 November 2009 17:26 Go to previous message
Ovidio Mallo is currently offline Ovidio Mallo
Messages: 35
Registered: July 2009
Member
Hi Ralf,

the API for observing a multi selection (the actual models, not the
indexes) is one of the following (depending on whether you want to
use the new properties API or not):
ViewersObservables#observeMultiSelection(Viewer)
ViewerProperties#multipleSelection()

You might also want to have a look at the following bug report which
includes a snippet which illustrates the observing of a multi selection:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=215782

Regards,
Ovidio


R. Heydenreich wrote:
> Hi all,
> I'm looking for an example which shows me the implementation of an
> Observer for multiple selection of a List. Typically, the examples are
> observing only the selectedIndex, like this:
>
> List list = listViewer2.getList();
> IObservableList source = (IObservableList) listViewer2.getInput();
> IObservableValue listIndexValue =
> SWTObservables.observeSingleSelectionIndex(list);
> IObservableValue listValue = new ListObservableValue(listIndexValue,
> source);
>
> In my model now there I receive the single selected index.
>
> What I want is, if I select multiple values from the list, I want to get
> notified about these values (or their indexes) in my model (i.e. a kind
> of an ArrayList or so). With observeSingleSelectionIndex I can't get
> this (as the name implies).
>
> Any hints are welcome.
>
> Regards,
> Ralf.
Previous Topic:Password save problem with CVS
Next Topic:Version compatibility of plugin
Goto Forum:
  


Current Time: Wed Sep 17 21:52:47 GMT 2014

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

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