private static boolean pathsEqual(@NotNull TreePath path1, @NotNull TreePath path2) {
    if (path1.getPathCount() != path2.getPathCount()) {
      return false;
    }
    do {
      Object component1 = path1.getLastPathComponent();
      Object component2 = path2.getLastPathComponent();
      if (component1 instanceof XNamedTreeNode && component2 instanceof XNamedTreeNode) {
        if (!Objects.equals(((XNamedTreeNode)component1).getName(), ((XNamedTreeNode)component2).getName())) {
          return false;
        }
      }
      path1 = path1.getParentPath();
      path2 = path2.getParentPath();
    } while (path1 != null && path2 != null);
    return true;
  }
private static boolean pathsEqual(@NotNull TreePath path1, @NotNull TreePath path2)