From 6877760adfd017f7a600eab709cef3aa6e150ca3 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 31 Mar 2017 13:29:32 +0300 Subject: [PATCH] IDEA-160885 "Quick evaluate expression" responds quite slowly --- .../xdebugger/impl/evaluate/quick/XValueHint.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java index 1ed74cb299be..ba61acf15859 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XValueHint.java @@ -68,6 +68,7 @@ import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; /** * @author nik @@ -162,8 +163,9 @@ public class XValueHint extends AbstractValueHint { @Override protected void evaluateAndShowHint() { + AtomicBoolean showEvaluating = new AtomicBoolean(true); EdtExecutorService.getScheduledExecutorInstance().schedule(() -> { - if (myCurrentHint == null) { + if (myCurrentHint == null && showEvaluating.get()) { SimpleColoredComponent component = HintUtil.createInformationComponent(); component.append(XDebuggerUIConstants.EVALUATING_EXPRESSION_MESSAGE); showHint(component); @@ -181,6 +183,7 @@ public class XValueHint extends AbstractValueHint { public void applyPresentation(@Nullable Icon icon, @NotNull XValuePresentation valuePresenter, boolean hasChildren) { + showEvaluating.set(false); if (isHintHidden()) { return; } @@ -230,6 +233,10 @@ public class XValueHint extends AbstractValueHint { @Override public void errorOccurred(@NotNull final String errorMessage) { + showEvaluating.set(false); + if (myCurrentHint != null) { + myCurrentHint.hide(); + } if (getType() == ValueHintType.MOUSE_CLICK_HINT) { ApplicationManager.getApplication().invokeLater(() -> showHint(HintUtil.createErrorLabel(errorMessage))); }