IDEA-145015 Quick evaluate expression (ctrl+alt+8) instruction is silently ignored when an attempt is made to evaluate the same expression a second time.

This commit is contained in:
Egor.Ushakov
2015-09-14 13:53:12 +03:00
parent e823b339cb
commit 28f5b261f9
2 changed files with 23 additions and 5 deletions
@@ -299,7 +299,7 @@ public abstract class AbstractValueHint {
}
protected <D> void showTreePopup(@NotNull DebuggerTreeCreator<D> creator, @NotNull D descriptor) {
DebuggerTreeWithHistoryPopup.showTreePopup(creator, descriptor, getEditor(), myPoint, getProject());
DebuggerTreeWithHistoryPopup.showTreePopup(creator, descriptor, getEditor(), myPoint, getProject(), myHideRunnable);
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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,7 +18,9 @@ package com.intellij.xdebugger.impl.evaluate.quick.common;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupAdapter;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.LightweightWindowEvent;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.ScreenUtil;
@@ -30,6 +32,7 @@ import com.intellij.util.BooleanFunction;
import com.intellij.util.ui.tree.TreeModelAdapter;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.TreeModelEvent;
@@ -46,16 +49,23 @@ class DebuggerTreeWithHistoryPopup<D> extends DebuggerTreeWithHistoryContainer<D
private JBPopup myPopup;
private final Editor myEditor;
private final Point myPoint;
@Nullable private final Runnable myHideRunnable;
private DebuggerTreeWithHistoryPopup(@NotNull D initialItem, @NotNull DebuggerTreeCreator<D> creator, @NotNull Editor editor, @NotNull Point point, @NotNull Project project) {
private DebuggerTreeWithHistoryPopup(@NotNull D initialItem,
@NotNull DebuggerTreeCreator<D> creator,
@NotNull Editor editor,
@NotNull Point point,
@NotNull Project project,
@Nullable Runnable hideRunnable) {
super(initialItem, creator, project);
myEditor = editor;
myPoint = point;
myHideRunnable = hideRunnable;
}
public static <D> void showTreePopup(@NotNull DebuggerTreeCreator<D> creator, @NotNull D initialItem, @NotNull Editor editor,
@NotNull Point point, @NotNull Project project) {
new DebuggerTreeWithHistoryPopup<D>(initialItem, creator, editor, point, project).updateTree(initialItem);
@NotNull Point point, @NotNull Project project, Runnable hideRunnable) {
new DebuggerTreeWithHistoryPopup<D>(initialItem, creator, editor, point, project, hideRunnable).updateTree(initialItem);
}
private TreeModelListener createTreeListener(final Tree tree) {
@@ -91,6 +101,14 @@ class DebuggerTreeWithHistoryPopup<D> extends DebuggerTreeWithHistoryContainer<D
return false;
}
})
.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (myHideRunnable != null) {
myHideRunnable.run();
}
}
})
.setCancelCallback(new Computable<Boolean>() {
@Override
public Boolean compute() {