Ticket #740: josm-search-feedback.diff
| File josm-search-feedback.diff, 2.0 KB (added by , 18 years ago) |
|---|
-
home/dnaber/workspace/JOSM/src/org/openstreetmap/josm/actions/search/SearchAction.java
87 87 try { 88 88 Collection<OsmPrimitive> sel = Main.ds.getSelected(); 89 89 SearchCompiler.Match matcher = SearchCompiler.compile(search, caseSensitive); 90 int foundMatches = 0; 90 91 for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) { 91 92 if (mode == SearchMode.replace) { 92 if (matcher.match(osm)) 93 if (matcher.match(osm)) { 93 94 sel.add(osm); 94 else 95 foundMatches++; 96 } else { 95 97 sel.remove(osm); 96 } else if (mode == SearchMode.add && !osm.selected && matcher.match(osm)) 98 } 99 } else if (mode == SearchMode.add && !osm.selected && matcher.match(osm)) { 97 100 sel.add(osm); 98 else if (mode == SearchMode.remove && osm.selected && matcher.match(osm)) 101 foundMatches++; 102 } else if (mode == SearchMode.remove && osm.selected && matcher.match(osm)) { 99 103 sel.remove(osm); 104 foundMatches++; 105 } 100 106 } 101 107 Main.ds.setSelected(sel); 108 if (foundMatches == 0) { 109 String msg = null; 110 if (mode == SearchMode.replace) { 111 msg = tr("No match found for ''{0}''", search); 112 } else if (mode == SearchMode.add) { 113 msg = tr("Nothing added to selection by searching for ''{0}''", search); 114 } else if (mode == SearchMode.remove) { 115 msg = tr("Nothing removed from selection by searching for ''{0}''", search); 116 } 117 Main.map.statusLine.setHelpText(msg); 118 JOptionPane.showMessageDialog(Main.parent, msg); 119 } else { 120 Main.map.statusLine.setHelpText(tr("Found {0} matches", foundMatches)); 121 } 102 122 } catch (SearchCompiler.ParseError e) { 103 123 JOptionPane.showMessageDialog(Main.parent, e.getMessage()); 104 124 }
