Package org.eclipse.jdt.ui.actions
Class ConvertingSelectionProvider
java.lang.Object
org.eclipse.jdt.ui.actions.ConvertingSelectionProvider
- All Implemented Interfaces:
org.eclipse.jface.viewers.ISelectionProvider
public class ConvertingSelectionProvider
extends Object
implements org.eclipse.jface.viewers.ISelectionProvider
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 IJavaElement
or a IResource
,
but implementors can override this behavior.- Since:
- 3.2
-
Constructor Summary
ConstructorDescriptionConvertingSelectionProvider
(org.eclipse.jface.viewers.ISelectionProvider provider) Creates aConvertingSelectionProvider
to convert from a given selection provider using the default mechanism. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSelectionChangedListener
(org.eclipse.jface.viewers.ISelectionChangedListener listener) org.eclipse.jface.viewers.ISelection
convertFrom
(org.eclipse.jface.viewers.ISelection viewerSelection) Converts the given original viewer selection into a new selection.org.eclipse.jface.viewers.ISelection
convertTo
(org.eclipse.jface.viewers.ISelection selection) Converts a selection to a viewer selection.final org.eclipse.jface.viewers.ISelection
void
removeSelectionChangedListener
(org.eclipse.jface.viewers.ISelectionChangedListener listener) final void
setSelection
(org.eclipse.jface.viewers.ISelection selection)
-
Constructor Details
-
ConvertingSelectionProvider
public ConvertingSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider provider) Creates aConvertingSelectionProvider
to convert from a given selection provider using the default mechanism.- Parameters:
provider
- the provider to covert from and to
-
-
Method Details
-
convertFrom
public org.eclipse.jface.viewers.ISelection convertFrom(org.eclipse.jface.viewers.ISelection viewerSelection) Converts the given original viewer selection into a new selection. The default behavior adapts the elements in the selection first toIJavaElement
then toIResource
. Implementors want to override this method.- Parameters:
viewerSelection
- the original viewer selection- Returns:
- the new selection to be used
-
convertTo
public org.eclipse.jface.viewers.ISelection convertTo(org.eclipse.jface.viewers.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 org.eclipse.jface.viewers.ISelection getSelection()- Specified by:
getSelection
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
setSelection
public final void setSelection(org.eclipse.jface.viewers.ISelection selection) - Specified by:
setSelection
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
addSelectionChangedListener
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
addSelectionChangedListener
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
removeSelectionChangedListener
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
removeSelectionChangedListener
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-