Ticket #19199: 19199.threading.patch
| File 19199.threading.patch, 1.8 KB (added by , 5 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/SimplifyWayAction.java
46 46 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 47 47 import org.openstreetmap.josm.gui.MainApplication; 48 48 import org.openstreetmap.josm.gui.Notification; 49 import org.openstreetmap.josm.gui.util.GuiHelper; 49 50 import org.openstreetmap.josm.spi.preferences.Config; 50 51 import org.openstreetmap.josm.spi.preferences.IPreferences; 51 52 import org.openstreetmap.josm.tools.GBC; … … 514 515 UndoRedoHandler.getInstance().undo(); 515 516 } 516 517 double threshold = errorModel.getNumber().doubleValue(); 518 MainApplication.worker.submit(() -> updateNodesToRemove(this.ways, threshold)); 519 } 520 521 private synchronized void updateNodesToRemove(List<Way> ways, double threshold) { 522 if (lastCommand != null && lastCommand.equals(UndoRedoHandler.getInstance().getLastCommand())) { 523 GuiHelper.runInEDTAndWait(() -> UndoRedoHandler.getInstance().undo()); 524 } 517 525 int removeNodes = simplifyWaysCountNodesRemoved(ways, threshold); 526 GuiHelper.runInEDTAndWait(() -> { 518 527 nodesToRemove.setText(trn( 519 528 "(about {0} node to remove)", 520 529 "(about {0} nodes to remove)", removeNodes, removeNodes)); 530 }); 521 531 lastCommand = SimplifyWayAction.buildSimplifyWaysCommand(ways, threshold); 522 532 if (lastCommand != null) { 523 UndoRedoHandler.getInstance().add(lastCommand);533 GuiHelper.runInEDTAndWait(() -> UndoRedoHandler.getInstance().add(lastCommand)); 524 534 } 525 535 } 526 536 }
