Ticket #2247: NoRepeats!.patch

File NoRepeats!.patch, 1.2 KB (added by xeen, 17 years ago)

Neat feature. Although Java for some reason places the drop down on my 2nd monitor. I thought the arrow does nothing because of that.

  • src/org/openstreetmap/josm/actions/search/SearchAction.java

     
    123123     * @param s
    124124     */
    125125    public static void searchWithHistory(SearchSetting s) {
    126         searchHistory.addFirst(s);
     126        if(searchHistory.isEmpty() || !s.equals(searchHistory.getFirst()))
     127            searchHistory.addFirst(s);
    127128        while (searchHistory.size() > SEARCH_HISTORY_SIZE)
    128129            searchHistory.removeLast();
    129130        lastSearch = s;
     
    202203            return "\"" + text + "\" (" + cs + rx + ", " + mode + ")";
    203204        }
    204205
     206        public boolean equals(Object other) {
     207            if(!(other instanceof SearchSetting))
     208                return false;
     209            SearchSetting o = (SearchSetting) other;
     210            return (o.caseSensitive == this.caseSensitive
     211                 && o.regexSearch == this.regexSearch
     212                 && o.mode.equals(this.mode)
     213                 && o.text.equals(this.text));
     214        }
    205215    }
    206216}