- Timestamp:
- 2018-09-30T00:46:01+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r14143 r14281 569 569 if (addUndoRedo) { 570 570 UndoRedoHandler.getInstance().undo(); 571 UndoRedoHandler.getInstance(). redoCommands.clear();571 UndoRedoHandler.getInstance().getRedoCommands().clear(); 572 572 } 573 573 } … … 1601 1601 if (addUndoRedo) { 1602 1602 UndoRedoHandler ur = UndoRedoHandler.getInstance(); 1603 int i = Math.max(ur.commands.size() - cmdsCount, 0); 1604 for (; i < ur.commands.size(); i++) { 1605 cmds.add(ur.commands.get(i)); 1603 List<Command> commands = ur.getUndoCommands(); 1604 int i = Math.max(commands.size() - cmdsCount, 0); 1605 for (; i < commands.size(); i++) { 1606 cmds.add(commands.get(i)); 1606 1607 } 1607 1608 -
trunk/src/org/openstreetmap/josm/actions/RedoAction.java
r14143 r14281 42 42 @Override 43 43 protected void updateEnabledState() { 44 setEnabled( !UndoRedoHandler.getInstance().redoCommands.isEmpty());44 setEnabled(UndoRedoHandler.getInstance().hasRedoCommands()); 45 45 } 46 46 47 47 @Override 48 48 public void commandChanged(int queueSize, int redoSize) { 49 if ( UndoRedoHandler.getInstance().redoCommands.isEmpty()) {49 if (!UndoRedoHandler.getInstance().hasRedoCommands()) { 50 50 putValue(NAME, tr("Redo")); 51 51 setTooltip(tr("Redo the last undone action.")); … … 53 53 putValue(NAME, tr("Redo ...")); 54 54 setTooltip(tr("Redo {0}", 55 UndoRedoHandler.getInstance(). redoCommands.getFirst().getDescriptionText()));55 UndoRedoHandler.getInstance().getRedoCommands().getFirst().getDescriptionText())); 56 56 } 57 57 } -
trunk/src/org/openstreetmap/josm/actions/UndoAction.java
r14143 r14281 42 42 @Override 43 43 protected void updateEnabledState() { 44 setEnabled( !UndoRedoHandler.getInstance().commands.isEmpty());44 setEnabled(UndoRedoHandler.getInstance().hasUndoCommands()); 45 45 } 46 46 47 47 @Override 48 48 public void commandChanged(int queueSize, int redoSize) { 49 if ( UndoRedoHandler.getInstance().commands.isEmpty()) {49 if (!UndoRedoHandler.getInstance().hasUndoCommands()) { 50 50 putValue(NAME, tr("Undo")); 51 51 setTooltip(tr("Undo the last action.")); … … 53 53 putValue(NAME, tr("Undo ...")); 54 54 setTooltip(tr("Undo {0}", 55 UndoRedoHandler.getInstance(). commands.getLast().getDescriptionText()));55 UndoRedoHandler.getInstance().getLastCommand().getDescriptionText())); 56 56 } 57 57 } -
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r14220 r14281 25 25 * 26 26 * @see #getLastCommand() 27 * @see #getUndoCommands() 27 28 */ 28 29 public final LinkedList<Command> commands = new LinkedList<>(); 30 29 31 /** 30 32 * The stack for redoing commands 33 34 * @see #getRedoCommands() 31 35 */ 32 36 public final LinkedList<Command> redoCommands = new LinkedList<>(); … … 232 236 233 237 /** 238 * Returns all commands that were made on the dataset, that can be undone. 239 * @return all commands that were made on the dataset, that can be undone 240 * @since 14281 241 */ 242 public LinkedList<Command> getUndoCommands() { 243 return new LinkedList<>(commands); 244 } 245 246 /** 247 * Returns all commands that were made and undone on the dataset, that can be redone. 248 * @return all commands that were made and undone on the dataset, that can be redone. 249 * @since 14281 250 */ 251 public LinkedList<Command> getRedoCommands() { 252 return new LinkedList<>(redoCommands); 253 } 254 255 /** 234 256 * Gets the last command that was executed on the command stack. 235 257 * @return That command or <code>null</code> if there is no such command. … … 238 260 public Command getLastCommand() { 239 261 return commands.peekLast(); 262 } 263 264 /** 265 * Determines if commands can be undone. 266 * @return {14281 true} if at least a command can be undone 267 * @since xxx 268 */ 269 public boolean hasUndoCommands() { 270 return !commands.isEmpty(); 271 } 272 273 /** 274 * Determines if commands can be redone. 275 * @return {@code true} if at least a command can be redone 276 * @since 14281 277 */ 278 public boolean hasRedoCommands() { 279 return !redoCommands.isEmpty(); 240 280 } 241 281 -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r14221 r14281 272 272 273 273 private void buildUndoTree() { 274 List<Command> undoCommands = UndoRedoHandler.getInstance(). commands;274 List<Command> undoCommands = UndoRedoHandler.getInstance().getUndoCommands(); 275 275 undoRoot = new DefaultMutableTreeNode(); 276 276 for (int i = 0; i < undoCommands.size(); ++i) { … … 281 281 282 282 private void buildRedoTree() { 283 List<Command> redoCommands = UndoRedoHandler.getInstance(). redoCommands;283 List<Command> redoCommands = UndoRedoHandler.getInstance().getRedoCommands(); 284 284 redoRoot = new DefaultMutableTreeNode(); 285 285 for (int i = 0; i < redoCommands.size(); ++i) { … … 290 290 291 291 private void ensureTreesConsistency() { 292 List<Command> undoCommands = UndoRedoHandler.getInstance(). commands;293 List<Command> redoCommands = UndoRedoHandler.getInstance(). redoCommands;292 List<Command> undoCommands = UndoRedoHandler.getInstance().getUndoCommands(); 293 List<Command> redoCommands = UndoRedoHandler.getInstance().getRedoCommands(); 294 294 if (redoTreeModel.getChildCount(redoRoot) > 0) { 295 295 redoTree.scrollRowToVisible(0);
Note:
See TracChangeset
for help on using the changeset viewer.