public @Nullable RunnerAndConfigurationSettings findExisting() {
    Ref<RunnerAndConfigurationSettings> existingRef = myExistingConfiguration;
    if (existingRef != null) {
      RunnerAndConfigurationSettings configuration = existingRef.get();
      if (configuration == null || !Registry.is("suggest.all.run.configurations.from.context") || configuration.equals(myConfiguration)) {
        return configuration;
      }
    }
    Location<? extends PsiElement> location = getLocation();
    if (location == null) {
      myExistingConfiguration = Ref.create(null);
      return null;
    }

    PsiElement psiElement = location.getPsiElement();
    if (!psiElement.isValid()) {
      myExistingConfiguration = Ref.create(null);
      return null;
    }

    if (MultipleRunLocationsProvider.findAlternativeLocations(location) != null) {
      myExistingConfiguration = Ref.create(null);
      return null;
    }

    final List<RuntimeConfigurationProducer> producers = findPreferredProducers();
    List<ExistingConfiguration> existingConfigurations = new ArrayList<>();
    if (producers != null) {
      for (RuntimeConfigurationProducer producer : producers) {
        RunnerAndConfigurationSettings configuration = producer.findExistingConfiguration(location, this);
        if (configuration != null) {
          existingConfigurations.add(new ExistingConfiguration(configuration, null));
        }
      }
    }
    for (RunConfigurationProducer<?> producer : RunConfigurationProducer.getProducers(getProject())) {
      RunnerAndConfigurationSettings configuration = producer.findExistingConfiguration(this);
      if (configuration != null) {
        existingConfigurations.add(new ExistingConfiguration(configuration, producer));
      }
    }
    RunnerAndConfigurationSettings preferred = findPreferredConfiguration(existingConfigurations, psiElement);
    myExistingConfiguration = Ref.create(preferred);
    return preferred;
  }
public @Nullable RunnerAndConfigurationSettings findExisting()