void (@NotNull final RunConfigurationBase configuration, @NotNull ProcessHandler handler, RunnerSettings runnerSettings) { if (myTargetDependentParameters == null || myTargetDependentParameters.getTargetEnvironment() == null) { CoverageDataManager.getInstance(configuration.getProject()).attachToProcess(handler, configuration, runnerSettings); return; } if (runnerSettings instanceof CoverageRunnerData) { handler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull final ProcessEvent event) { new Task.Backgroundable(configuration.getProject(), JavaCoverageBundle.message("download.coverage.report.from.target.progress.title")) { @Override public void run(@NotNull ProgressIndicator indicator) { JavaCoverageEnabledConfiguration coverageConfiguration = (JavaCoverageEnabledConfiguration)CoverageEnabledConfiguration.getOrCreate(configuration); try { coverageConfiguration.downloadReport(myTargetDependentParameters.getTargetEnvironment(), indicator); } catch (Exception ignored) { Notifications.Bus.notify(new Notification("Coverage", CoverageBundle.message("coverage.error.collecting.data.text"), JavaCoverageBundle.message("download.coverage.report.from.target.failed"), NotificationType.ERROR)); return; } finally { myTargetDependentParameters = null; } CoverageDataManager.getInstance(configuration.getProject()).processGatheredCoverage(configuration, runnerSettings); } }.queue(); handler.removeProcessListener(this); } }); } }