Ticket #17754: 17754.patch
| File 17754.patch, 2.8 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java
9 9 import java.awt.FlowLayout; 10 10 import java.awt.GridBagLayout; 11 11 import java.awt.event.ActionEvent; 12 import java.awt.event.ItemEvent; 13 import java.awt.event.ItemListener; 12 14 import java.awt.event.MouseAdapter; 13 15 import java.awt.event.MouseEvent; 14 16 import java.util.Arrays; … … 118 120 standardSearch = new JRadioButton(tr("standard"), !searchSettings.regexSearch && !searchSettings.mapCSSSearch); 119 121 regexSearch = new JRadioButton(tr("regular expression"), searchSettings.regexSearch); 120 122 mapCSSSearch = new JRadioButton(tr("MapCSS selector"), searchSettings.mapCSSSearch); 123 121 124 ButtonGroup bg2 = new ButtonGroup(); 122 125 bg2.add(standardSearch); 123 126 bg2.add(regexSearch); … … 165 168 * every time the content of the field has changed. If the query is incorrect, then 166 169 * the text field is colored red. 167 170 */ 168 document.addDocumentListener(new AbstractTextComponentValidator(editorComponent) {171 AbstractTextComponentValidator validator = new AbstractTextComponentValidator(editorComponent) { 169 172 170 173 @Override 171 174 public void validate() { … … 190 193 return false; 191 194 } 192 195 } 193 }); 196 }; 197 document.addDocumentListener(validator); 198 ItemListener validateActionListener = e -> { 199 if (e.getStateChange() == ItemEvent.SELECTED) { 200 validator.validate(); 201 } 202 }; 203 standardSearch.addItemListener(validateActionListener); 204 regexSearch.addItemListener(validateActionListener); 205 mapCSSSearch.addItemListener(validateActionListener); 194 206 195 207 /* 196 208 * Setup the logic to append preset queries to the search text field according to … … 326 338 trc("search string example", "user:anonymous (objects without an assigned author)")) 327 339 .addKeyword("id:", "id:", tr("objects with given ID"), 328 340 trc("search string example", "id:0 (new objects)")) 329 .addKeyword("version:", "version:", tr("objects with given version"), 341 .addKeyword("version:", "version:", tr("objects with given version"), 330 342 trc("search string example", "version:0 (objects without an assigned version)")) 331 343 .addKeyword("changeset:", "changeset:", tr("objects with given changeset ID"), 332 344 trc("search string example", "changeset:0 (objects without an assigned changeset)"))
