- Timestamp:
- 2010-06-08T15:42:33+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r3252 r3317 477 477 if (args.containsKey("selection")) { 478 478 for (String s : args.get("selection")) { 479 SearchAction.search(s, SearchAction.SearchMode.add , false, false);479 SearchAction.search(s, SearchAction.SearchMode.add); 480 480 } 481 481 } -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r3305 r3317 158 158 159 159 JCheckBox caseSensitive = new JCheckBox(tr("case sensitive"), initialValues.caseSensitive); 160 JCheckBox allElements = new JCheckBox(tr("all objects"), initialValues.allElements); 161 allElements.setToolTipText(tr("Also include incomplete and deleted objects in search.")); 160 162 JCheckBox regexSearch = new JCheckBox(tr("regular expression"), initialValues.regexSearch); 161 163 … … 168 170 left.add(in_selection, GBC.eop()); 169 171 left.add(caseSensitive, GBC.eol()); 172 left.add(allElements, GBC.eol()); 170 173 left.add(regexSearch, GBC.eol()); 171 174 … … 231 234 initialValues.mode = mode; 232 235 initialValues.caseSensitive = caseSensitive.isSelected(); 236 initialValues.allElements = allElements.isSelected(); 233 237 initialValues.regexSearch = regexSearch.isSelected(); 234 238 return initialValues; … … 277 281 } 278 282 279 for (OsmPrimitive osm : Main.main.getCurrentDataSet().allNonDeletedCompletePrimitives()) { 283 Collection<OsmPrimitive> all; 284 if(s.allElements) 285 all = Main.main.getCurrentDataSet().allPrimitives(); 286 else 287 all = Main.main.getCurrentDataSet().allNonDeletedCompletePrimitives(); 288 for (OsmPrimitive osm : all) { 280 289 if (s.mode == SearchMode.replace) { 281 290 if (matcher.match(osm)) { … … 348 357 } 349 358 350 public static void search(String search, SearchMode mode , boolean caseSensitive, boolean regexSearch) {351 search(new SearchSetting(search, mode, caseSensitive, regexSearch));359 public static void search(String search, SearchMode mode) { 360 search(new SearchSetting(search, mode, false, false, false)); 352 361 } 353 362 … … 402 411 public boolean caseSensitive; 403 412 public boolean regexSearch; 413 public boolean allElements; 404 414 405 415 public SearchSetting() { 406 this("", SearchMode.replace, false /* case insensitive */, false /* no regexp */); 407 } 408 409 public SearchSetting(String text, SearchMode mode, boolean caseSensitive, boolean regexSearch) { 416 this("", SearchMode.replace, false /* case insensitive */, 417 false /* no regexp */, false /* only useful primitives */); 418 } 419 420 public SearchSetting(String text, SearchMode mode, boolean caseSensitive, 421 boolean regexSearch, boolean allElements) { 410 422 this.caseSensitive = caseSensitive; 411 423 this.regexSearch = regexSearch; 424 this.allElements = allElements; 412 425 this.mode = mode; 413 426 this.text = text; … … 415 428 416 429 public SearchSetting(SearchSetting original) { 417 this(original.text, original.mode, original.caseSensitive, original.regexSearch); 430 this(original.text, original.mode, original.caseSensitive, 431 original.regexSearch, original.allElements); 418 432 } 419 433 … … 422 436 String cs = caseSensitive ? 423 437 /*case sensitive*/ trc("search", "CS") : 424 /*case insensitive*/ trc("search", "CI"); 425 /*regex search*/ 426 String rx = regexSearch ? (", " + trc("search", "RX")) : ""; 427 return "\"" + text + "\" (" + cs + rx + ", " + mode + ")"; 438 /*case insensitive*/ trc("search", "CI"); 439 String rx = regexSearch ? (", " + 440 /*regex search*/ trc("search", "RX")) : ""; 441 String all = allElements ? (", " + 442 /*all elements*/ trc("search", "A")) : ""; 443 return "\"" + text + "\" (" + cs + rx + all + ", " + mode + ")"; 428 444 } 429 445 … … 435 451 return (o.caseSensitive == this.caseSensitive 436 452 && o.regexSearch == this.regexSearch 453 && o.allElements == this.allElements 437 454 && o.mode.equals(this.mode) 438 455 && o.text.equals(this.text)); … … 463 480 } else if (s.charAt(index) == 'R') { 464 481 result.regexSearch = true; 482 } else if (s.charAt(index) == 'A') { 483 result.allElements = true; 465 484 } else if (s.charAt(index) == ' ') { 466 485 break; … … 493 512 result.append('R'); 494 513 } 514 if (allElements) { 515 result.append('A'); 516 } 495 517 result.append(' '); 496 518 result.append(text); -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r3305 r3317 583 583 private static class Untagged extends Match { 584 584 @Override public boolean match(OsmPrimitive osm) { 585 return !osm.isTagged() ;585 return !osm.isTagged() && !osm.isIncomplete(); 586 586 } 587 587 @Override public String toString() {return "untagged";} -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r3262 r3317 439 439 private static boolean checkAndConfirmOutlyingDeletes(OsmDataLayer layer, Collection<OsmPrimitive> primitivesToDelete) { 440 440 Area a = layer.data.getDataSourceArea(); 441 boolean outside = false; 442 boolean incomplete = false; 441 443 if (a != null) { 442 444 for (OsmPrimitive osm : primitivesToDelete) { 443 if (osm instanceof Node && !osm.isNew()) { 444 Node n = (Node) osm; 445 if (!a.contains(n.getCoor())) { 446 JPanel msg = new JPanel(new GridBagLayout()); 447 msg.add(new JLabel( 448 "<html>" + 449 // leave message in one tr() as there is a grammatical 450 // connection. 451 tr("You are about to delete nodes outside of the area you have downloaded." 452 + "<br>" 453 + "This can cause problems because other objects (that you do not see) might use them." 454 + "<br>" + "Do you really want to delete?") + "</html>")); 455 return ConditionalOptionPaneUtil.showConfirmationDialog( 456 "delete_outside_nodes", 457 Main.parent, 458 msg, 459 tr("Delete confirmation"), 460 JOptionPane.YES_NO_OPTION, 461 JOptionPane.QUESTION_MESSAGE, 462 JOptionPane.YES_OPTION 463 ); 464 } 465 } 466 } 445 if (osm.isIncomplete()) 446 incomplete = true; 447 else if (osm instanceof Node && !osm.isNew() 448 && !a.contains(((Node) osm).getCoor())) 449 outside = true; 450 } 451 } 452 else 453 { 454 for (OsmPrimitive osm : primitivesToDelete) 455 if (osm.isIncomplete()) 456 incomplete = true; 457 } 458 if(outside) 459 { 460 JPanel msg = new JPanel(new GridBagLayout()); 461 msg.add(new JLabel( 462 "<html>" + 463 // leave message in one tr() as there is a grammatical 464 // connection. 465 tr("You are about to delete nodes outside of the area you have downloaded." 466 + "<br>" 467 + "This can cause problems because other objects (that you do not see) might use them." 468 + "<br>" + "Do you really want to delete?") + "</html>")); 469 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 470 "delete_outside_nodes", 471 Main.parent, 472 msg, 473 tr("Delete confirmation"), 474 JOptionPane.YES_NO_OPTION, 475 JOptionPane.QUESTION_MESSAGE, 476 JOptionPane.YES_OPTION 477 ); 478 if(!answer) 479 return false; 480 } 481 if(incomplete) 482 { 483 JPanel msg = new JPanel(new GridBagLayout()); 484 msg.add(new JLabel( 485 "<html>" + 486 // leave message in one tr() as there is a grammatical 487 // connection. 488 tr("You are about to delete incomplete objects." 489 + "<br>" 490 + "This will cause problems because you don't see the real object." 491 + "<br>" + "Do you really want to delete?") + "</html>")); 492 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 493 "delete_incomplete", 494 Main.parent, 495 msg, 496 tr("Delete confirmation"), 497 JOptionPane.YES_NO_OPTION, 498 JOptionPane.QUESTION_MESSAGE, 499 JOptionPane.YES_OPTION 500 ); 501 if(!answer) 502 return false; 467 503 } 468 504 return true; -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
r3210 r3317 77 77 new PrefixSuffixSwitcher("forwards", "backwards"), 78 78 new PrefixSuffixSwitcher("up", "down"), 79 new PrefixSuffixSwitcher("east", "west"), 80 new PrefixSuffixSwitcher("north", "south"), 79 81 }; 80 82 -
trunk/src/org/openstreetmap/josm/data/osm/Filter.java
r3300 r3317 15 15 public Boolean inverted = false; 16 16 public Filter() { 17 super("", SearchMode.add, false, false );17 super("", SearchMode.add, false, false, false); 18 18 } 19 public Filter(String text, SearchMode mode, boolean caseSensitive, boolean regexSearch) { 20 super(text, mode, caseSensitive, regexSearch); 19 public Filter(String text, SearchMode mode, boolean caseSensitive, 20 boolean regexSearch, boolean allElements) { 21 super(text, mode, caseSensitive, regexSearch, allElements); 21 22 } 22 23 23 24 public Filter(String prefText){ 24 super("", SearchMode.add, false, false );25 super("", SearchMode.add, false, false, false); 25 26 String[] prfs = prefText.split(";"); 26 27 if(prfs.length != 10 && !prfs[0].equals(version))
Note:
See TracChangeset
for help on using the changeset viewer.