Changeset 3891 in josm for trunk/src/org
- Timestamp:
- 2011-02-11T23:17:33+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
r3866 r3891 85 85 } 86 86 87 // the string being inserted might be a "full" string from the list88 // of valid completions (instanceof AutoCompletionListItem), or a89 // "partial" string being typed (instanceof String).90 Object item = comboBox.getSelectedItem();91 if (item != null && (item instanceof String || !curText.equals(((AutoCompletionListItem) item).getValue()))) {92 // only in the latter case do we have to93 87 // lookup and select a matching item 94 88 Object item = lookupItem(curText); 95 89 setSelectedItem(item); 96 }97 90 if (initial) { 98 91 start = 0; … … 121 114 } 122 115 123 private AutoCompletionListItemlookupItem(String pattern) {116 private Object lookupItem(String pattern) { 124 117 ComboBoxModel model = comboBox.getModel(); 125 118 AutoCompletionListItem bestItem = null; 126 119 for (int i = 0, n = model.getSize(); i < n; i++) { 127 120 AutoCompletionListItem currentItem = (AutoCompletionListItem) model.getElementAt(i); 121 if (currentItem.getValue().equals(pattern)) { 122 return currentItem; 123 } 128 124 if (currentItem.getValue().startsWith(pattern)) { 129 125 if (bestItem == null || currentItem.getPriority().compareTo(bestItem.getPriority()) > 0) {
Note:
See TracChangeset
for help on using the changeset viewer.