FileBaseMatch (String[] parts, VirtualFile parent, int idx) { while (parent != null && idx >= 0 && parent.getName().equals(parts[idx])) { parent = parent.getParent(); --idx; } return parent != null ? new FileBaseMatch(parent, idx + 1) : null; }