void (@NotNull MoveType type, @NotNull JTree tree) { TreePath lead = tree.getLeadSelectionPath(); int row = tree.getRowForPath(lead); if (lead == null || row < 0) { selectFirst(type, tree); } else if (tree.isExpanded(lead) || isLeaf(tree, lead)) { TreePath path = tree.getPathForRow(row + 1); if (!TreeUtil.isLoadingPath(path)) select(type, tree, path, row + 1); } else { if (tree instanceof Tree) { ((Tree)tree).startMeasuringExpandDuration(lead); } tree.expandPath(lead); } }