Java源码示例:com.intellij.openapi.diagnostic.SubmittedReportInfo

示例1
@Override
public void consume(SubmittedReportInfo reportInfo) {
    myOriginalConsumer.consume(reportInfo);

    if (reportInfo.getStatus().equals(SubmittedReportInfo.SubmissionStatus.FAILED)) {
        ReportMessages.GROUP.createNotification(
                ReportMessages.ERROR_REPORT,
                reportInfo.getLinkText(),
                NotificationType.ERROR,
                NotificationListener.URL_OPENING_LISTENER).setImportant(false).notify(myProject);
    } else {
        ReportMessages.GROUP.createNotification(
                ReportMessages.ERROR_REPORT,
                reportInfo.getLinkText(),
                NotificationType.INFORMATION,
                NotificationListener.URL_OPENING_LISTENER).setImportant(false).notify(myProject);
    }
}
 
示例2
public static void appendSubmissionInformation(SubmittedReportInfo info, StringBuilder out, @Nullable String url) {
  if (info.getStatus() == SubmittedReportInfo.SubmissionStatus.FAILED) {
    out.append(" ").append(DiagnosticBundle.message("error.list.message.submission.failed"));
  }
  else {
    if (info.getLinkText() != null) {
      out.append(" ").append(DiagnosticBundle.message("error.list.message.submitted.as.link", url, info.getLinkText()));
      if (info.getStatus() == SubmittedReportInfo.SubmissionStatus.DUPLICATE) {
        out.append(" ").append(DiagnosticBundle.message("error.list.message.duplicate"));
      }
    }
    else {
      out.append(DiagnosticBundle.message("error.list.message.submitted"));
    }
  }
}
 
示例3
AnonymousFeedbackTask(@Nullable Project project,
                      @NotNull String title,
                      boolean canBeCancelled,
                      ErrorReportInformation errorReportInformation,
                      final Consumer<SubmittedReportInfo> callback) {
    super(project, title, canBeCancelled);

    this.errorReportInformation = errorReportInformation;
    myCallback = callback;
}
 
示例4
@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
    for (IdeaLoggingEvent event : events) {
        Throwable throwable = event.getThrowable();
        if (event.getData() instanceof AbstractMessage) {
            throwable = ((AbstractMessage) event.getData()).getThrowable();
        }

        SentryUtils.submitErrorReport(throwable, additionalInfo);
    }

    return true;
}
 
示例5
@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo,
    @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
  log(events, additionalInfo);
  consumer.consume(new SubmittedReportInfo(null, null, NEW_ISSUE));
  Messages.showInfoMessage(parentComponent, DEFAULT_RESPONSE, DEFAULT_RESPONSE_TITLE);
  return true;
}
 
示例6
@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo,
                      @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
    EventBuilder eventBuilder = createEvent(events, additionalInfo);
    sentry.sendEvent(eventBuilder);
    consumer.consume(new SubmittedReportInfo(null, null, NEW_ISSUE));
    Messages.showInfoMessage(parentComponent, DEFAULT_RESPONSE, DEFAULT_RESPONSE_TITLE);
    return true;
}
 
示例7
/**
 * @noinspection ThrowablePrintStackTrace
 */
private static boolean sendError(IdeaLoggingEvent event,
                                 String additionalInfo,
                                 final Component parentComponent,
                                 final Consumer<SubmittedReportInfo> callback) {
  ErrorReportBean errorBean = new ErrorReportBean(event.getThrowable(), LastActionTracker.ourLastActionId);

  return doSubmit(event, parentComponent, callback, errorBean, additionalInfo);
}
 
示例8
@Nullable
public static String getUrl(SubmittedReportInfo info) {
  if (info.getStatus() == SubmittedReportInfo.SubmissionStatus.FAILED || info.getLinkText() == null) {
    return null;
  }
  return info.getURL();
}
 
