void () { int row = getRowIfUnderSelection(element); if (row == -1) row = myTree.getRowForPath(new TreePath(node.getPath())); int top = row - 2; int bottom = row + 2; if (canBeCentered && Registry.is("ide.tree.autoscrollToVCenter")) { int count = TreeUtil.getVisibleRowCount(myTree) - 1; top = count > 0 ? row - count / 2 : row; bottom = count > 0 ? top + count : row; } TreeUtil.showAndSelect(myTree, top, bottom, row, -1, addToSelection, scroll) .doWhenDone(wrapDone(onDone, "AbstractTreeUi.wrapScrollTo.onDone")); }