Eclipse Platform
Release 3.6

org.eclipse.jface.databinding.viewers
Class ViewersObservables

java.lang.Object
  extended by org.eclipse.jface.databinding.viewers.ViewersObservables

public class ViewersObservables
extends Object

Factory methods for creating observables for JFace viewers

Since:
1.1

Constructor Summary
ViewersObservables()
           
 
Method Summary
static IViewerObservableSet observeCheckedElements(CheckboxTableViewer viewer, Object elementType)
          Returns an observable set that tracks the checked elements of the given viewer.
static IViewerObservableSet observeCheckedElements(CheckboxTreeViewer viewer, Object elementType)
          Returns an observable set that tracks the checked elements of the given viewer.
static IObservableSet observeCheckedElements(ICheckable checkable, Object elementType)
          Returns an observable set that tracks the checked elements of the given ICheckable.
static IViewerObservableValue observeDelayedValue(int delay, IViewerObservableValue observable)
          Returns an observable which delays notification of value change events from observable until delay milliseconds have passed since the last change event, or until a FocusOut event is received from the underlying viewer control (whichever happens earlier).
static IViewerObservableSet observeFilters(StructuredViewer viewer)
          Returns an observable set that tracks the filters of the given viewer.
static IObservableValue observeInput(Viewer viewer)
          Returns an observable value that tracks the input of the given viewer.
static IObservableList observeMultiPostSelection(IPostSelectionProvider selectionProvider)
          Returns an observable list that tracks the current post selection of the given post selection provider.
static IViewerObservableList observeMultiPostSelection(StructuredViewer viewer)
          Returns an observable list that tracks the current post selection of the given structured viewer.
static IObservableList observeMultiSelection(ISelectionProvider selectionProvider)
          Returns an observable list that tracks the current selection of the given selection provider.
static IViewerObservableList observeMultiSelection(Viewer viewer)
          Returns an observable list that tracks the current selection of the given viewer.
static IObservableValue observeSinglePostSelection(IPostSelectionProvider selectionProvider)
          Returns an observable value that tracks the current post selection of the given post selection provider.
static IViewerObservableValue observeSinglePostSelection(StructuredViewer viewer)
          Returns an observable value that tracks the current post selection of the given structured viewer.
static IObservableValue observeSingleSelection(ISelectionProvider selectionProvider)
          Returns an observable value that tracks the current selection of the given selection provider.
static IViewerObservableValue observeSingleSelection(Viewer viewer)
          Returns an observable value that tracks the current selection of the given viewer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewersObservables

public ViewersObservables()
Method Detail

observeDelayedValue

public static IViewerObservableValue observeDelayedValue(int delay,
                                                         IViewerObservableValue observable)
Returns an observable which delays notification of value change events from observable until delay milliseconds have passed since the last change event, or until a FocusOut event is received from the underlying viewer control (whichever happens earlier). This class helps to delay validation until the user stops changing the value (e.g. until a user stops changing a viewer selection). To notify about pending changes, the returned observable value will fire a stale event when the wrapped observable value fires a change event, but this change is being delayed.

Parameters:
delay - the delay in milliseconds
observable - the observable being delayed
Returns:
an observable which delays notification of value change events from observable until delay milliseconds have passed since the last change event.
Since:
1.3

observeSingleSelection

public static IObservableValue observeSingleSelection(ISelectionProvider selectionProvider)
Returns an observable value that tracks the current selection of the given selection provider. If the selection provider provides selections of type IStructuredSelection, the observable value will be the first element of the structured selection as returned by IStructuredSelection.getFirstElement().

Parameters:
selectionProvider -
Returns:
the observable value tracking the (single) selection of the given selection provider

observeSinglePostSelection

public static IObservableValue observeSinglePostSelection(IPostSelectionProvider selectionProvider)
Returns an observable value that tracks the current post selection of the given post selection provider. If the selection provider provides selections of type IStructuredSelection, the observable value will be the first element of the structured selection as returned by IStructuredSelection.getFirstElement().

Parameters:
selectionProvider - The selection provider on which to track the post selection.
Returns:
the observable value tracking the (single) post selection of the given post selection provider
Since:
1.4

observeMultiSelection

public static IObservableList observeMultiSelection(ISelectionProvider selectionProvider)
Returns an observable list that tracks the current selection of the given selection provider. Assumes that the selection provider provides selections of type IStructuredSelection. Note that the observable list will not honor the full contract of java.util.List in that it may delete or reorder elements based on what the selection provider returns from ISelectionProvider.getSelection() after having called ISelectionProvider.setSelection(org.eclipse.jface.viewers.ISelection) based on the requested change to the observable list. The affected methods are add, addAll, and set.

Parameters:
selectionProvider -
Returns:
the observable value tracking the (multi) selection of the given selection provider
Since:
1.2

observeMultiPostSelection

