@Override
  public boolean isConfigurationFromContext(@NotNull T appConfiguration, @NotNull ConfigurationContext context) {
    Location<?> location = context.getLocation();
    if (location == null) {
      return false;
    }

    Location<?> singleClassLocation = JavaExecutionUtil.stepIntoSingleClass(location);
    final PsiClass aClass = PsiTreeUtil.getParentOfType(singleClassLocation.getPsiElement(), PsiClass.class, false);
    if (aClass != null) {
      final String className = JavaExecutionUtil.getRuntimeQualifiedName(aClass);
      if (!Objects.equals(className, appConfiguration.getMainClassName())) return false;

      final PsiMethod method = PsiTreeUtil.getParentOfType(context.getPsiLocation(), PsiMethod.class, false);
      if (method != null && TestFrameworks.getInstance().isTestMethod(method)) {
        return false;
      }

      final Module configurationModule = appConfiguration.getConfigurationModule().getModule();
      if (Comparing.equal(context.getModule(), configurationModule)) return true;

      ApplicationConfiguration template = (ApplicationConfiguration)context
        .getRunManager()
        .getConfigurationTemplate(getConfigurationFactory())
        .getConfiguration();
      final Module predefinedModule = template.getConfigurationModule().getModule();
      return Comparing.equal(predefinedModule, configurationModule);
    }
    return false;
  }
@Override
  public boolean isConfigurationFromContext(@NotNull T appConfiguration, @NotNull ConfigurationContext context)