AbstractTreeNode (AbstractTreeNode lastPathNode, final Object lastPathElement, VirtualFile file) { if (file == null) return lastPathNode; AbstractTreeNode found = lastPathNode; while (found != null) { if (nodeIsAcceptableForElement(lastPathNode, lastPathElement)) { break; } else { found = findInChildren(lastPathNode, file, lastPathElement); if (found != null) { lastPathNode = found; } } } return lastPathNode; }