int (@NotNull TreeNode root, @NotNull FilePath toSelect) { TreeNode targetNode = TreeUtil.treeNodeTraverser(root).traverse(TreeTraversal.POST_ORDER_DFS).find(node -> { if (node instanceof DefaultMutableTreeNode) { Object userObject = ((DefaultMutableTreeNode)node).getUserObject(); if (userObject instanceof Change) { return matches((Change)userObject, toSelect); } } return false; }); if (targetNode != null) { return TreeUtil.getRowForNode(this, (DefaultMutableTreeNode)targetNode); } else { return -1; } }