mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-217470: Next enabled option will be selected if disabled one was called from keyboard
GitOrigin-RevId: f913dfef416f7a0b0e3213e5ce782289c44e9aa8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e22d646ca5
commit
2dc3bd923c
@@ -137,7 +137,7 @@ public class ListPopupImpl extends WizardPopup implements ListPopup, NextStepHan
|
||||
}
|
||||
else {
|
||||
final int defaultIndex = listStep.getDefaultOptionIndex();
|
||||
if (defaultIndex >= 0 && defaultIndex < myList.getModel().getSize()) {
|
||||
if (isSelectableAt(defaultIndex)) {
|
||||
ScrollingUtil.selectItem(myList, defaultIndex);
|
||||
selected = true;
|
||||
}
|
||||
@@ -170,6 +170,7 @@ public class ListPopupImpl extends WizardPopup implements ListPopup, NextStepHan
|
||||
int elementsCount = myListModel.getSize();
|
||||
for (int i = 0; i < elementsCount; i++) {
|
||||
Object value = myListModel.getElementAt(i);
|
||||
if (!isSelectable(value)) continue;
|
||||
final String text = getListStep().getTextFor(value);
|
||||
final int count =
|
||||
StatisticsManager.getInstance().getUseCount(new StatisticsInfo("#list_popup:" + myStep.getTitle() + "#" + filter, text));
|
||||
@@ -482,7 +483,7 @@ public class ListPopupImpl extends WizardPopup implements ListPopup, NextStepHan
|
||||
Point point = e.getPoint();
|
||||
int index = myList.locationToIndex(point);
|
||||
|
||||
if (index != myLastSelectedIndex) {
|
||||
if (index != myLastSelectedIndex && isSelectableAt(index)) {
|
||||
if (!isMultiSelectionEnabled() || !UIUtil.isSelectionButtonDown(e) && myList.getSelectedIndices().length <= 1) {
|
||||
myList.setSelectedIndex(index);
|
||||
}
|
||||
@@ -627,18 +628,18 @@ public class ListPopupImpl extends WizardPopup implements ListPopup, NextStepHan
|
||||
|
||||
private void selectBestMatch() {
|
||||
int fullMatchIndex = myListModel.getClosestMatchIndex();
|
||||
if (fullMatchIndex != -1) {
|
||||
if (fullMatchIndex != -1 && isSelectableAt(fullMatchIndex)) {
|
||||
myList.setSelectedIndex(fullMatchIndex);
|
||||
}
|
||||
|
||||
if (myListModel.getSize() <= myList.getSelectedIndex() || !myListModel.isVisible(myList.getSelectedValue())) {
|
||||
myList.setSelectedIndex(0);
|
||||
selectFirstSelectableItem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSelectByMnemonic(Object value) {
|
||||
if (myListModel.isVisible(value)) {
|
||||
if (myListModel.isVisible(value) && isSelectable(value)) {
|
||||
myList.setSelectedValue(value, true);
|
||||
myList.repaint();
|
||||
handleSelect(true);
|
||||
@@ -652,7 +653,7 @@ public class ListPopupImpl extends WizardPopup implements ListPopup, NextStepHan
|
||||
|
||||
@Override
|
||||
protected void onChildSelectedFor(Object value) {
|
||||
if (myList.getSelectedValue() != value) {
|
||||
if (myList.getSelectedValue() != value && isSelectable(value)) {
|
||||
myList.setSelectedValue(value, false);
|
||||
}
|
||||
}
|
||||
@@ -691,4 +692,21 @@ public class ListPopupImpl extends WizardPopup implements ListPopup, NextStepHan
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSelectable(@Nullable Object value) {
|
||||
return value != null && getListStep().isSelectable(value);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Object getSelectableAt(int index) {
|
||||
if (0 <= index && index < myListModel.getSize()) {
|
||||
Object value = myListModel.getElementAt(index);
|
||||
if (isSelectable(value)) return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isSelectableAt(int index) {
|
||||
return null != getSelectableAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user