void (@NotNull final Project project, @NotNull final DataContext dataContext, @NotNull final CoverageSuitesBundle currentSuite) { final ExportToHTMLSettings settings = ExportToHTMLSettings.getInstance(project); ProgressManager.getInstance().run(new Task.Backgroundable(project, JavaCoverageBundle.message("generating.coverage.report")) { final Exception[] myExceptions = new Exception[1]; @Override public void run(@NotNull final ProgressIndicator indicator) { try { ((JavaCoverageRunner)currentSuite.getSuites()[0].getRunner()).generateReport(currentSuite, project); } catch (IOException e) { LOG.error(e); } catch (ReportGenerationFailedException e) { myExceptions[0] = e; } } @Override public void onSuccess() { if (myExceptions[0] != null) { Messages.showErrorDialog(project, myExceptions[0].getMessage(), CommonBundle.getErrorTitle()); return; } if (settings.OPEN_IN_BROWSER) { BrowserUtil.browse(new File(settings.OUTPUT_DIRECTORY, "index.html")); } } }); }