示例9
@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, String additionalInfo, @NotNull Component parentComponent,
                      @NotNull Consumer<SubmittedReportInfo> consumer) {
    GitHubErrorBean errorBean = new GitHubErrorBean(events[0].getThrowable(), IdeaLogger.ourLastActionId);
    return doSubmit(events[0], parentComponent, consumer, errorBean, additionalInfo);
}
 
示例10
@SuppressWarnings("BooleanMethodNameMustStartWithQuestion")
private static boolean doSubmit(final IdeaLoggingEvent event,
                                final Component parentComponent,
                                final Consumer<SubmittedReportInfo> callback,
                                final GitHubErrorBean bean,
                                final String description) {
    final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent);

    bean.setDescription(description);
    bean.setMessage(event.getMessage());

    if (event instanceof IdeaReportingEvent) {
        IdeaReportingEvent reportingEvent = (IdeaReportingEvent) event;
        IdeaPluginDescriptor descriptor = reportingEvent.getPlugin();
        if (descriptor != null) {
            bean.setPluginName(descriptor.getName());
            bean.setPluginVersion(descriptor.getVersion());
        }
    }

    Object data = event.getData();

    if (data instanceof LogMessage) {
        bean.setAttachments(((LogMessage) data).getIncludedAttachments());
    }

    ErrorReportInformation errorReportInformation = ErrorReportInformation
            .getUsersInformation(bean,
                    (ApplicationInfoEx) ApplicationInfo.getInstance(),
                    ApplicationNamesInfo.getInstance());

    final Project project = CommonDataKeys.PROJECT.getData(dataContext);

    final CallbackWithNotification notifyingCallback = new CallbackWithNotification(callback, project);
    AnonymousFeedbackTask task =
            new AnonymousFeedbackTask(project,
                    IntelliJDeodorantBundle.message("report.error.progress.dialog.text"),
                    true,
                    errorReportInformation,
                    notifyingCallback);
    if (project == null) {
        task.run(new EmptyProgressIndicator());
    } else {
        ProgressManager.getInstance().run(task);
    }
    return true;
}
 
示例11
CallbackWithNotification(Consumer<SubmittedReportInfo> originalConsumer, Project project) {
    this.myOriginalConsumer = originalConsumer;
    this.myProject = project;
}
 
示例12
private static void fail(@NotNull Consumer<SubmittedReportInfo> consumer) {
  consumer.consume(new SubmittedReportInfo(
    null,
    null,
    SubmittedReportInfo.SubmissionStatus.FAILED));
}
 
示例13
private static void fail(@NotNull Consumer<SubmittedReportInfo> consumer) {
  consumer.consume(new SubmittedReportInfo(
    null,
    null,
    SubmittedReportInfo.SubmissionStatus.FAILED));
}
 
示例14
@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo, @NotNull final Component parentComponent, @NotNull final Consumer<SubmittedReportInfo> consumer) {
    final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent);
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);

    StringBuilder stacktrace = new StringBuilder();
    for (IdeaLoggingEvent event : events) {
        stacktrace.append(event.getMessage()).append("\n");
        stacktrace.append(event.getThrowableText()).append("\n");
    }

    Properties properties = new Properties();
    queryPluginDescriptor(getPluginDescriptor(), properties);

    StringBuilder versionId = new StringBuilder();
    versionId.append(properties.getProperty(PLUGIN_ID_PROPERTY_KEY)).append(" ").append(properties.getProperty(PLUGIN_VERSION_PROPERTY_KEY));
    versionId.append(", ").append(ApplicationInfo.getInstance().getBuild().asString());

    // show modal error submission dialog
    PluginErrorSubmitDialog dialog = new PluginErrorSubmitDialog(parentComponent);
    dialog.prepare(additionalInfo, stacktrace.toString(), versionId.toString());
    dialog.show();

    // submit error to server if user pressed SEND
    int code = dialog.getExitCode();
    if (code == DialogWrapper.OK_EXIT_CODE) {
        dialog.persist();

        String description = dialog.getDescription();
        String user = dialog.getUser();
        String editedStacktrace = dialog.getStackTrace();

        submitToServer(project, editedStacktrace, description, user,
                new Consumer<SubmittedReportInfo>() {
                    @Override
                    public void consume(SubmittedReportInfo submittedReportInfo) {
                        consumer.consume(submittedReportInfo);

                        ApplicationManager.getApplication().invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                Messages.showInfoMessage(parentComponent, "The error report has been submitted successfully. Thank you for your feedback!", "BashSupport Error Submission");
                            }
                        });
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void consume(Throwable throwable) {
                        LOGGER.info("Error submission failed", throwable);
                        consumer.consume(new SubmittedReportInfo(SubmittedReportInfo.SubmissionStatus.FAILED));
                    }
                }
        );

        return true;
    }

    return false;
}
 
