Package org.eclipse.jdt.ui.actions
Class ConvertingSelectionProvider
- java.lang.Object
-
- org.eclipse.jdt.ui.actions.ConvertingSelectionProvider
-
- All Implemented Interfaces:
ISelectionProvider
public class ConvertingSelectionProvider extends Object implements ISelectionProvider
A converting selection provider is a special selection provider which converts a selection before notifying any listeners. Additional it converts the selection ongetSelectionandsetSelection. The default strategy used to adapt the elements of the selection toIJavaElementor aIResource, but implementors can override this behavior.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description ConvertingSelectionProvider(ISelectionProvider provider)Creates aConvertingSelectionProviderto convert from a given selection provider using the default mechanism.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSelectionChangedListener(ISelectionChangedListener listener)ISelectionconvertFrom(ISelection viewerSelection)Converts the given original viewer selection into a new selection.ISelectionconvertTo(ISelection selection)Converts a selection to a viewer selection.ISelectiongetSelection()voidremoveSelectionChangedListener(ISelectionChangedListener listener)voidsetSelection(ISelection selection)
-
-
-
Constructor Detail
-
ConvertingSelectionProvider
public ConvertingSelectionProvider(ISelectionProvider provider)
Creates aConvertingSelectionProviderto 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 toIJavaElementthen toIResource. 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()
- Specified by:
getSelectionin interfaceISelectionProvider
-
setSelection
public final void setSelection(ISelection selection)
- Specified by:
setSelectionin interfaceISelectionProvider
-
addSelectionChangedListener
public void addSelectionChangedListener(ISelectionChangedListener listener)
- Specified by:
addSelectionChangedListenerin interfaceISelectionProvider
-
removeSelectionChangedListener
public void removeSelectionChangedListener(ISelectionChangedListener listener)
- Specified by:
removeSelectionChangedListenerin interfaceISelectionProvider
-
-