Package org.eclipse.compare.internal

# Class CompareEditorSelectionProvider

java.lang.Object
org.eclipse.compare.internal.CompareEditorSelectionProvider

All Implemented Interfaces:
  `IPostSelectionProvider`, `ISelectionProvider`

public class CompareEditorSelectionProvider extends Object implements IPostSelectionProvider
A selection provider for view parts with more that one viewer. Tracks the focus of the viewers to provide the correct selection. This is a modified version of org.eclipse.jdt.internal.ui.viewsupport.SelectionProviderMediator

## Constructor Summary

Constructors
Constructor
Description
`CompareEditorSelectionProvider()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addPostSelectionChangedListener(ISelectionChangedListener listener)`
Adds a listener for post selection changes in this selection provider.
`void`
`addSelectionChangedListener(ISelectionChangedListener listener)`
Adds a listener for selection changes in this selection provider.
`ISelection`
`getSelection()`
Returns the current selection for this provider.
`void`
`removePostSelectionChangedListener(ISelectionChangedListener listener)`
Removes the given listener for post selection changes from this selection 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.
`void`
`setSelection(ISelection selection, boolean reveal)`
`void`
`setViewers(TextViewer[] viewers, TextViewer viewerInFocus)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CompareEditorSelectionProvider

public CompareEditorSelectionProvider()

## Method Details

### setViewers

public void setViewers(TextViewer[] viewers, TextViewer viewerInFocus)

Parameters:
  `viewers` - All viewers that can provide a selection
  `viewerInFocus` - the viewer currently in focus or `null`

### addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener listener)
Description copied from interface: `ISelectionProvider`
Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.

Specified by:
  `addSelectionChangedListener` in interface `ISelectionProvider`
Parameters:
  `listener` - a selection changed listener

### removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener listener)
Description copied from interface: `ISelectionProvider`
Removes the given selection change listener from this selection provider. Has no effect if an identical listener is not registered.

Specified by:
  `removeSelectionChangedListener` in interface `ISelectionProvider`
Parameters:
  `listener` - a selection changed listener

### addPostSelectionChangedListener

public void addPostSelectionChangedListener(ISelectionChangedListener listener)
Description copied from interface: `IPostSelectionProvider`
Adds a listener for post selection changes in this selection provider. Has no effect if an identical listener is already registered.

Specified by:
  `addPostSelectionChangedListener` in interface `IPostSelectionProvider`
Parameters:
  `listener` - a selection changed listener

### removePostSelectionChangedListener

public void removePostSelectionChangedListener(ISelectionChangedListener listener)
Description copied from interface: `IPostSelectionProvider`
Removes the given listener for post selection changes from this selection provider. Has no effect if an identical listener is not registered.

Specified by:
  `removePostSelectionChangedListener` in interface `IPostSelectionProvider`
Parameters:
  `listener` - a selection changed listener

### getSelection

public ISelection getSelection()
Description copied from interface: `ISelectionProvider`
Returns the current selection for this provider.

Specified by:
  `getSelection` in interface `ISelectionProvider`
Returns:
  the current selection

### setSelection

public void setSelection(ISelection selection)
Description copied from interface: `ISelectionProvider`
Sets the current selection for this selection provider.

Specified by:
  `setSelection` in interface `ISelectionProvider`
Parameters:
  `selection` - the new selection

### setSelection

public void setSelection(ISelection selection, boolean reveal)