org.eclipse.wst.jsdt.ui.actions

## Class ConvertingSelectionProvider

- java.lang.Object
- - org.eclipse.wst.jsdt.ui.actions.ConvertingSelectionProvider

    public class ConvertingSelectionProvider
    extends java.lang.Object

A converting selection provider is a special selection provider which converts a selection before notifying any listeners. Additional it converts the selection on `getSelection` and `setSelection`. The default strategy used to adapt the elements of the selection to `IJavaScriptElement` or a `IResource`, but implementors can override this behavior. Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

### Constructor Summary

Constructors
Constructor and Description
`ConvertingSelectionProvider(ISelectionProvider provider)` Creates a `ConvertingSelectionProvider` to convert from a given selection provider using the default mechanism.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addSelectionChangedListener(ISelectionChangedListener listener)`
`ISelection` `convertFrom(ISelection viewerSelection)` Converts the given original viewer selection into a new selection.
`ISelection` `convertTo(ISelection selection)` Converts a selection to a viewer selection.
`ISelection` `getSelection()`
`void` `removeSelectionChangedListener(ISelectionChangedListener listener)`
`void` `setSelection(ISelection selection)`

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

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

### Constructor Detail

#### ConvertingSelectionProvider

    public ConvertingSelectionProvider(ISelectionProvider provider)

Creates a `ConvertingSelectionProvider` to convert from a given selection provider using the default mechanism.

Parameters:
  `provider` - the provider to covert from and to

### Method Detail

#### convertFrom

    public ISelection convertFrom(ISelection viewerSelection)

Converts the given original viewer selection into a new selection. The default behavior adapts the elements in the selection first to `IJavaScriptElement` then to `IResource`. Implementors want to override this method.

Parameters:
  `viewerSelection` - the original viewer selection
Returns:
  the new selection to be used

#### convertTo

    public ISelection convertTo(ISelection selection)

Converts a selection to a viewer selection. The default implementation does not convert the selection. Implementors want to override this behavior.

Parameters:
  `selection` - the selection to convert
Returns:
  a viewer selection

#### getSelection

    public final ISelection getSelection()

#### setSelection

    public final void setSelection(ISelection selection)

#### addSelectionChangedListener

    public void addSelectionChangedListener(ISelectionChangedListener listener)

#### removeSelectionChangedListener

    public void removeSelectionChangedListener(ISelectionChangedListener listener)