Row selection when right clicking row header [message #1031936] |
Tue, 02 April 2013 11:39 |
Arye Shemesh Messages: 37 Registered: November 2012 |
Member |
|
|
Hi,
I'm implementing row selection when right clicking the row header.
I'd like to keep the current selection if the row that was right clicked is already selected as part of multiple row selection.
My code looks like this:
uiBindingRegistry.registerMouseDownBinding(
new MouseEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, MouseEventMatcher.RIGHT_BUTTON),
new IMouseAction() {
ViewportSelectRowAction selectRowAction = new ViewportSelectRowAction(false, false);
@Override
public void run(NatTable natTable, MouseEvent event) {
SelectionLayer selectionLayer = ((BodyLayerStack)((GridLayer)natTable.getLayer()).getBodyLayer()).getSelectionLayer();
int rowPosition = natTable.getRowPositionByY(event.y);
if(!selectionLayer.isRowPositionSelected(rowPosition)) {
selectRowAction.run(natTable, event);
} -
}
});
Sadly, it doesn't work well. When I select a range of rows and right click the header of one of them, the row position I get from the event does not match the row positions marked as selected in the selection layer (typically a shift of 1-2 positions). This leads to clearing the previous multiple row selection and selecting only the specific row that was right clicked.
I tried to get the row position by calling selectionLayer.getRowPositionByY(event.y) but it has the same problem.
Is it something I'm doing wrong? a bug?
Regards,
Arye
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03216 seconds