Changeset 14134 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs
- Timestamp:
- 2018-08-11T23:33:58+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r13943 r14134 40 40 import org.openstreetmap.josm.command.Command; 41 41 import org.openstreetmap.josm.command.PseudoCommand; 42 import org.openstreetmap.josm.data.UndoRedoHandler; 42 43 import org.openstreetmap.josm.data.UndoRedoHandler.CommandAddedEvent; 43 44 import org.openstreetmap.josm.data.UndoRedoHandler.CommandQueueCleanedEvent; … … 237 238 listener.updateEnabledState(); 238 239 } 239 MainApplication.undoRedo.addCommandQueuePreciseListener(this);240 UndoRedoHandler.getInstance().addCommandQueuePreciseListener(this); 240 241 } 241 242 … … 255 256 undoTreeModel.setRoot(undoRoot); 256 257 redoTreeModel.setRoot(redoRoot); 257 MainApplication.undoRedo.removeCommandQueuePreciseListener(this);258 UndoRedoHandler.getInstance().removeCommandQueuePreciseListener(this); 258 259 } 259 260 … … 270 271 271 272 private void buildUndoTree() { 272 List<Command> undoCommands = MainApplication.undoRedo.commands;273 List<Command> undoCommands = UndoRedoHandler.getInstance().commands; 273 274 undoRoot = new DefaultMutableTreeNode(); 274 275 for (int i = 0; i < undoCommands.size(); ++i) { … … 279 280 280 281 private void buildRedoTree() { 281 List<Command> redoCommands = MainApplication.undoRedo.redoCommands;282 List<Command> redoCommands = UndoRedoHandler.getInstance().redoCommands; 282 283 redoRoot = new DefaultMutableTreeNode(); 283 284 for (int i = 0; i < redoCommands.size(); ++i) { … … 288 289 289 290 private void ensureTreesConsistency() { 290 List<Command> undoCommands = MainApplication.undoRedo.commands;291 List<Command> redoCommands = MainApplication.undoRedo.redoCommands;291 List<Command> undoCommands = UndoRedoHandler.getInstance().commands; 292 List<Command> redoCommands = UndoRedoHandler.getInstance().redoCommands; 292 293 if (redoTreeModel.getChildCount(redoRoot) > 0) { 293 294 redoTree.scrollRowToVisible(0); … … 505 506 case UNDO: 506 507 int numUndo = ((DefaultMutableTreeNode) undoTreeModel.getRoot()).getChildCount() - idx; 507 MainApplication.undoRedo.undo(numUndo);508 UndoRedoHandler.getInstance().undo(numUndo); 508 509 break; 509 510 case REDO: 510 511 int numRedo = idx+1; 511 MainApplication.undoRedo.redo(numRedo);512 UndoRedoHandler.getInstance().redo(numRedo); 512 513 break; 513 514 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r13842 r14134 41 41 import org.openstreetmap.josm.command.Command; 42 42 import org.openstreetmap.josm.command.SequenceCommand; 43 import org.openstreetmap.josm.data.UndoRedoHandler; 43 44 import org.openstreetmap.josm.data.conflict.Conflict; 44 45 import org.openstreetmap.josm.data.conflict.ConflictCollection; … … 523 524 } 524 525 } 525 MainApplication.undoRedo.add(new SequenceCommand(name, commands));526 UndoRedoHandler.getInstance().add(new SequenceCommand(name, commands)); 526 527 refreshView(); 527 528 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java
r12663 r14134 18 18 19 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.data.UndoRedoHandler; 20 21 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 21 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 23 import org.openstreetmap.josm.gui.ExtendedDialog; 23 import org.openstreetmap.josm.gui.MainApplication;24 24 import org.openstreetmap.josm.gui.conflict.pair.ConflictResolver; 25 25 import org.openstreetmap.josm.gui.help.HelpBrowser; … … 204 204 } 205 205 } 206 MainApplication.undoRedo.add(resolver.buildResolveCommand());206 UndoRedoHandler.getInstance().add(resolver.buildResolveCommand()); 207 207 buttonAction(1, evt); 208 208 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r13940 r14134 35 35 import org.openstreetmap.josm.actions.relation.EditRelationAction; 36 36 import org.openstreetmap.josm.command.Command; 37 import org.openstreetmap.josm.data.UndoRedoHandler; 37 38 import org.openstreetmap.josm.data.osm.DataSelectionListener; 38 39 import org.openstreetmap.josm.data.osm.DataSet; … … 560 561 final Command fixCommand = error.getFix(); 561 562 if (fixCommand != null) { 562 SwingUtilities.invokeAndWait(() -> MainApplication.undoRedo.addNoRedraw(fixCommand));563 SwingUtilities.invokeAndWait(() -> UndoRedoHandler.getInstance().addNoRedraw(fixCommand)); 563 564 } 564 565 // It is wanted to ignore an error if it said fixable, even if fixCommand was null … … 591 592 monitor.subTask(tr("Updating map ...")); 592 593 SwingUtilities.invokeAndWait(() -> { 593 MainApplication.undoRedo.afterAdd(null);594 UndoRedoHandler.getInstance().afterAdd(null); 594 595 invalidateValidatorLayers(); 595 596 tree.resetErrors(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r14102 r14134 59 59 import org.openstreetmap.josm.command.ChangePropertyCommand; 60 60 import org.openstreetmap.josm.command.Command; 61 import org.openstreetmap.josm.data.UndoRedoHandler; 61 62 import org.openstreetmap.josm.data.osm.AbstractPrimitive; 62 63 import org.openstreetmap.josm.data.osm.DataSelectionListener; … … 844 845 Command command = TaggingPreset.createCommand(getSelection(), tags); 845 846 if (command != null) { 846 MainApplication.undoRedo.add(command);847 UndoRedoHandler.getInstance().add(command); 847 848 } 848 849 } … … 1011 1012 1012 1013 Collection<OsmPrimitive> sel = Main.main.getInProgressSelection(); 1013 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, tags));1014 UndoRedoHandler.getInstance().add(new ChangePropertyCommand(sel, tags)); 1014 1015 1015 1016 membershipTable.clearSelection(); … … 1042 1043 rel.removeMembersFor(primitive); 1043 1044 } 1044 MainApplication.undoRedo.add(new ChangeCommand(cur, rel));1045 UndoRedoHandler.getInstance().add(new ChangeCommand(cur, rel)); 1045 1046 1046 1047 tagTable.clearSelection(); … … 1164 1165 if (sel.isEmpty() || clipboard == null || sel.iterator().next().getDataSet().isLocked()) 1165 1166 return; 1166 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, key, Utils.strip(clipboard)));1167 UndoRedoHandler.getInstance().add(new ChangePropertyCommand(sel, key, Utils.strip(clipboard))); 1167 1168 } 1168 1169 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r13597 r14134 68 68 import org.openstreetmap.josm.command.Command; 69 69 import org.openstreetmap.josm.command.SequenceCommand; 70 import org.openstreetmap.josm.data.UndoRedoHandler; 70 71 import org.openstreetmap.josm.data.osm.OsmPrimitive; 71 72 import org.openstreetmap.josm.data.osm.Tag; … … 81 82 import org.openstreetmap.josm.gui.ExtendedDialog; 82 83 import org.openstreetmap.josm.gui.IExtendedDialog; 83 import org.openstreetmap.josm.gui.MainApplication;84 84 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 85 85 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; … … 508 508 return; 509 509 if (key.equals(newkey) || value == null) { 510 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, newkey, value));510 UndoRedoHandler.getInstance().add(new ChangePropertyCommand(sel, newkey, value)); 511 511 AutoCompletionManager.rememberUserInput(newkey, value, true); 512 512 } else { … … 542 542 AutoCompletionManager.rememberUserInput(newkey, value, false); 543 543 } 544 MainApplication.undoRedo.add(new SequenceCommand(544 UndoRedoHandler.getInstance().add(new SequenceCommand( 545 545 trn("Change properties of up to {0} object", 546 546 "Change properties of up to {0} objects", sel.size(), sel.size()), … … 1077 1077 AutoCompletionManager.rememberUserInput(key, value, false); 1078 1078 commandCount++; 1079 MainApplication.undoRedo.add(new ChangePropertyCommand(sel, key, value));1079 UndoRedoHandler.getInstance().add(new ChangePropertyCommand(sel, key, value)); 1080 1080 changedKey = key; 1081 1081 clearEntries(); … … 1088 1088 1089 1089 public void undoAllTagsAdding() { 1090 MainApplication.undoRedo.undo(commandCount);1090 UndoRedoHandler.getInstance().undo(commandCount); 1091 1091 } 1092 1092 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java
r14030 r14134 12 12 13 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.data.UndoRedoHandler; 14 15 import org.openstreetmap.josm.data.UndoRedoHandler.CommandQueueListener; 15 16 import org.openstreetmap.josm.data.osm.Relation; 16 17 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 17 18 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 18 import org.openstreetmap.josm.gui.MainApplication;19 19 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 20 20 import org.openstreetmap.josm.tools.ImageProvider; … … 46 46 rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), "refresh"); 47 47 } 48 MainApplication.undoRedo.addCommandQueueListener(this);48 UndoRedoHandler.getInstance().addCommandQueueListener(this); 49 49 updateEnabledState(); 50 50 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java
r14029 r14134 15 15 import org.openstreetmap.josm.command.ChangeCommand; 16 16 import org.openstreetmap.josm.command.conflict.ConflictAddCommand; 17 import org.openstreetmap.josm.data.UndoRedoHandler; 17 18 import org.openstreetmap.josm.data.conflict.Conflict; 18 19 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 67 68 if (newRelation.getMembersCount() == 0 && !newRelation.hasKeys()) 68 69 return; 69 MainApplication.undoRedo.add(new AddCommand(getLayer().getDataSet(), newRelation));70 UndoRedoHandler.getInstance().add(new AddCommand(getLayer().getDataSet(), newRelation)); 70 71 71 72 // make sure everybody is notified about the changes … … 89 90 editorAccess.getMemberTableModel().applyToRelation(editedRelation); 90 91 Conflict<Relation> conflict = new Conflict<>(editorAccess.getEditor().getRelation(), editedRelation); 91 MainApplication.undoRedo.add(new ConflictAddCommand(getLayer().getDataSet(), conflict));92 UndoRedoHandler.getInstance().add(new ConflictAddCommand(getLayer().getDataSet(), conflict)); 92 93 } 93 94 … … 102 103 getMemberTableModel().applyToRelation(editedRelation); 103 104 if (!editedRelation.hasEqualSemanticAttributes(originRelation, false)) { 104 MainApplication.undoRedo.add(new ChangeCommand(originRelation, editedRelation));105 UndoRedoHandler.getInstance().add(new ChangeCommand(originRelation, editedRelation)); 105 106 } 106 107 }
Note:
See TracChangeset
for help on using the changeset viewer.