source: josm/trunk/src/org/openstreetmap/josm/gui/widgets/HistoryComboBox.java@ 3210

Last change on this file since 3210 was 3210, checked in by bastiK, 14 years ago

autocompletion rework; breaks tageditor plugin and possibly other plugins
(merged the 2 autocompletion systems; adds presets values for the properties dialog )

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.widgets;
3
4import java.util.List;
5
6import javax.swing.text.JTextComponent;
7
8import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox;
9
10public class HistoryComboBox extends AutoCompletingComboBox {
11 private ComboBoxHistory model;
12
13 public HistoryComboBox() {
14 setModel(model = new ComboBoxHistory(15));
15 setEditable(true);
16 }
17
18 public String getText() {
19 return ((JTextComponent)getEditor().getEditorComponent()).getText();
20 }
21
22 public void setText(String value) {
23 setAutocompleteEnabled(false);
24 ((JTextComponent)getEditor().getEditorComponent()).setText(value);
25 setAutocompleteEnabled(true);
26 }
27
28 public void addCurrentItemToHistory() {
29 String regex = (String)getEditor().getItem();
30 model.addElement(regex);
31 }
32
33 public void setHistory(List<String> history) {
34 model.setItems(history);
35 }
36
37 public List<String> getHistory() {
38 return model.asList();
39 }
40}
Note: See TracBrowser for help on using the repository browser.