001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.tagging.ac;
003
004import org.openstreetmap.josm.gui.widgets.JosmComboBoxEditor;
005
006/**
007 * A {@link javax.swing.ComboBoxEditor} that uses an {@link AutoCompTextField}.
008 * <p>
009 * This lets us stick an {@code AutoCompTextField} into a {@link javax.swing.JComboBox}.  This is not
010 * used for {@link AutoCompComboBox}.
011 *
012 * @param <E> the type of the items in the editor
013 * @since 18221
014 */
015public class AutoCompComboBoxEditor<E> extends JosmComboBoxEditor {
016
017    @Override
018    protected AutoCompTextField<E> createEditorComponent() {
019        return new AutoCompTextField<>();
020    }
021
022    @Override
023    @SuppressWarnings("unchecked")
024    public AutoCompTextField<E> getEditorComponent() {
025        // this cast holds unless somebody overrides createEditorComponent()
026        return (AutoCompTextField<E>) editor;
027    }
028}