public static VirtualFile getVirtualFile(TreePath path) {
    Object component = path.getLastPathComponent();
    if (component instanceof DefaultMutableTreeNode node) {
      Object userObject = node.getUserObject();
      if (userObject instanceof FileNodeDescriptor descriptor) {
        return descriptor.getElement().getFile();
      }
    }
    if (component instanceof FileNode node) {
      return node.getFile();
    }
    return null;
  }
public static VirtualFile getVirtualFile(TreePath path)