diff options
author | Tor Norbye <tnorbye@google.com> | 2014-09-18 20:40:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-09-18 20:40:22 +0000 |
commit | 07d35c37ce79a64bdd905b394d40fc9bbb18fa60 (patch) | |
tree | e8787c45e494dfcc558faf0f75956f8785c39b94 /platform/platform-api/src/com/intellij/openapi/diagnostic | |
parent | e222a9e1e66670a56e926a6b0f3e10231eeeb1fb (diff) | |
parent | b5fb31ef6a38f19404859755dbd2e345215b97bf (diff) | |
download | idea-07d35c37ce79a64bdd905b394d40fc9bbb18fa60.tar.gz |
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge"
Diffstat (limited to 'platform/platform-api/src/com/intellij/openapi/diagnostic')
-rw-r--r-- | platform/platform-api/src/com/intellij/openapi/diagnostic/ErrorReportSubmitter.java | 54 | ||||
-rw-r--r-- | platform/platform-api/src/com/intellij/openapi/diagnostic/SubmittedReportInfo.java | 25 |
2 files changed, 46 insertions, 33 deletions
diff --git a/platform/platform-api/src/com/intellij/openapi/diagnostic/ErrorReportSubmitter.java b/platform/platform-api/src/com/intellij/openapi/diagnostic/ErrorReportSubmitter.java index 9f1b8e06b39e..c68e45189a95 100644 --- a/platform/platform-api/src/com/intellij/openapi/diagnostic/ErrorReportSubmitter.java +++ b/platform/platform-api/src/com/intellij/openapi/diagnostic/ErrorReportSubmitter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ package com.intellij.openapi.diagnostic; import com.intellij.openapi.extensions.PluginAware; import com.intellij.openapi.extensions.PluginDescriptor; import com.intellij.util.Consumer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.awt.*; @@ -44,33 +46,43 @@ public abstract class ErrorReportSubmitter implements PluginAware { } /** - * @return "Report to vendor" action text to be used in Error Reporter user interface. For example: "Report to JetBrains". + * @return an action text to be used in Error Reporter user interface, e.g. "Report to JetBrains". */ public abstract String getReportActionText(); /** - * This method is called whenever fatal error (aka exception) in plugin code had happened and user decided to report this problem to - * plugin vendor. - * @param events sequence of the fatal error descriptors. Fatal errors that happened immediately one after another most probably caused - * by first one that happened so it's a common practice to submit only first one. Array passed is guaranteed to have at least one element. - * @param parentComponent one usually wants to show up a dialog asking user for additional details and probably authentication info. - * parentComponent parameter is passed so dialog that would come up would be properly aligned with its parent dialog (IDE Fatal Errors). - * @return submission result status. + * This method is called whenever an exception in a plugin code had happened and a user decided to report a problem to the plugin vendor. + * + * @param events a non-empty sequence of error descriptors. + * @param additionalInfo additional information provided by a user. + * @param parentComponent UI component to use as a parent in any UI activity from a submitter. + * @param consumer a callback to be called after sending is finished (or failed). + * @return {@code true} if reporting was started, {@code false} if a report can't be sent at the moment. */ - public abstract SubmittedReportInfo submit(IdeaLoggingEvent[] events, Component parentComponent); - - public void submitAsync(IdeaLoggingEvent[] events, - String additionalInfo, - Component parentComponent, - Consumer<SubmittedReportInfo> consumer) { - consumer.consume(submit(events, parentComponent)); + @SuppressWarnings("deprecation") + public boolean submit(@NotNull IdeaLoggingEvent[] events, + @Nullable String additionalInfo, + @NotNull Component parentComponent, + @NotNull Consumer<SubmittedReportInfo> consumer) { + return trySubmitAsync(events, additionalInfo, parentComponent, consumer); } - public boolean trySubmitAsync(IdeaLoggingEvent[] events, - String additionalInfo, - Component parentComponent, - Consumer<SubmittedReportInfo> consumer) { - submitAsync(events, additionalInfo, parentComponent, consumer); + /** @deprecated implement {@link #submit(IdeaLoggingEvent[], String, Component, Consumer)} (to be removed in IDEA 16) */ + @SuppressWarnings({"deprecation", "unused"}) + public boolean trySubmitAsync(IdeaLoggingEvent[] events, String info, Component parent, Consumer<SubmittedReportInfo> consumer) { + submitAsync(events, info, parent, consumer); return true; } + + /** @deprecated implement {@link #submit(IdeaLoggingEvent[], String, Component, Consumer)} (to be removed in IDEA 16) */ + @SuppressWarnings({"deprecation", "unused"}) + public void submitAsync(IdeaLoggingEvent[] events, String info, Component parent, Consumer<SubmittedReportInfo> consumer) { + consumer.consume(submit(events, parent)); + } + + /** @deprecated implement {@link #submit(IdeaLoggingEvent[], String, Component, Consumer)} (to be removed in IDEA 16) */ + @SuppressWarnings({"deprecation", "unused"}) + public SubmittedReportInfo submit(IdeaLoggingEvent[] events, Component parent) { + throw new UnsupportedOperationException("Deprecated API called"); + } } diff --git a/platform/platform-api/src/com/intellij/openapi/diagnostic/SubmittedReportInfo.java b/platform/platform-api/src/com/intellij/openapi/diagnostic/SubmittedReportInfo.java index 6bad8c45df93..8ead30567681 100644 --- a/platform/platform-api/src/com/intellij/openapi/diagnostic/SubmittedReportInfo.java +++ b/platform/platform-api/src/com/intellij/openapi/diagnostic/SubmittedReportInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,9 @@ */ package com.intellij.openapi.diagnostic; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + /** * Simple bean representing error submission status. */ @@ -31,29 +34,27 @@ public class SubmittedReportInfo { DUPLICATE, /** - * Submission failed. (For network connection reasons for example) + * Submission failed (e.g. because of network problem) */ FAILED } - private final String myURL; + private final String myUrl; private final String myLinkText; private final SubmissionStatus myStatus; - /** - * Create new submission status bean - * @param URL url that points to newly created issue. Optional. Pass <code>null</code> value if N/A or failed - * @param linkText short text that UI interface pointing to the issue should have. - * @param status submission success/failure - */ - public SubmittedReportInfo(final String URL, final String linkText, final SubmissionStatus status) { - myURL = URL; + public SubmittedReportInfo(SubmissionStatus status) { + this(null, null, status); + } + + public SubmittedReportInfo(@Nullable String url, @Nullable String linkText, @NotNull SubmissionStatus status) { + myUrl = url; myLinkText = linkText; myStatus = status; } public String getURL() { - return myURL; + return myUrl; } public String getLinkText() { |