Changeset 29817 in osm for applications/editors/josm/plugins/CommandLine/src
- Timestamp:
- 2013-08-03T10:00:02+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java
r29784 r29817 43 43 import javax.swing.JTextField; 44 44 import javax.swing.JToolBar; 45 import javax.swing.SwingUtilities; 45 46 46 47 import org.openstreetmap.josm.Main; … … 238 239 } 239 240 240 protected void printHistory(String text) { 241 historyField.setText(text); 241 protected void printHistory(final String text) { 242 SwingUtilities.invokeLater(new Runnable() { 243 @Override 244 public void run() { 245 historyField.setText(text); 246 } 247 }); 242 248 } 243 249 … … 478 484 // redirect child process's stderr to JOSM stderr 479 485 new Thread(new Runnable() { 480 @Override481 486 public void run() { 482 487 try { … … 497 502 // Write stdin stream 498 503 Thread osmWriteThread = new Thread(new Runnable() { 499 @Override500 504 public void run() { 501 505 BBox bbox = null; … … 516 520 bbox.addPrimitive(primitive, 0.0); 517 521 } 522 osmWriter.writeNodes(new SubclassFilteredCollection<OsmPrimitive, Node>(contents, OsmPrimitive.nodePredicate)); 523 osmWriter.writeWays(new SubclassFilteredCollection<OsmPrimitive, Way>(contents, OsmPrimitive.wayPredicate)); 524 osmWriter.writeRelations(new SubclassFilteredCollection<OsmPrimitive, Relation>(contents, OsmPrimitive.relationPredicate)); 525 osmWriter.footer(); 526 osmWriter.flush(); 527 518 528 for (Parameter parameter : parameters) { 519 529 if (!parameter.isOsm()) 520 530 continue; 531 contents = new ArrayList<OsmPrimitive>(); 532 osmWriter.header(); 521 533 pObjects = parameter.getParameterObjects(); 522 534 for (OsmPrimitive primitive : pObjects) { … … 527 539 bbox.addPrimitive(primitive, 0.0); 528 540 } 529 } 530 osmWriter.writeNodes(new SubclassFilteredCollection<OsmPrimitive, Node>(contents, OsmPrimitive.nodePredicate)); 531 osmWriter.writeWays(new SubclassFilteredCollection<OsmPrimitive, Way>(contents, OsmPrimitive.wayPredicate)); 532 osmWriter.writeRelations(new SubclassFilteredCollection<OsmPrimitive, Relation>(contents, OsmPrimitive.relationPredicate)); 533 osmWriter.footer(); 534 osmWriter.flush(); 541 osmWriter.writeNodes(new SubclassFilteredCollection<OsmPrimitive, Node>(contents, OsmPrimitive.nodePredicate)); 542 osmWriter.writeWays(new SubclassFilteredCollection<OsmPrimitive, Way>(contents, OsmPrimitive.wayPredicate)); 543 osmWriter.writeRelations(new SubclassFilteredCollection<OsmPrimitive, Relation>(contents, OsmPrimitive.relationPredicate)); 544 osmWriter.footer(); 545 osmWriter.flush(); 546 } 547 535 548 if (tracks) { 536 549 final GpxWriter gpxWriter = new GpxWriter(printWriter); … … 545 558 } 546 559 Utils.close(osmWriter); 547 synchronized (syncObj) {548 tp.running = false;549 syncObj.notifyAll();550 }551 560 } 552 561 }); 553 562 554 563 // Read stdout stream 555 final OsmToCmd osmToCmd = new OsmToCmd(this, Main.main.getCurrentDataSet()); 564 final DataSet currentDataSet = Main.main.getCurrentDataSet(); 565 final CommandLine that = this; 556 566 Thread osmParseThread = new Thread(new Runnable() { 557 @Override558 567 public void run() { 559 568 try { 569 final OsmToCmd osmToCmd = new OsmToCmd(that, currentDataSet); 560 570 String commandName = currentCommand.name; 561 571 //HashMap<Long, Long> inexiDMap = new HashMap<Long, Long>(); … … 564 574 final List<org.openstreetmap.josm.command.Command> cmdlist = osmToCmd.getCommandList(); 565 575 if (!cmdlist.isEmpty()) { 566 SequenceCommand cmd = new SequenceCommand(commandName, cmdlist); 567 Main.main.undoRedo.add(cmd); 576 final SequenceCommand cmd = new SequenceCommand(commandName, cmdlist); 577 SwingUtilities.invokeLater(new Runnable() { 578 @Override 579 public void run() { 580 Main.main.undoRedo.add(cmd); 581 } 582 }); 568 583 } 569 584 }
Note:
See TracChangeset
for help on using the changeset viewer.