private boolean canBeAdded(@NotNull RunConfiguration candidate, final @NotNull CompoundRunConfiguration root) {
    if (candidate.getType() == root.getType() && candidate.getName().equals(root.getName())) return false;
    List<BeforeRunTask<?>> tasks = RunManagerImplKt.doGetBeforeRunTasks(candidate);
    for (BeforeRunTask<?> task : tasks) {
      if (task instanceof RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask runTask) {
        RunnerAndConfigurationSettings settings = runTask.getSettings();
        if (settings != null) {
         if (!canBeAdded(settings.getConfiguration(), root)) return false;
        }
      }
    }
    if (candidate instanceof CompoundRunConfiguration) {
      for (RunConfiguration configuration : ((CompoundRunConfiguration)candidate).getConfigurationsWithTargets(myRunManager).keySet()) {
        if (!canBeAdded(configuration, root)) {
          return false;
        }
      }
    }
    return true;
  }
private boolean canBeAdded(@NotNull RunConfiguration candidate, final @NotNull CompoundRunConfiguration root)