Changeset 12316 in josm for trunk/src/org
- Timestamp:
- 2017-06-04T20:59:41+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r12315 r12316 133 133 Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection); 134 134 135 Command c = !Main.main.undoRedo.commands.isEmpty() 136 ? Main.main.undoRedo.commands.getLast() : null; 135 Command c = Main.main.undoRedo.getLastCommand(); 137 136 138 137 ds.beginUpdate(); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r12284 r12316 1323 1323 public void actionPerformed(ActionEvent e) { 1324 1324 Main.main.undoRedo.undo(); 1325 Command lastCmd = Main.main.undoRedo. commands.peekLast();1325 Command lastCmd = Main.main.undoRedo.getLastCommand(); 1326 1326 if (lastCmd == null) return; 1327 1327 Node n = null; -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r12314 r12316 809 809 */ 810 810 private static Command getLastCommandInDataset(DataSet ds) { 811 LinkedList<Command> commands = Main.main.undoRedo.commands; 812 if (!commands.isEmpty()) { 813 Command lastCommand = commands.getLast(); 814 if (lastCommand instanceof SequenceCommand) { 815 lastCommand = ((SequenceCommand) lastCommand).getLastCommand(); 816 } 817 if (ds.equals(lastCommand.getAffectedDataSet())) { 818 return lastCommand; 819 } 820 } 821 return null; 811 Command lastCommand = Main.main.undoRedo.getLastCommand(); 812 if (lastCommand instanceof SequenceCommand) { 813 lastCommand = ((SequenceCommand) lastCommand).getLastCommand(); 814 } 815 if (lastCommand != null && ds.equals(lastCommand.getAffectedDataSet())) { 816 return lastCommand; 817 } else { 818 return null; 819 } 822 820 } 823 821 -
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r11627 r12316 29 29 /** 30 30 * All commands that were made on the dataset. Don't write from outside! 31 * 32 * @see #getLastCommand() 31 33 */ 32 34 public final LinkedList<Command> commands = new LinkedList<>(); … … 43 45 public UndoRedoHandler() { 44 46 Main.getLayerManager().addLayerChangeListener(this); 47 } 48 49 /** 50 * Gets the last command that was executed on the command stack. 51 * @return That command or <code>null</code> if there is no such command. 52 * @since #12316 53 */ 54 public Command getLastCommand() { 55 return commands.peekLast(); 45 56 } 46 57
Note:
See TracChangeset
for help on using the changeset viewer.