void ( @NotNull ConfigurationFromContext configuration, @NotNull ConfigurationContext context, @NotNull Runnable startRunnable ) { if (!myBaseConfigurationProducer.isMultipleElementsSelected(context)) { super.onFirstRun(configuration, context, startRunnable); return; } Module module = getModuleFromContext(context); if (module == null) { LOG.warn("Cannot find module from context, uses raw run configuration"); super.onFirstRun(configuration, context, startRunnable); return; } GradleRunConfiguration runConfiguration = (GradleRunConfiguration)configuration.getConfiguration(); Project project = context.getProject(); List<String> tests = getTestPatterns(context); if (tests.isEmpty()) { LOG.warn("Cannot find runnable tests from context, uses raw run configuration"); super.onFirstRun(configuration, context, startRunnable); return; } TestMappings testMappings = getTestMappings(project, tests); getTestTasksChooser().chooseTestTasks(project, context.getDataContext(), testMappings.getClasses().values(), tasks -> { ExternalSystemTaskExecutionSettings settings = runConfiguration.getSettings(); Function1<String, VirtualFile> findTestSource = test -> getSourceFile(testMappings.getClasses().get(test)); Function1<String, String> createFilter = (test) -> createTestFilterFrom(testMappings.getClasses().get(test), testMappings.getMethods().get(test)); if (!applyTestConfiguration(settings, module, tasks, tests, findTestSource, createFilter)) { LOG.warn("Cannot apply pattern test configuration, uses raw run configuration"); super.onFirstRun(configuration, context, startRunnable); return; } runConfiguration.setName(suggestConfigurationName(tests)); setUniqueNameIfNeeded(project, runConfiguration); super.onFirstRun(configuration, context, startRunnable); }); }