TreeVisitor (@NotNull Object object) { if (object instanceof AbstractTreeNode<?> node) { if (node.getEqualityObject() instanceof SmartPsiElementPointer<?> ptr) { return new ProjectViewNodeVisitor(ptr); } object = node.getValue(); } else if (object instanceof ProjectFileNode) { ProjectFileNode node = (ProjectFileNode)object; return createVisitor(node.getVirtualFile()); } if (object instanceof VirtualFile) return createVisitor((VirtualFile)object); if (object instanceof PsiElement) return createVisitor((PsiElement)object); LOG.warn("unsupported object: " + object); return null; }