Package org.eclipse.jface.viewers

## Interface ISelectionProvider

All Known Subinterfaces:
  `IContentOutlinePage`, `IInputSelectionProvider`, `IPostSelectionProvider`

All Known Implementing Classes:
  `AbstractListViewer`, `AbstractTableViewer`, `AbstractTextEditor.SelectionProvider`, `AbstractTreeViewer`, `CheckboxTableViewer`, `CheckboxTreeViewer`, `ColumnViewer`, `ComboViewer`, `CommonViewer`, `CompareViewerPane`, `CompareViewerSwitchingPane`, `ContainerCheckedTreeViewer`, `ContentMergeViewer`, `ContentOutline`, `ContentOutlinePage`, `ContentViewer`, `DiffTreeViewer`, `ListViewer`, `MultiPageSelectionProvider`, `PageBookView.SelectionProvider`, `ProjectionViewer`, `SourceViewer`, `StructureDiffViewer`, `StructuredViewer`, `TableViewer`, `TextConsoleViewer`, `TextMergeViewer`, `TextViewer`, `TreeViewer`, `Viewer`

    public interface ISelectionProvider

Interface common to all objects that provide a selection.

See Also:
  `ISelection`, `ISelectionChangedListener`, `SelectionChangedEvent`

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `addSelectionChangedListener​(ISelectionChangedListener listener)` Adds a listener for selection changes in this selection provider.
`ISelection` `getSelection()` Returns the current selection for this provider.
`void` `removeSelectionChangedListener​(ISelectionChangedListener listener)` Removes the given selection change listener from this selection provider.
`void` `setSelection​(ISelection selection)` Sets the current selection for this selection provider.

### Method Detail

#### addSelectionChangedListener

    void addSelectionChangedListener​(ISelectionChangedListener listener)

Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.

Parameters:
  `listener` - a selection changed listener

#### getSelection

    ISelection getSelection()

Returns the current selection for this provider.

Returns:
  the current selection

#### removeSelectionChangedListener

    void removeSelectionChangedListener​(ISelectionChangedListener listener)

Removes the given selection change listener from this selection provider. Has no effect if an identical listener is not registered.

Parameters:
  `listener` - a selection changed listener

#### setSelection

    void setSelection​(ISelection selection)

Sets the current selection for this selection provider.

Parameters:
  `selection` - the new selection