public static IObservableList observeMultiPostSelection(IPostSelectionProvider selectionProvider)
Returns an observable list that tracks the current post selection of the given post selection provider. Assumes that the selection provider provides selections of type IStructuredSelection. Note that the observable list will not honor the full contract of java.util.List in that it may delete or reorder elements based on what the selection provider returns from ISelectionProvider.getSelection() after having called ISelectionProvider.setSelection(org.eclipse.jface.viewers.ISelection) based on the requested change to the observable list. The affected methods are add, addAll, and set.

Parameters:
selectionProvider - The selection provider on which to track the post selection.
Returns:
the observable value tracking the (multi) post selection of the given post selection provider
Since:
1.4

observeSingleSelection

public static IViewerObservableValue observeSingleSelection(Viewer viewer)
Returns an observable value that tracks the current selection of the given viewer. If the viewer provides selections of type IStructuredSelection, the observable value will be the first element of the structured selection as returned by IStructuredSelection.getFirstElement().

Parameters:
viewer - the viewer
Returns:
the observable value tracking the (single) selection of the given viewer
Since:
1.2

observeSinglePostSelection

public static IViewerObservableValue observeSinglePostSelection(StructuredViewer viewer)
Returns an observable value that tracks the current post selection of the given structured viewer. If the viewer provides selections of type IStructuredSelection, the observable value will be the first element of the structured selection as returned by IStructuredSelection.getFirstElement().

Parameters:
viewer - The viewer on which to track the post selection.
Returns:
the observable value tracking the (single) post selection of the given structured viewer
Since:
1.4

observeMultiSelection

public static IViewerObservableList observeMultiSelection(Viewer viewer)
Returns an observable list that tracks the current selection of the given viewer. Assumes that the viewer provides selections of type IStructuredSelection. Note that the observable list will not honor the full contract of java.util.List in that it may delete or reorder elements based on what the viewer returns from ISelectionProvider.getSelection() after having called ISelectionProvider.setSelection(org.eclipse.jface.viewers.ISelection) based on the requested change to the observable list. The affected methods are add, addAll, and set.

Parameters:
viewer -
Returns:
the observable value tracking the (multi) selection of the given selection provider
Since:
1.2

observeMultiPostSelection

public static IViewerObservableList observeMultiPostSelection(StructuredViewer viewer)
Returns an observable list that tracks the current post selection of the given structured viewer. Assumes that the viewer provides selections of type IStructuredSelection. Note that the observable list will not honor the full contract of java.util.List in that it may delete or reorder elements based on what the viewer returns from ISelectionProvider.getSelection() after having called ISelectionProvider.setSelection(org.eclipse.jface.viewers.ISelection) based on the requested change to the observable list. The affected methods are add, addAll, and set.

Parameters:
viewer - The viewer on which to track the post selection.
Returns:
the observable value tracking the (multi) post selection of the given structured viewer
Since:
1.4

observeInput

public static IObservableValue observeInput(Viewer viewer)
Returns an observable value that tracks the input of the given viewer.

The returned observer is blind to changes in the viewer's input unless its IObservableValue.setValue(Object) method is called directly.

Parameters:
viewer - the viewer to observe
Returns:
an observable value tracking the input of the given viewer
Since:
1.2

observeCheckedElements

public static IObservableSet observeCheckedElements(ICheckable checkable,
                                                    Object elementType)
Returns an observable set that tracks the checked elements of the given ICheckable.

Parameters:
checkable - ICheckable containing the checked elements to track
elementType - element type of the returned set
Returns:
an observable set tracking the checked elements of the given checkable.
Since:
1.2

observeCheckedElements

public static IViewerObservableSet observeCheckedElements(CheckboxTableViewer viewer,
                                                          Object elementType)
Returns an observable set that tracks the checked elements of the given viewer. Assumes that the viewer implements ICheckable.

Parameters:
viewer - CheckboxTableViewer containing the checked elements to track.
elementType - element type of the returned set
Returns:
an observable set that tracks the checked elements of the given viewer.
Since:
1.2

observeCheckedElements

public static IViewerObservableSet observeCheckedElements(CheckboxTreeViewer viewer,
                                                          Object elementType)
Returns an observable set that tracks the checked elements of the given viewer. Assumes that the viewer implements ICheckable.

Parameters:
viewer - CheckboxTreeViewer containing the checked elements to track.
elementType - element type of the returned set
Returns:
an observable set that tracks the checked elements of the given viewer.
Since:
1.2

observeFilters

public static IViewerObservableSet observeFilters(StructuredViewer viewer)
Returns an observable set that tracks the filters of the given viewer. Note that the returned set will not track changes that are made using direct API on StructuredViewer (by calling addFilter(), removeFilter(), or setFilters()) -- it is assumed that filters are only changed through the returned set.

Parameters:
viewer - viewer containing the filters to be tracked
Returns:
an observable set that tracks the filters of the given viewer.
Since:
1.3

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.