void (@NotNull String message, @NotNull Path file, @NotNull Project project) { Runnable showError = () -> Messages.showMessageDialog( project, InspectionsBundle.message("inspection.export.error.writing.to", file.toString(), message), InspectionsBundle.message("inspection.export.results.title"), Messages.getErrorIcon() ); ApplicationManager.getApplication().invokeLater(showError, ModalityState.nonModal()); throw new ProcessCanceledException(); }