Package org.eclipse.handly.ui.viewer

## Class DelegatingSelectionProvider

- java.lang.Object
- - org.eclipse.handly.ui.viewer.DelegatingSelectionProvider

- All Implemented Interfaces:
    `org.eclipse.jface.viewers.IPostSelectionProvider`, `org.eclipse.jface.viewers.ISelectionProvider`

      public class DelegatingSelectionProvider
      extends java.lang.Object
      implements org.eclipse.jface.viewers.IPostSelectionProvider

  An implementation of `IPostSelectionProvider` that delegates to another selection provider, which can be replaced dynamically. Notifies the registered listeners when the delegate's selection changes.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DelegatingSelectionProvider()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addPostSelectionChangedListener​(org.eclipse.jface.viewers.ISelectionChangedListener listener)` |
    `void` | `addSelectionChangedListener​(org.eclipse.jface.viewers.ISelectionChangedListener listener)` |
    `protected org.eclipse.jface.viewers.ISelectionProvider` | `getDelegate()` | Returns the selection provider currently used for delegation.
    `org.eclipse.jface.viewers.ISelection` | `getSelection()` |
    `protected org.eclipse.jface.viewers.SelectionChangedEvent` | `newSelectionChangedEvent​(org.eclipse.jface.viewers.ISelection selection)` | Returns a new `SelectionChangedEvent` for the given selection.
    `void` | `removePostSelectionChangedListener​(org.eclipse.jface.viewers.ISelectionChangedListener listener)` |
    `void` | `removeSelectionChangedListener​(org.eclipse.jface.viewers.ISelectionChangedListener listener)` |
    `void` | `setDelegate​(org.eclipse.jface.viewers.ISelectionProvider newDelegate)` | Sets a new selection provider to delegate to.
    `void` | `setSelection​(org.eclipse.jface.viewers.ISelection selection)` |

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

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

- - ### Constructor Detail

    - #### DelegatingSelectionProvider

          public DelegatingSelectionProvider()

  - ### Method Detail

    - #### setDelegate

          public void setDelegate​(org.eclipse.jface.viewers.ISelectionProvider newDelegate)

      Sets a new selection provider to delegate to.
      Parameters:
        `newDelegate` - may be `null`

    - #### addSelectionChangedListener

          public void addSelectionChangedListener​(org.eclipse.jface.viewers.ISelectionChangedListener listener)

      Specified by:
        `addSelectionChangedListener` in interface `org.eclipse.jface.viewers.ISelectionProvider`

    - #### removeSelectionChangedListener

          public void removeSelectionChangedListener​(org.eclipse.jface.viewers.ISelectionChangedListener listener)

      Specified by:
        `removeSelectionChangedListener` in interface `org.eclipse.jface.viewers.ISelectionProvider`

    - #### addPostSelectionChangedListener

          public void addPostSelectionChangedListener​(org.eclipse.jface.viewers.ISelectionChangedListener listener)

      Specified by:
        `addPostSelectionChangedListener` in interface `org.eclipse.jface.viewers.IPostSelectionProvider`

    - #### removePostSelectionChangedListener

          public void removePostSelectionChangedListener​(org.eclipse.jface.viewers.ISelectionChangedListener listener)

      Specified by:
        `removePostSelectionChangedListener` in interface `org.eclipse.jface.viewers.IPostSelectionProvider`

    - #### getSelection

          public org.eclipse.jface.viewers.ISelection getSelection()

      Specified by:
        `getSelection` in interface `org.eclipse.jface.viewers.ISelectionProvider`

    - #### setSelection

          public void setSelection​(org.eclipse.jface.viewers.ISelection selection)

      Specified by:
        `setSelection` in interface `org.eclipse.jface.viewers.ISelectionProvider`

    - #### getDelegate

          protected final org.eclipse.jface.viewers.ISelectionProvider getDelegate()

      Returns the selection provider currently used for delegation.
      Returns:
        the delegate selection provider (may be `null`)

    - #### newSelectionChangedEvent

          protected org.eclipse.jface.viewers.SelectionChangedEvent newSelectionChangedEvent​(org.eclipse.jface.viewers.ISelection selection)

      Returns a new `SelectionChangedEvent` for the given selection.

      Default implementation returns `new SelectionChangedEvent(this, selection)`.

      Parameters:
        `selection` - not `null`
      Returns:
        the created event (never `null`)