示例15
@Override
public boolean trySubmitAsync(IdeaLoggingEvent[] events, String additionalInfo, Component parentComponent, Consumer<SubmittedReportInfo> consumer) {
  return sendError(events[0], additionalInfo, parentComponent, consumer);
}
 
示例16
private void updateInfoLabel(AbstractMessage message) {
  if (message == null) {
    myInfoLabel.setText("");
    return;
  }
  final Throwable throwable = message.getThrowable();
  if (throwable instanceof MessagePool.TooManyErrorsException) {
    myInfoLabel.setText("");
    return;
  }

  StringBuilder text = new StringBuilder();
  PluginId pluginId = findPluginId(throwable);
  if (pluginId == null) {
    if (throwable instanceof AbstractMethodError) {
      text.append(DiagnosticBundle.message("error.list.message.blame.unknown.plugin"));
    }
    else {
      text.append(DiagnosticBundle.message("error.list.message.blame.core"));
    }
  }
  else {
    text.append(DiagnosticBundle.message("error.list.message.blame.plugin", PluginManager.getPlugin(pluginId).getName()));
  }
  text.append(" ").append(DiagnosticBundle.message("error.list.message.info", DateFormatUtil.formatPrettyDateTime(message.getDate()), myMergedMessages.get(myIndex).size()));

  String url = null;
  if (message.isSubmitted()) {
    final SubmittedReportInfo info = message.getSubmissionInfo();
    url = getUrl(info);
    appendSubmissionInformation(info, text, url);
    text.append(". ");
  }
  else if (message.isSubmitting()) {
    text.append(" Submitting...");
  }
  else if (!message.isRead()) {
    text.append(" ").append(DiagnosticBundle.message("error.list.message.unread"));
  }
  myInfoLabel.setHtmlText(XmlStringUtil.wrapInHtml(text));
  myInfoLabel.setHyperlinkTarget(url);
}
 
示例17
public void setSubmitted(SubmittedReportInfo info) {
  myIsSubmitting = false;
  mySubmissionInfo = info;
}
 
示例18
public SubmittedReportInfo getSubmissionInfo() {
  return mySubmissionInfo;
}
 
示例19
public boolean isSubmitted() {
  return mySubmissionInfo != null &&
        (mySubmissionInfo.getStatus() == SubmittedReportInfo.SubmissionStatus.NEW_ISSUE ||
         mySubmissionInfo.getStatus() == SubmittedReportInfo.SubmissionStatus.DUPLICATE);
}
 
示例20
public SubmittedReportInfo submit(IdeaLoggingEvent[] ideaLoggingEvents, Component component) {
  StringBuilder builder = new StringBuilder();
  for (IdeaLoggingEvent evt : ideaLoggingEvents) builder.append(evt.getMessage());
  final boolean b = reportBug(builder.toString(), component);
  return new SubmittedReportInfo(null, "email", b ? SubmittedReportInfo.SubmissionStatus.NEW_ISSUE: SubmittedReportInfo.SubmissionStatus.FAILED);
}