From c6f72e8329ac247fafa508bfcdf02678e473fc37 Mon Sep 17 00:00:00 2001 From: Eldar Abusalimov Date: Thu, 17 Nov 2016 15:16:43 +0300 Subject: [PATCH] notifications: Only propagate ACTIVATE events to HyperlinkListener Don't react to hover events (ENTERED/EXITED) since this is hardly desired behaviour for a hyperlink inside an error balloon, not to say it is error prone. --- .../src/com/intellij/execution/runners/ExecutionUtil.java | 6 ++---- .../src/com/intellij/xdebugger/impl/XDebugSessionImpl.java | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java b/platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java index f31feeb12049..9da721f92bb3 100644 --- a/platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java +++ b/platform/lang-api/src/com/intellij/execution/runners/ExecutionUtil.java @@ -23,7 +23,6 @@ import com.intellij.execution.process.ProcessNotCreatedException; import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.ide.DataManager; import com.intellij.ide.util.PropertiesComponent; -import com.intellij.notification.Notification; import com.intellij.notification.NotificationGroup; import com.intellij.notification.NotificationListener; import com.intellij.notification.NotificationType; @@ -130,9 +129,8 @@ public class ExecutionUtil { else { Messages.showErrorDialog(project, UIUtil.toHtml(fullMessage), ""); } - NotificationListener notificationListener = finalListener == null ? null : new NotificationListener() { - @Override - public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { + NotificationListener notificationListener = finalListener == null ? null : (notification, event) -> { + if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { finalListener.hyperlinkUpdate(event); } }; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java index 23d98a492b9b..05f0dfb59792 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -73,6 +73,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; @@ -935,7 +936,11 @@ public class XDebugSessionImpl implements XDebugSession { @Override public void reportMessage(@NotNull final String message, @NotNull final MessageType type, @Nullable final HyperlinkListener listener) { - NotificationListener notificationListener = listener == null ? null : (notification, event) -> listener.hyperlinkUpdate(event); + NotificationListener notificationListener = listener == null ? null : (notification, event) -> { + if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + listener.hyperlinkUpdate(event); + } + }; NOTIFICATION_GROUP.createNotification("", message, type.toNotificationType(), notificationListener).notify(myProject); } -- 2.23.3