I would like to set focus to a specifc row in a TableViewer
.
The focus and input handing is defined like this:
ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE);
FocusCellOwnerDrawHighlighter fch = new FocusCellOwnerDrawHighlighter(viewer);
TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer, fch);
ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(viewer) {
protected boolean isEditorActivationEvent(final
ColumnViewerEditorActivationEvent event) {
return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
|| event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.F2)
|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
}
};
TableViewerEditor.create(viewer, actSupport, ColumnViewerEditor.TABBING_HORIZONTAL
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR |
ColumnViewerEditor.TABBING_VERTICAL
| ColumnViewerEditor.KEYBOARD_ACTIVATION);
The code to select a row is:
getViewer().setSelection(new StructuredSelection(parameterTable.getViewer().getElementAt(selection)), false);
The problem is, that as soon as I use the FocusCellOwnerDrawHighlighter
, setSelection
no longer works, meaning that no row is selected.
Any ideas what I'm doing wrong ?
Regards Roger