private EditorCell findTarget(EditorCell cell) { EditorCell toRight = cell.getLeafToRight(CellConditions.SELECTABLE); if (toRight != null) { return toRight; } return cell.getNextLeaf(CellConditions.SELECTABLE); }
private EditorCell findTarget(SelectionManager selectionManager) { Selection selection = selectionManager.getSelection(); if (selection == null) { return null; } List<EditorCell> selectedCells = selection.getSelectedCells(); EditorCell cell = myHome ? selectedCells.get(0) : selectedCells.get(selectedCells.size() - 1); EditorCell leaf = myHome ? cell.getLeafToLeft(CellConditions.SELECTABLE) : cell.getLeafToRight(CellConditions.SELECTABLE); if (leaf != null) { return leaf; } return myHome ? cell.getPrevLeaf(CellConditions.SELECTABLE) : cell.getNextLeaf(CellConditions.SELECTABLE); }