@Override public ViewerCell getFocusCell() { ViewerCell cell = super.getFocusCell(); Table t = (Table) getViewer().getControl(); // It is possible that the selection has changed under the hood if (cell != null) { if (t.getSelection().length == 1 && t.getSelection()[0] != cell.getItem()) { setFocusCell(getViewer().getViewerRowFromItem( t.getSelection()[0]).getCell(cell.getColumnIndex())); } } return super.getFocusCell(); }
ViewerCell getInitialFocusCell() { Table table = (Table) getViewer().getControl(); if (table.isDisposed() || table.getItemCount() == 0) { return null; } TableItem topItem = table.getItem(table.getTopIndex()); if (topItem != null && !topItem.isDisposed()) { final ViewerRow aViewerRow = getViewer().getViewerRowFromItem(topItem); if (table.getColumnCount() == 0) { return aViewerRow.getCell(0); } Rectangle clientArea = table.getClientArea(); for (int i = 0; i < table.getColumnCount(); i++) { if (aViewerRow.getWidth(i) > 0 && columnInVisibleArea(clientArea,aViewerRow,i)) return aViewerRow.getCell(i); } } return null; }
TableViewerFocusCellManager focusCellMgr = new TableViewerFocusCellManager( propertiesViewer, new FocusCellOwnerDrawHighlighter( propertiesViewer), strategy);
@Override ViewerCell getInitialFocusCell() { Table table = (Table) getViewer().getControl(); if (!table.isDisposed() && table.getItemCount() > 0 && !table.getItem(table.getTopIndex()).isDisposed()) { final ViewerRow aViewerRow = getViewer().getViewerRowFromItem( table.getItem(table.getTopIndex())); if (table.getColumnCount() == 0) { return aViewerRow.getCell(0); } Rectangle clientArea = table.getClientArea(); for (int i = 0; i < table.getColumnCount(); i++) { if (aViewerRow.getWidth(i) > 0 && columnInVisibleArea(clientArea,aViewerRow,i)) return aViewerRow.getCell(i); } } return null; }
@Override ViewerCell getInitialFocusCell() { Table table = (Table) getViewer().getControl(); if (!table.isDisposed() && table.getItemCount() > 0 && !table.getItem(table.getTopIndex()).isDisposed()) { final ViewerRow aViewerRow = getViewer().getViewerRowFromItem( table.getItem(table.getTopIndex())); if (table.getColumnCount() == 0) { return aViewerRow.getCell(0); } Rectangle clientArea = table.getClientArea(); for (int i = 0; i < table.getColumnCount(); i++) { if (aViewerRow.getWidth(i) > 0 && columnInVisibleArea(clientArea,aViewerRow,i)) return aViewerRow.getCell(i); } } return null; }
@Override public ViewerCell getFocusCell() { ViewerCell cell = super.getFocusCell(); Table t = (Table) getViewer().getControl(); // It is possible that the selection has changed under the hood if (cell != null) { if (t.getSelection().length == 1 && t.getSelection()[0] != cell.getItem()) { setFocusCell(getViewer().getViewerRowFromItem( t.getSelection()[0]).getCell(cell.getColumnIndex())); } } return super.getFocusCell(); }