Ignore:
Timestamp:
2018-08-11T23:33:58+02:00 (2 months ago)
Author:
Don-vip
Message:

see #15229 - deprecate Main*.undoRedo - make UndoRedoHandler a singleton

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java

    r13943 r14134  
    4040import org.openstreetmap.josm.command.Command;
    4141import org.openstreetmap.josm.command.PseudoCommand;
     42import org.openstreetmap.josm.data.UndoRedoHandler;
    4243import org.openstreetmap.josm.data.UndoRedoHandler.CommandAddedEvent;
    4344import org.openstreetmap.josm.data.UndoRedoHandler.CommandQueueCleanedEvent;
     
    237238            listener.updateEnabledState();
    238239        }
    239         MainApplication.undoRedo.addCommandQueuePreciseListener(this);
     240        UndoRedoHandler.getInstance().addCommandQueuePreciseListener(this);
    240241    }
    241242
     
    255256        undoTreeModel.setRoot(undoRoot);
    256257        redoTreeModel.setRoot(redoRoot);
    257         MainApplication.undoRedo.removeCommandQueuePreciseListener(this);
     258        UndoRedoHandler.getInstance().removeCommandQueuePreciseListener(this);
    258259    }
    259260
     
    270271
    271272    private void buildUndoTree() {
    272         List<Command> undoCommands = MainApplication.undoRedo.commands;
     273        List<Command> undoCommands = UndoRedoHandler.getInstance().commands;
    273274        undoRoot = new DefaultMutableTreeNode();
    274275        for (int i = 0; i < undoCommands.size(); ++i) {
     
    279280
    280281    private void buildRedoTree() {
    281         List<Command> redoCommands = MainApplication.undoRedo.redoCommands;
     282        List<Command> redoCommands = UndoRedoHandler.getInstance().redoCommands;
    282283        redoRoot = new DefaultMutableTreeNode();
    283284        for (int i = 0; i < redoCommands.size(); ++i) {
     
    288289
    289290    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;
    292293        if (redoTreeModel.getChildCount(redoRoot) > 0) {
    293294            redoTree.scrollRowToVisible(0);
     
    505506            case UNDO:
    506507                int numUndo = ((DefaultMutableTreeNode) undoTreeModel.getRoot()).getChildCount() - idx;
    507                 MainApplication.undoRedo.undo(numUndo);
     508                UndoRedoHandler.getInstance().undo(numUndo);
    508509                break;
    509510            case REDO:
    510511                int numRedo = idx+1;
    511                 MainApplication.undoRedo.redo(numRedo);
     512                UndoRedoHandler.getInstance().redo(numRedo);
    512513                break;
    513514            }
Note: See TracChangeset for help on using the changeset viewer.