close choose by name popup by Shift-Enter, allow to check if it was closed this way

This commit is contained in:
Dmitry Jemerov
2011-02-03 16:35:10 +01:00
parent e21eea82cf
commit b7531d3cfd
@@ -127,6 +127,8 @@ public abstract class ChooseByNameBase {
protected JBPopup myTextPopup;
protected JBPopup myDropdownPopup;
private boolean myClosedByShiftEnter = false;
private static class MatchesComparator implements Comparator<String> {
private final String myOriginalPattern;
@@ -175,6 +177,10 @@ public abstract class ChooseByNameBase {
mySearchInAnyPlace = searchInAnyPlace;
}
public boolean isClosedByShiftEnter() {
return myClosedByShiftEnter;
}
/**
* Set tool area. The method may be called only before invoke.
*
@@ -419,6 +425,10 @@ public abstract class ChooseByNameBase {
myTextField.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER && (e.getModifiers() & KeyEvent.SHIFT_MASK) != 0) {
myClosedByShiftEnter = true;
close(true);
}
if (!myListScrollPane.isVisible()) {
return;
}