Changeset 15837 in josm


Ignore:
Timestamp:
2020-02-10T22:58:07+01:00 (2 weeks ago)
Author:
simon04
Message:

AutoCompletingComboBoxDocument: no need for separate comboBox field

File:
1 edited

Legend:

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

    r15835 r15837  
    9292     */
    9393    class AutoCompletingComboBoxDocument extends PlainDocument {
    94         private final JosmComboBox<AutoCompletionItem> comboBox;
    9594        private boolean selecting;
    96 
    97         /**
    98          * Constructs a new {@code AutoCompletingComboBoxDocument}.
    99          * @param comboBox the combobox
    100          */
    101         AutoCompletingComboBoxDocument(final JosmComboBox<AutoCompletionItem> comboBox) {
    102             this.comboBox = comboBox;
    103         }
    10495
    10596        @Override
     
    181172                }
    182173            }
    183             final JTextComponent editorComponent = comboBox.getEditorComponent();
     174            final JTextComponent editorComponent = getEditorComponent();
    184175            // save unix system selection (middle mouse paste)
    185176            Clipboard sysSel = ClipboardUtils.getSystemSelection();
     
    197188        private void setSelectedItem(Object item) {
    198189            selecting = true;
    199             comboBox.setSelectedItem(item);
     190            AutoCompletingComboBox.this.setSelectedItem(item);
    200191            selecting = false;
    201192        }
    202193
    203194        private Object lookupItem(String pattern, boolean match) {
    204             ComboBoxModel<AutoCompletionItem> model = comboBox.getModel();
     195            ComboBoxModel<AutoCompletionItem> model = getModel();
    205196            AutoCompletionItem bestItem = null;
    206197            for (int i = 0, n = model.getSize(); i < n; i++) {
     
    234225        setRenderer(new AutoCompleteListCellRenderer());
    235226        final JTextComponent editorComponent = this.getEditorComponent();
    236         editorComponent.setDocument(new AutoCompletingComboBoxDocument(this));
     227        editorComponent.setDocument(new AutoCompletingComboBoxDocument());
    237228        editorComponent.addFocusListener(new InnerFocusListener(editorComponent));
    238229    }
Note: See TracChangeset for help on using the changeset viewer.