Reputation: 31
Although NatTable already has a class RowSelectionProvider, my data is provided through cells, not rows, so I cannot use this class. Is it possible to create a class CellSelectionProvider, or it would be too difficult?
What I want to do is select a cell in the NatTable, which is linked to an EObject. Then select the EObject in the editor and show its properties in the properties view. The first part I'm able to do, but not the second.
I've seen some tutorials about how connect to the properties view using JFace viewers as the selection provider, but nothing related to NatTable.
Upvotes: 1
Views: 496
Reputation: 4231
The ISelectionProvider
interface specifies a getSelection()
and a setSelection()
method. The selection in NatTable is implemented via the SelectionLayer
. While it should be quite easy to implement getSelection()
based on the SelectionLayer
it could become quite difficult to implement setSelection()
in a general way. Since you are working with a model based approach it is maybe possible for you to get the cell coordinates for the element that is sent via an ISelection
to correctly implement setSelection()
, but typically this is not possible as the same value in a column can be set for multiple rows.
Maybe you also don't need setSelection()
and you can implement it empty as you only want to provide a selection to the properties view. But that also depends on your use case and what you want to achieve in whole.
Upvotes: 0