Ticket #17401: 17401-v4-poc.patch
| File 17401-v4-poc.patch, 3.3 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
89 89 private final SelectAction selectAction = new SelectAction(); 90 90 private final SelectAndZoomAction selectAndZoomAction = new SelectAndZoomAction(); 91 91 92 private boolean notInSync; 93 private boolean passive; 94 92 95 /** 93 96 * Constructs a new {@code CommandStackDialog}. 94 97 */ … … 375 378 @Override 376 379 public void commandAdded(CommandAddedEvent e) { 377 380 if (isVisible()) { 378 undoRoot.add(getNodeForCommand(e.getCommand())); 379 undoTreeModel.nodeStructureChanged(undoRoot); 380 // fix 16911: make sure that redo tree is rebuild with empty list 381 if (!redoTreeIsEmpty()) 382 buildRedoTree(); 383 ensureTreesConsistency(); 381 if (passive) { 382 notInSync = true; 383 } else { 384 undoRoot.add(getNodeForCommand(e.getCommand())); 385 undoTreeModel.nodeStructureChanged(undoRoot); 386 // fix 16911: make sure that redo tree is rebuild with empty list 387 if (!redoTreeIsEmpty()) 388 buildRedoTree(); 389 ensureTreesConsistency(); 390 } 384 391 } 385 392 } 386 393 … … 550 557 add(selectAndZoomAction); 551 558 } 552 559 } 560 561 /** 562 * Allows to set the dialog into passive mode so that updates to the undo/redo tree are ignored 563 * @param b true: enable passive mode, false: disable passive mode and rebuild dialog 564 */ 565 public void setPassive(boolean b) { 566 if (passive) { 567 if (!b) { 568 passive = false; 569 if (notInSync) { 570 buildTrees(); 571 notInSync = false; 572 } 573 } 574 } else { 575 passive = b; 576 } 577 } 553 578 } -
src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
618 618 @Override 619 619 protected void realRun() throws SAXException, IOException, OsmTransferException { 620 620 ProgressMonitor monitor = getProgressMonitor(); 621 CommandStackDialog cmdStackPanel = dialogsPanel.getToggleDialog(CommandStackDialog.class); 621 622 try { 623 if (cmdStackPanel != null && testErrors.size() > 100) { 624 cmdStackPanel.setPassive(true); 625 } 622 626 monitor.setTicksCount(testErrors.size()); 623 627 final DataSet ds = MainApplication.getLayerManager().getActiveDataSet(); 624 628 int i = 0; … … 646 650 throw new JosmRuntimeException(e); 647 651 } finally { 648 652 monitor.finishTask(); 653 if (cmdStackPanel != null) { 654 cmdStackPanel.setPassive(false); 655 } 649 656 } 650 657 } 651 658 }
