Changeset 8267 in josm for trunk/src


Ignore:
Timestamp:
2015-04-25T19:33:39+02:00 (5 years ago)
Author:
simon04
Message:

fix #10720 - Auto completion changing default values in presets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java

    r8005 r8267  
    88import java.awt.event.KeyEvent;
    99import java.util.EventObject;
     10import java.util.Objects;
    1011
    1112import javax.swing.ComboBoxEditor;
     
    9596            String prefix = currentText.substring(0, offs);
    9697            autoCompletionList.applyFilter(prefix+str);
    97             if (autoCompletionList.getFilteredSize()>0) {
     98            if (autoCompletionList.getFilteredSize() > 0 && !Objects.equals(str, noAutoCompletionString)) {
    9899                // there are matches. Insert the new text and highlight the
    99100                // auto completed suffix
     
    120121    /** the auto completion list user input is matched against */
    121122    protected AutoCompletionList autoCompletionList = null;
     123    /** a string which should not be auto completed */
     124    protected String noAutoCompletionString = null;
    122125
    123126    @Override
     
    219222    }
    220223
     224    @Override
     225    public void setText(String t) {
     226        // disallow auto completion for this explicitly set string
     227        this.noAutoCompletionString = t;
     228        super.setText(t);
     229    }
     230
    221231    /**
    222232     * Sets the maximum number of characters allowed.
Note: See TracChangeset for help on using the changeset viewer.