void (@NotNull MoveType type, @NotNull JTree tree) { TreePath lead = tree.getLeadSelectionPath(); int row = tree.getRowForPath(lead); if (lead == null || row < 0) { selectFirstExceptSeparator(type, tree); } else { if (row == 0 && isCycleScrollingAllowed(type)) row = tree.getRowCount(); row = findRowExceptSeparator(tree, row, true); // NB!: decrease row after checking for cycle scrolling selectExceptSeparator(type, tree, row); } }