- Timestamp:
- 2015-10-31T01:32:04+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/search
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r8902 r8971 49 49 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences.ActionParser; 50 50 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 51 import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator; 51 52 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 52 53 import org.openstreetmap.josm.tools.GBC; … … 228 229 JLabel label = new JLabel(initialValues instanceof Filter ? tr("Filter string:") : tr("Search string:")); 229 230 final HistoryComboBox hcbSearchString = new HistoryComboBox(); 231 final String tooltip = tr("Enter the search expression"); 230 232 hcbSearchString.setText(initialValues.text); 231 hcbSearchString.setToolTipText(t r("Enter the search expression"));233 hcbSearchString.setToolTipText(tooltip); 232 234 // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() 233 235 // … … 280 282 right = new JPanel(new GridBagLayout()); 281 283 buildHints(right, hcbSearchString); 284 285 final JTextComponent editorComponent = (JTextComponent) hcbSearchString.getEditor().getEditorComponent(); 286 editorComponent.getDocument().addDocumentListener(new AbstractTextComponentValidator(editorComponent) { 287 288 @Override 289 public void validate() { 290 if (!isValid()) { 291 feedbackInvalid(tr("Invalid search expression")); 292 } else { 293 feedbackValid(tooltip); 294 } 295 } 296 297 @Override 298 public boolean isValid() { 299 try { 300 SearchSetting ss = new SearchSetting(); 301 ss.text = hcbSearchString.getText(); 302 ss.caseSensitive = caseSensitive.isSelected(); 303 ss.regexSearch = regexSearch.isSelected(); 304 ss.mapCSSSearch = mapCSSSearch.isSelected(); 305 SearchCompiler.compile(ss); 306 return true; 307 } catch (ParseError e) { 308 return false; 309 } 310 } 311 }); 282 312 283 313 final JPanel p = new JPanel(new GridBagLayout()); … … 619 649 } 620 650 651 /** 652 * Constructs a new {@code SearchSetting} from an existing one. 653 * @param original original search settings 654 */ 621 655 public SearchSetting(SearchSetting original) { 622 656 text = original.text; -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r8931 r8971 635 635 Double v = null; 636 636 try { 637 v = Double.valueOf(referenceValue); 637 if (referenceValue != null) { 638 v = Double.valueOf(referenceValue); 639 } 638 640 } catch (NumberFormatException ignore) { 639 641 if (Main.isTraceEnabled()) {
Note:
See TracChangeset
for help on using the changeset viewer.