public static <T> @Nullable T getParentNodeOfType(@Nullable AbstractTreeNode<?> node, @NotNull Class<T> aClass) {
    for (AbstractTreeNode<?> cur = node; cur != null; cur = cur.getParent()) {
      if (aClass.isInstance(cur)) return (T)cur;
    }
    return null;
  }
public static <T> @Nullable T getParentNodeOfType(@Nullable AbstractTreeNode<?> node, @NotNull Class<T> aClass)