mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't reduce popup size when number of items is reduced (IDEA-61092 try #2)
This commit is contained in:
@@ -118,7 +118,7 @@ public abstract class ChooseByNameBase {
|
||||
|
||||
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;
|
||||
@@ -141,8 +141,8 @@ public abstract class ChooseByNameBase {
|
||||
private String myFindUsagesTitle;
|
||||
|
||||
public boolean checkDisposed() {
|
||||
if (myDisposedFlag && myPosponedOkAction != null && !myPosponedOkAction.isProcessed()) {
|
||||
myPosponedOkAction.setRejected();
|
||||
if (myDisposedFlag && myPostponedOkAction != null && !myPostponedOkAction.isProcessed()) {
|
||||
myPostponedOkAction.setRejected();
|
||||
}
|
||||
|
||||
return myDisposedFlag;
|
||||
@@ -679,8 +679,8 @@ public abstract class ChooseByNameBase {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1067,7 +1067,7 @@ public abstract class ChooseByNameBase {
|
||||
}
|
||||
|
||||
private void doPostponedOkIfNeeded() {
|
||||
if (myPosponedOkAction != null) {
|
||||
if (myPostponedOkAction != null) {
|
||||
if (getChosenElement() != null) {
|
||||
doClose(true);
|
||||
}
|
||||
@@ -1077,16 +1077,16 @@ public abstract class ChooseByNameBase {
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
|
||||
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);
|
||||
@@ -56,7 +56,7 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
|
||||
if (oldPopup != null) { //inherit old focus owner
|
||||
myOldFocusOwner = oldPopup.myPreviouslyFocusedComponent;
|
||||
}
|
||||
myMayRequestCurrentWindow = mayRequestOpenInCurrentWundow;
|
||||
myMayRequestCurrentWindow = mayRequestOpenInCurrentWindow;
|
||||
}
|
||||
|
||||
public String getEnteredText() {
|
||||
@@ -113,13 +113,13 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
|
||||
|
||||
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);
|
||||
@@ -136,12 +136,18 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
|
||||
}
|
||||
});
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user