private EditorCell findTarget(EditorCell cell) { EditorCell toLeft = cell.getLeafToLeft(CellConditions.SELECTABLE); if (toLeft != null) { return toLeft; } return cell.getPrevLeaf(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); }