fix once and forever accidental deleting by backspace while editing speed search pattern

This commit is contained in:
Konstantin Bulenkov
2014-09-07 12:47:29 +04:00
parent 45b7f2a9bc
commit e388646cc8
@@ -55,6 +55,7 @@ import com.intellij.ui.ComponentWithMnemonics;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.components.JBOptionButton;
import com.intellij.ui.popup.list.ListPopupImpl;
import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.Alarm;
import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
@@ -140,6 +141,10 @@ public final class IdeKeyEventDispatcher implements Disposable {
return false;
}
if (isSpeedSearchEditing(e)) {
return false;
}
// http://www.jetbrains.net/jira/browse/IDEADEV-12372
if (e.getKeyCode() == KeyEvent.VK_CONTROL) {
if (e.getID() == KeyEvent.KEY_PRESSED) {
@@ -226,6 +231,18 @@ public final class IdeKeyEventDispatcher implements Disposable {
}
}
private static boolean isSpeedSearchEditing(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_BACK_SPACE) {
Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (owner instanceof JComponent) {
SpeedSearchSupply supply = SpeedSearchSupply.getSupply((JComponent)owner);
return supply != null && supply.isPopupActive();
}
}
return false;
}
/**
* @return <code>true</code> if and only if the <code>component</code> represents
* modal context.