diff --git a/platform/platform-api/src/com/intellij/notification/NotificationListener.java b/platform/platform-api/src/com/intellij/notification/NotificationListener.java index 315bad361474..8577d7d6a469 100644 --- a/platform/platform-api/src/com/intellij/notification/NotificationListener.java +++ b/platform/platform-api/src/com/intellij/notification/NotificationListener.java @@ -35,7 +35,15 @@ public interface NotificationListener { protected abstract void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e); } - NotificationListener URL_OPENING_LISTENER = new Adapter() { + NotificationListener URL_OPENING_LISTENER = new UrlOpeningListener(false); + + class UrlOpeningListener extends Adapter { + private final boolean myExpireNotification; + + public UrlOpeningListener(boolean expireNotification) { + myExpireNotification = expireNotification; + } + @Override protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) { URL url = event.getURL(); @@ -45,6 +53,9 @@ public interface NotificationListener { else { BrowserUtil.browse(url); } + if (myExpireNotification) { + notification.expire(); + } } - }; + } } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/diagnostic/ITNReporter.java b/platform/platform-impl/src/com/intellij/diagnostic/ITNReporter.java index e5ff464b6a47..a3a968c2d011 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/ITNReporter.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/ITNReporter.java @@ -21,12 +21,10 @@ import com.intellij.errorreport.bean.ErrorBean; import com.intellij.errorreport.error.InternalEAPException; import com.intellij.errorreport.error.NoSuchEAPUserException; import com.intellij.errorreport.error.UpdateAvailableException; -import com.intellij.ide.BrowserUtil; import com.intellij.ide.DataManager; import com.intellij.ide.plugins.IdeaPluginDescriptor; import com.intellij.ide.plugins.PluginManager; import com.intellij.idea.IdeaLogger; -import com.intellij.notification.Notification; import com.intellij.notification.NotificationListener; import com.intellij.notification.NotificationType; import com.intellij.openapi.actionSystem.DataContext; @@ -41,10 +39,8 @@ import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.Consumer; import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; import javax.swing.*; -import javax.swing.event.HyperlinkEvent; import java.awt.*; /** @@ -171,13 +167,7 @@ public class ITNReporter extends ErrorReportSubmitter { NotificationType type = reportInfo.getStatus() == SubmittedReportInfo.SubmissionStatus.FAILED ? NotificationType.ERROR : NotificationType.INFORMATION; - NotificationListener listener = url != null ? new NotificationListener() { - @Override - public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { - BrowserUtil.launchBrowser(url); - notification.expire(); - } - } : null; + NotificationListener listener = url != null ? new NotificationListener.UrlOpeningListener(true) : null; ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT, text.toString(), type, listener).setImportant(false).notify(project);