private volatile boolean myListIsUpToDate = false;
private boolean myDisposedFlag = false;
- private ActionCallback myPosponedOkAction;
+ private ActionCallback myPostponedOkAction;
private final String[][] myNames = new String[2][];
private CalcElementsThread myCalcElementsThread;
private String myFindUsagesTitle;
public boolean checkDisposed() {
- if (myDisposedFlag && myPosponedOkAction != null && !myPosponedOkAction.isProcessed()) {
- myPosponedOkAction.setRejected();
+ if (myDisposedFlag && myPostponedOkAction != null && !myPostponedOkAction.isProcessed()) {
+ myPostponedOkAction.setRejected();
}
return myDisposedFlag;
final String text = myTextField.getText();
if (ok && !myListIsUpToDate && text != null && text.trim().length() > 0) {
- myPosponedOkAction = new ActionCallback();
- IdeFocusManager.getInstance(myProject).typeAheadUntil(myPosponedOkAction);
+ myPostponedOkAction = new ActionCallback();
+ IdeFocusManager.getInstance(myProject).typeAheadUntil(myPostponedOkAction);
return true;
}
}
private void doPostponedOkIfNeeded() {
- if (myPosponedOkAction != null) {
+ if (myPostponedOkAction != null) {
if (getChosenElement() != null) {
doClose(true);
}
}
private void clearPosponedOkAction(boolean success) {
- if (myPosponedOkAction != null) {
+ if (myPostponedOkAction != null) {
if (success) {
- myPosponedOkAction.setDone();
+ myPostponedOkAction.setDone();
}
else {
- myPosponedOkAction.setRejected();
+ myPostponedOkAction.setRejected();
}
}
- myPosponedOkAction = null;
+ myPostponedOkAction = null;
}
protected abstract void showList();
private boolean myMayRequestCurrentWindow;
protected ChooseByNamePopup(final Project project, final ChooseByNameModel model, ChooseByNameItemProvider provider, final ChooseByNamePopup oldPopup,
- @Nullable final String predefinedText, boolean mayRequestOpenInCurrentWundow, int initialIndex) {
+ @Nullable final String predefinedText, boolean mayRequestOpenInCurrentWindow, int initialIndex) {
super(project, model, provider, oldPopup != null ? oldPopup.getEnteredText() : predefinedText, initialIndex);
if (oldPopup == null && predefinedText != null) {
setPreselectInitialText(true);
if (oldPopup != null) { //inherit old focus owner
myOldFocusOwner = oldPopup.myPreviouslyFocusedComponent;
}
- myMayRequestCurrentWindow = mayRequestOpenInCurrentWundow;
+ myMayRequestCurrentWindow = mayRequestOpenInCurrentWindow;
}
public String getEnteredText() {
preferredScrollPaneSize.width = Math.max(myTextFieldPanel.getWidth(), preferredScrollPaneSize.width);
- Rectangle prefferedBounds = new Rectangle(bounds.x, bounds.y, preferredScrollPaneSize.width, preferredScrollPaneSize.height);
- Rectangle original = new Rectangle(prefferedBounds);
+ Rectangle preferredBounds = new Rectangle(bounds.x, bounds.y, preferredScrollPaneSize.width, preferredScrollPaneSize.height);
+ Rectangle original = new Rectangle(preferredBounds);
- ScreenUtil.fitToScreen(prefferedBounds);
- if (original.width > prefferedBounds.width) {
+ ScreenUtil.fitToScreen(preferredBounds);
+ if (original.width > preferredBounds.width) {
int height = myListScrollPane.getHorizontalScrollBar().getPreferredSize().height;
- prefferedBounds.height += height;
+ preferredBounds.height += height;
}
myListScrollPane.setVisible(true);
}
});
myDropdownPopup = builder.createPopup();
- myDropdownPopup.setLocation(prefferedBounds.getLocation());
- myDropdownPopup.setSize(prefferedBounds.getSize());
+ myDropdownPopup.setLocation(preferredBounds.getLocation());
+ myDropdownPopup.setSize(preferredBounds.getSize());
myDropdownPopup.show(layeredPane);
} else {
- myDropdownPopup.setLocation(prefferedBounds.getLocation());
- myDropdownPopup.setSize(prefferedBounds.getSize());
+ myDropdownPopup.setLocation(preferredBounds.getLocation());
+
+ // in 'focus follows mouse' mode, to avoid focus escaping to editor, don't reduce popup size when list size is reduced
+ final Dimension currentSize = myDropdownPopup.getSize();
+ if (UISettings.getInstance().HIDE_NAVIGATION_ON_FOCUS_LOSS ||
+ preferredBounds.width > currentSize.width || preferredBounds.height > currentSize.height) {
+ myDropdownPopup.setSize(preferredBounds.getSize());
+ }
}
}