void (@NotNull AnActionEvent e) { final Project project = e.getProject(); if (project == null) { return; } ProgressManager.getInstance().run(new Task.Backgroundable(project, StatisticsBundle.message("stats.send.feature.usage.event.log"), false) { @Override public void run(@NotNull ProgressIndicator indicator) { final StatisticsResult result = send(); final StatisticsResult.ResultCode code = result.getCode(); if (code == StatisticsResult.ResultCode.SENT_WITH_ERRORS || code == StatisticsResult.ResultCode.SEND) { final boolean succeed = tryToOpenInScratch(project, result.getDescription()); if (succeed) { return; } } ApplicationManager.getApplication().invokeLater( () -> Messages.showMultilineInputDialog(project, "Result: " + code, "Statistics Result", StringUtil.replace(result.getDescription(), ";", "\n"), null, null), ModalityState.nonModal(), project.getDisposed()); } private static StatisticsResult send() { String recorderId = StringUtil.trim(Registry.stringValue("usage.statistics.test.action.recorder.id")); return EventLogStatisticsService.send( EventLogInternalSendConfig.createByRecorder(recorderId, true), new EventLogTestSettingsService(recorderId), new EventLogTestResultDecorator() ); } }); }