- Timestamp:
- 2018-08-29T23:16:52+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r14143 r14204 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.data.osm.OsmDataManager; 12 import org.openstreetmap.josm.gui.util.GuiHelper; 12 13 import org.openstreetmap.josm.spi.preferences.Config; 13 14 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 291 292 if (commands.isEmpty()) 292 293 return; 293 DataSet ds = OsmDataManager.getInstance().getEditDataSet(); 294 if (ds != null) { 295 ds.beginUpdate(); 296 } 297 try { 298 for (int i = 1; i <= num; ++i) { 299 final Command c = commands.removeLast(); 300 c.undoCommand(); 301 redoCommands.addFirst(c); 302 fireEvent(new CommandUndoneEvent(this, c)); 303 if (commands.isEmpty()) { 304 break; 294 GuiHelper.runInEDTAndWait(new Runnable() { 295 @Override 296 public void run() { 297 DataSet ds = OsmDataManager.getInstance().getEditDataSet(); 298 if (ds != null) { 299 ds.beginUpdate(); 305 300 } 301 try { 302 for (int i = 1; i <= num; ++i) { 303 final Command c = commands.removeLast(); 304 c.undoCommand(); 305 redoCommands.addFirst(c); 306 fireEvent(new CommandUndoneEvent(UndoRedoHandler.this, c)); 307 if (commands.isEmpty()) { 308 break; 309 } 310 } 311 } finally { 312 if (ds != null) { 313 ds.endUpdate(); 314 } 315 } 316 fireCommandsChanged(); 306 317 } 307 } finally { 308 if (ds != null) { 309 ds.endUpdate(); 310 } 311 } 312 fireCommandsChanged(); 318 319 }); 313 320 } 314 321 … … 324 331 * @param num The number of commands to redo 325 332 */ 326 public void redo(int num) {333 public synchronized void redo(int num) { 327 334 if (redoCommands.isEmpty()) 328 335 return; … … 367 374 * @since 12718 368 375 */ 369 public void clean(DataSet dataSet) {376 public synchronized void clean(DataSet dataSet) { 370 377 if (dataSet == null) 371 378 return;
Note:
See TracChangeset
for help on using the changeset viewer.