[Databinding] Observer for multi-selection from a list [message #495593] |
Thu, 05 November 2009 08:01  |
Eclipse User |
|
|
|
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 12:26  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.04816 seconds