Class RowSelectionProvider<T>
- Type Parameters:
T
- The type of objects provided by the IRowDataProvider
- All Implemented Interfaces:
org.eclipse.jface.viewers.ISelectionProvider
,ILayerListener
- Direct Known Subclasses:
RowPostSelectionProvider
-
Constructor Summary
ConstructorDescriptionRowSelectionProvider
(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider) Create a RowSelectionProvider that only handles fully selected rows and only fires SelectionChangedEvents if the row selection changes.RowSelectionProvider
(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider, boolean fullySelectedRowsOnly) Create a RowSelectionProvider that only fires SelectionChangedEvents if the row selection changes.RowSelectionProvider
(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider, boolean fullySelectedRowsOnly, boolean handleSameRowSelection) Create a RowSelectionProvider configured with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSelectionChangedListener
(org.eclipse.jface.viewers.ISelectionChangedListener listener) org.eclipse.jface.viewers.ISelection
void
handleLayerEvent
(ILayerEvent event) Handle an event notification from anILayer
void
removeSelectionChangedListener
(org.eclipse.jface.viewers.ISelectionChangedListener listener) void
setAddSelectionOnSet
(boolean addSelectionOnSet) Configure whethersetSelection()
should add or set the selection.void
setProcessColumnSelection
(boolean processColumnSelection) Configure whether column selections should start row selection processing or not.void
setSelection
(org.eclipse.jface.viewers.ISelection selection) void
updateSelectionProvider
(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider) Updates this RowSelectionProvider so it handles the selection of another SelectionLayer and IRowDataProvider.
-
Constructor Details
-
RowSelectionProvider
Create a RowSelectionProvider that only handles fully selected rows and only fires SelectionChangedEvents if the row selection changes.- Parameters:
selectionLayer
- The SelectionLayer this ISelectionProvider should be connected to.rowDataProvider
- The IRowDataProvider that should be used to access the selected row data.
-
RowSelectionProvider
public RowSelectionProvider(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider, boolean fullySelectedRowsOnly) Create a RowSelectionProvider that only fires SelectionChangedEvents if the row selection changes.- Parameters:
selectionLayer
- The SelectionLayer this ISelectionProvider should be connected to.rowDataProvider
- The IRowDataProvider that should be used to access the selected row data.fullySelectedRowsOnly
- Flag to determine if only fully selected rows should be used to populate the selection or if any selection should be populated.
-
RowSelectionProvider
public RowSelectionProvider(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider, boolean fullySelectedRowsOnly, boolean handleSameRowSelection) Create a RowSelectionProvider configured with the given parameters.- Parameters:
selectionLayer
- The SelectionLayer this ISelectionProvider should be connected to.rowDataProvider
- The IRowDataProvider that should be used to access the selected row data.fullySelectedRowsOnly
- Flag to determine if only fully selected rows should be used to populate the selection or if any selection should be populated.handleSameRowSelection
- Flag to configure whether only SelectionChangedEvents should be fired if the row selection changes or even if you just select another column.
-
-
Method Details
-
updateSelectionProvider
public void updateSelectionProvider(SelectionLayer selectionLayer, IRowDataProvider<T> rowDataProvider) Updates this RowSelectionProvider so it handles the selection of another SelectionLayer and IRowDataProvider.This method was introduced to add support for multiple selection provider within one part. As replacing the selection provider during the lifetime of a part is not properly supported by the workbench, this implementation adds the possibility to exchange the control that serves as selection provider by exchanging the references in the selection provider itself.
- Parameters:
selectionLayer
- The SelectionLayer this ISelectionProvider should be connected to.rowDataProvider
- The IRowDataProvider that should be used to access the selected row data.
-
addSelectionChangedListener
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
addSelectionChangedListener
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
getSelection
public org.eclipse.jface.viewers.ISelection getSelection()- Specified by:
getSelection
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
-
setSelection
public void setSelection(org.eclipse.jface.viewers.ISelection selection) - Specified by:
setSelection
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
handleLayerEvent
Description copied from interface:ILayerListener
Handle an event notification from anILayer
- Specified by:
handleLayerEvent
in interfaceILayerListener
- Parameters:
event
- the event
-
setAddSelectionOnSet
public void setAddSelectionOnSet(boolean addSelectionOnSet) Configure whethersetSelection()
should add or set the selection.This was added for convenience because the initial code always added the selection on
setSelection()
by creating a SelectRowsCommand with the withControlMask set totrue
. Looking at the specification,setSelection()
is used to set the new selection. So the default here is now to set instead of add. But for convenience to older code that relied on the add behaviour it is now possible to change it back to adding.- Parameters:
addSelectionOnSet
-true
to add the selection on callingsetSelection()
The default isfalse
to behave like specified in RowSelectionProvider
-
setProcessColumnSelection
public void setProcessColumnSelection(boolean processColumnSelection) Configure whether column selections should start row selection processing or not.This is necessary to handle issues with huge datasets. Dependent on different configurations, selecting a column can cause the selection of all rows in a table, which would then lead to populate the whole dataset as selection via this provider. Setting the
processColumnSelection
flag tofalse
will skip processing to avoid such issues.- Parameters:
processColumnSelection
-true
to process row selection in case of column selections (default)false
to skip processing in case of column selections to avoid issues on large datasets.
-