private static @Nullable Project findConfigurableProject(@NotNull MyNode node) {
    Configurable configurable = node.myConfigurable;
    Project project = node.getProject();
    Configurable.VariableProjectAppLevel wrapped = ConfigurableWrapper.cast(Configurable.VariableProjectAppLevel.class, configurable);
    if (wrapped != null) return wrapped.isProjectLevel() ? project : null;
    if (configurable instanceof ConfigurableWrapper) return project;
    if (configurable instanceof SortedConfigurableGroup) return project;

    SimpleNode parent = node.getParent();
    return parent instanceof MyNode
           ? findConfigurableProject((MyNode)parent)
           : null;
  }
private static @Nullable Project findConfigurableProject(@NotNull MyNode node)