Changeset 13190 in josm


Ignore:
Timestamp:
2017-12-03T18:09:08+01:00 (2 weeks ago)
Author:
Don-vip
Message:

fix #15627 - autocompletion values not correctly reset on change of focus (regression from r13139)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r13139 r13190  
    4343import javax.swing.Box;
    4444import javax.swing.ButtonGroup;
     45import javax.swing.ComboBoxModel;
    4546import javax.swing.DefaultListCellRenderer;
    4647import javax.swing.ImageIcon;
     
    637638                   Logging.trace("Focus gained by {0}, e={1}", values, e);
    638639                   String key = keys.getEditor().getItem().toString();
     640                   List<AutoCompletionItem> correctItems = autocomplete.getTagValues(getAutocompletionKeys(key), comparator);
     641                   ComboBoxModel<AutoCompletionItem> currentModel = values.getModel();
     642                   final int size = correctItems.size();
     643                   boolean valuesOK = size == currentModel.getSize();
     644                   for (int i = 0; valuesOK && i < size; i++) {
     645                       valuesOK = Objects.equals(currentModel.getElementAt(i), correctItems.get(i));
     646                   }
     647                   if (!valuesOK) {
     648                       values.setPossibleAcItems(correctItems);
     649                   }
    639650                   if (!Objects.equals(key, objKey)) {
    640                        values.setPossibleAcItems(autocomplete.getTagValues(getAutocompletionKeys(key), comparator));
    641651                       values.getEditor().selectAll();
    642652                       objKey = key;
Note: See TracChangeset for help on using the changeset viewer.