Changeset 4576 in josm for trunk


Ignore:
Timestamp:
2011-11-05T16:56:37+01:00 (12 years ago)
Author:
Don-vip
Message:

fix #7026 - autocompletion stopped working for changeset comments

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
1 deleted
1 edited

Legend:

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

    r4508 r4576  
    1414import javax.swing.JList;
    1515import javax.swing.ListCellRenderer;
    16 import javax.swing.text.AbstractDocument;
    1716import javax.swing.text.AttributeSet;
    1817import javax.swing.text.BadLocationException;
     
    2221
    2322import org.openstreetmap.josm.Main;
    24 import org.openstreetmap.josm.gui.DocumentSizeFilter;
    2523
    2624/**
     
    3028
    3129    private boolean autocompleteEnabled = true;
     30   
     31    private int maxTextLength = -1;
    3232
    3333    /**
     
    5353            if (selecting || (offs == 0 && str.equals(getText(0, getLength()))))
    5454                return;
     55            if (maxTextLength > -1 && str.length()+getLength() > maxTextLength) {
     56                return;
     57            }
    5558            boolean initial = (offs == 0 && getLength() == 0 && str.length() > 1);
    5659            super.insertString(offs, str, a);
     
    154157    public void setMaxTextLength(int length)
    155158    {
    156         JTextComponent editor = (JTextComponent) this.getEditor().getEditorComponent();
    157         AbstractDocument doc = (AbstractDocument) editor.getDocument();
    158         doc.setDocumentFilter(new DocumentSizeFilter(length));
     159        this.maxTextLength = length;
    159160    }
    160161
Note: See TracChangeset for help on using the changeset viewer.