There is a column which displaying row numbers, I want to stop u开发者_Python百科ser to traverse to cells in it using arrow keys.
here is my own solution:
tv.getTable().addTraverseListener(new TraverseListener(){
public void keyTraversed(TraverseEvent e) {
ViewerCell cell = focusCellManager.getFocusCell();
if(e.keyCode == SWT.ARROW_LEFT && cell.getColumnIndex() == 2){
e.detail = SWT.TRAVERSE_NONE;
e.doit = true;
}
}
});
Assuming you're using JFace cell navigation, then sub-class CellNavigationStrategy
and use in constructor of TableViewerFocusCellManager
.
精彩评论