void (@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); try { if (!writeOutputFile(config, outputFile)) return; } catch (IOException | SAXException | TransformerException ex) { LOG.warn(ex); showBalloon(project, MessageType.ERROR, ExecutionBundle.message("export.test.results.failed", ex.getMessage()), null); return; } catch (RuntimeException ex) { File tempFile; try { tempFile = FileUtil.createTempFile("", "_xml"); } catch (IOException exception) { LOG.error("Failed to create temp file", exception); LOG.error("Failed to export test results", ex); return; } try { ExportTestResultsConfiguration c = new ExportTestResultsConfiguration(); c.setExportFormat(ExportTestResultsConfiguration.ExportFormat.Xml); c.setOpenResults(false); writeOutputFile(c, tempFile); } catch (Throwable ignored) { } LOG.error("Failed to export test results", ex, AttachmentFactory.createAttachment(tempFile.toPath(), false)); FileUtil.delete(tempFile); return; } final Ref<VirtualFile> result = new Ref<>(); final Ref<String> error = new Ref<>(); ApplicationManager.getApplication().invokeAndWait(() -> { result.set(WriteAction.compute(() -> { try { VirtualFile child = parent.findChild(outputFile.getName()); return child == null ? parent.createChildData(this, outputFile.getName()) : child; } catch (IOException e) { LOG.warn(e); error.set(e.getMessage()); return null; } })); }); if (!result.isNull()) { if (config.isOpenResults()) { openEditorOrBrowser(result.get(), project, config.getExportFormat() == ExportTestResultsConfiguration.ExportFormat.Xml); } else { HyperlinkListener listener = new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { openEditorOrBrowser(result.get(), project, config.getExportFormat() == ExportTestResultsConfiguration.ExportFormat.Xml); } } }; showBalloon(project, MessageType.INFO, ExecutionBundle.message("export.test.results.succeeded", outputFile.getName()), listener); } } else { showBalloon(project, MessageType.ERROR, ExecutionBundle.message("export.test.results.failed", error.get()), null); } }