Ignore:
Timestamp:
2017-07-30T17:07:42+02:00 (7 years ago)
Author:
Don-vip
Message:

partial revert of r12537

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r12537 r12542  
    125125    }
    126126
    127     private static final LinkedList<SearchSetting> SEARCH_HISTORY = new LinkedList<>();
     127    private static final LinkedList<SearchSetting> searchHistory = new LinkedList<>();
    128128    static {
    129129        for (String s: Main.pref.getCollection("search.history", Collections.<String>emptyList())) {
    130130            SearchSetting ss = SearchSetting.readFromString(s);
    131131            if (ss != null) {
    132                 SEARCH_HISTORY.add(ss);
     132                searchHistory.add(ss);
    133133            }
    134134        }
     
    140140     */
    141141    public static Collection<SearchSetting> getSearchHistory() {
    142         return SEARCH_HISTORY;
     142        return searchHistory;
    143143    }
    144144
     
    148148     */
    149149    public static void saveToHistory(SearchSetting s) {
    150         if (SEARCH_HISTORY.isEmpty() || !s.equals(SEARCH_HISTORY.getFirst())) {
    151             SEARCH_HISTORY.addFirst(new SearchSetting(s));
    152         } else if (SEARCH_HISTORY.contains(s)) {
     150        if (searchHistory.isEmpty() || !s.equals(searchHistory.getFirst())) {
     151            searchHistory.addFirst(new SearchSetting(s));
     152        } else if (searchHistory.contains(s)) {
    153153            // move existing entry to front, fixes #8032 - search history loses entries when re-using queries
    154             SEARCH_HISTORY.remove(s);
    155             SEARCH_HISTORY.addFirst(new SearchSetting(s));
     154            searchHistory.remove(s);
     155            searchHistory.addFirst(new SearchSetting(s));
    156156        }
    157157        int maxsize = Main.pref.getInteger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE);
    158         while (SEARCH_HISTORY.size() > maxsize) {
    159             SEARCH_HISTORY.removeLast();
    160         }
    161         Set<String> savedHistory = new LinkedHashSet<>(SEARCH_HISTORY.size());
    162         for (SearchSetting item: SEARCH_HISTORY) {
     158        while (searchHistory.size() > maxsize) {
     159            searchHistory.removeLast();
     160        }
     161        Set<String> savedHistory = new LinkedHashSet<>(searchHistory.size());
     162        for (SearchSetting item: searchHistory) {
    163163            savedHistory.add(item.writeToString());
    164164        }
Note: See TracChangeset for help on using the changeset viewer.