- Timestamp:
- 2019-04-21T18:06:48+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r14397 r15011 12 12 import java.util.Collection; 13 13 import java.util.Collections; 14 import java.util.LinkedList;15 14 import java.util.List; 16 15 import java.util.Objects; … … 110 109 */ 111 110 protected void restoreUploadAddressHistory(HistoryComboBox cbHistory) { 112 List<String> cmtHistory = new LinkedList<>(Config.getPref().getList(getClass().getName() + ".uploadAddressHistory", 113 new LinkedList<String>())); 114 // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 115 // 116 Collections.reverse(cmtHistory); 117 cbHistory.setPossibleItems(cmtHistory); 111 cbHistory.setPossibleItemsTopDown(Config.getPref().getList(getClass().getName() + ".uploadAddressHistory", 112 Collections.emptyList())); 118 113 } 119 114 -
trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java
r14656 r15011 8 8 import java.awt.event.ActionEvent; 9 9 import java.util.Collections; 10 import java.util.LinkedList;11 import java.util.List;12 10 import java.util.Optional; 13 11 … … 43 41 public void actionPerformed(ActionEvent e) { 44 42 HistoryComboBox searchTermBox = new HistoryComboBox(); 45 List<String> searchHistory = new LinkedList<>(Config.getPref().getList(HISTORY_KEY, new LinkedList<String>())); 46 Collections.reverse(searchHistory); 47 searchTermBox.setPossibleItems(searchHistory); 43 searchTermBox.setPossibleItemsTopDown(Config.getPref().getList(HISTORY_KEY, Collections.emptyList())); 48 44 49 45 JPanel contentPanel = new JPanel(new GridBagLayout()); -
trunk/src/org/openstreetmap/josm/gui/dialogs/OsmIdSelectionDialog.java
r14674 r15011 14 14 import java.util.Collections; 15 15 import java.util.EnumSet; 16 import java.util.LinkedList;17 16 import java.util.List; 18 17 import java.util.stream.Collectors; … … 180 179 */ 181 180 protected void restorePrimitivesHistory(HistoryComboBox cbHistory) { 182 List<String> cmtHistory = new LinkedList<>( 183 Config.getPref().getList(getClass().getName() + ".primitivesHistory", new LinkedList<String>())); 184 // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 185 Collections.reverse(cmtHistory); 186 cbHistory.setPossibleItems(cmtHistory); 181 cbHistory.setPossibleItemsTopDown( 182 Config.getPref().getList(getClass().getName() + ".primitivesHistory", Collections.emptyList())); 187 183 } 188 184 -
trunk/src/org/openstreetmap/josm/gui/download/OverpassQueryWizardDialog.java
r14325 r15011 95 95 queryWizard.setText(items.get(0)); 96 96 } 97 // HistoryComboBox needs the reversed list 98 Collections.reverse(items); 99 queryWizard.setPossibleItems(items); 97 queryWizard.setPossibleItemsTopDown(items); 100 98 101 99 setCancelButton(CANCEL + 1); -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r14273 r15011 18 18 import java.util.ArrayList; 19 19 import java.util.Collections; 20 import java.util.LinkedList;21 20 import java.util.List; 22 21 import java.util.StringTokenizer; … … 115 114 cbSearchExpression = new HistoryComboBox(); 116 115 cbSearchExpression.setToolTipText(tr("Enter a place name to search for")); 117 List<String> cmtHistory = new LinkedList<>(Config.getPref().getList(HISTORY_KEY, new LinkedList<String>())); 118 Collections.reverse(cmtHistory); 119 cbSearchExpression.setPossibleItems(cmtHistory); 116 cbSearchExpression.setPossibleItemsTopDown(Config.getPref().getList(HISTORY_KEY, Collections.emptyList())); 120 117 lpanel.add(cbSearchExpression); 121 118 -
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r14977 r15011 14 14 import java.awt.event.KeyEvent; 15 15 import java.util.Arrays; 16 import java.util.Collections;17 16 import java.util.LinkedList; 18 17 import java.util.List; … … 114 113 115 114 private static void populateHistoryComboBox(HistoryComboBox hcb, String historyKey, List<String> defaultValues) { 116 List<String> cmtHistory = new LinkedList<>(Config.getPref().getList(historyKey, defaultValues)); 117 Collections.reverse(cmtHistory); // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 118 hcb.setPossibleItems(cmtHistory); 115 hcb.setPossibleItemsTopDown(Config.getPref().getList(historyKey, defaultValues)); 119 116 hcb.discardAllUndoableEdits(); 120 117 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java
r12859 r15011 11 11 import java.util.Collection; 12 12 import java.util.Collections; 13 import java.util.LinkedList;14 13 import java.util.List; 15 14 … … 75 74 "+proj=lonlat +ellps=WGS84 +datum=WGS84 +bounds=-180,-90,180,90", 76 75 "+proj=tmerc +lat_0=0 +lon_0=9 +k_0=1 +x_0=3500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb"); 77 List<String> inputHistory = new LinkedList<>(Config.getPref().getList("projection.custom.value.history", samples)); 78 Collections.reverse(inputHistory); 79 cbInput.setPossibleItems(inputHistory); 76 cbInput.setPossibleItemsTopDown(Config.getPref().getList("projection.custom.value.history", samples)); 80 77 cbInput.setText(initialText == null ? "" : initialText); 81 78 -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
r13573 r15011 9 9 import java.awt.im.InputContext; 10 10 import java.util.Collection; 11 import java.util.Collections; 12 import java.util.LinkedList; 11 13 import java.util.Locale; 12 14 … … 288 290 289 291 /** 290 * Sets the items of the combobox to the given {@code String}s .292 * Sets the items of the combobox to the given {@code String}s in reversed order (last element first). 291 293 * @param elems String items 292 294 */ … … 298 300 model.addElement(new AutoCompletionItem(elem, AutoCompletionPriority.UNKNOWN)); 299 301 } 302 this.setSelectedItem(null); 300 303 // disable autocomplete to prevent unnecessary actions in AutoCompletingComboBoxDocument#insertString 301 304 autocompleteEnabled = false; 302 this. getEditor().setItem(oldValue); // Do not use setSelectedItem(oldValue); (fix #8013)305 this.setSelectedItem(oldValue); 303 306 autocompleteEnabled = true; 307 } 308 309 /** 310 * Sets the items of the combobox to the given {@code String}s in top down order. 311 * @param elems Collection of String items (is not changed) 312 * @since 15011 313 */ 314 public void setPossibleItemsTopDown(Collection<String> elems) { 315 // We have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 316 LinkedList<String> reversed = new LinkedList<>(elems); 317 Collections.reverse(reversed); 318 setPossibleItems(reversed); 304 319 } 305 320
Note:
See TracChangeset
for help on using the changeset viewer.