Ticket #19199: 19199.threading.1.patch
| File 19199.threading.1.patch, 1.9 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; … … public class SimplifyWayAction extends JosmAction { 512 513 UndoRedoHandler.getInstance().undo(); 513 514 } 514 515 double threshold = errorModel.getNumber().doubleValue(); 516 MainApplication.worker.submit(() -> updateNodesToRemove(this.ways, threshold)); 517 } 518 519 private synchronized void updateNodesToRemove(List<Way> ways, double threshold) { 520 if (lastCommand != null && lastCommand.equals(UndoRedoHandler.getInstance().getLastCommand())) { 521 GuiHelper.runInEDTAndWait(() -> UndoRedoHandler.getInstance().undo()); 522 } 515 523 int removeNodes = simplifyWaysCountNodesRemoved(ways, threshold); 524 GuiHelper.runInEDTAndWait(() -> { 516 525 nodesToRemove.setText(trn( 517 526 "(about {0} node to remove)", 518 527 "(about {0} nodes to remove)", removeNodes, removeNodes)); 528 }); 519 529 lastCommand = SimplifyWayAction.buildSimplifyWaysCommand(ways, threshold); 520 530 if (lastCommand != null) { 521 UndoRedoHandler.getInstance().add(lastCommand);531 GuiHelper.runInEDTAndWait(() -> UndoRedoHandler.getInstance().add(lastCommand)); 522 532 } 523 533 } 524 534 }
