Changeset 12641 in josm


Ignore:
Timestamp:
2017-08-25T03:01:22+02:00 (4 weeks ago)
Author:
Don-vip
Message:

see #15182 - deprecate Main.main.undoRedo. Replacement: gui.MainApplication.undoRedo

Location:
trunk
Files:
55 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r12639 r12641  
    138138    /**
    139139     * The commands undo/redo handler.
    140      */
    141     public final UndoRedoHandler undoRedo = new UndoRedoHandler();
     140     * @deprecated Use {@link MainApplication#undoRedo} instead
     141     */
     142    @Deprecated
     143    public final UndoRedoHandler undoRedo = MainApplication.undoRedo;
    142144
    143145    /**
     
    446448    /**
    447449     * Platform specific code goes in here.
    448      * Plugins may replace it, however, some hooks will be called before any plugins have been loeaded.
     450     * Plugins may replace it, however, some hooks will be called before any plugins have been loaded.
    449451     * So if you need to hook into those early ones, split your class and send the one with the early hooks
    450452     * to the JOSM team for inclusion.
  • trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java

    r12630 r12641  
    6666
    6767        // add the node
    68         Main.main.undoRedo.add(new AddCommand(nnew));
     68        MainApplication.undoRedo.add(new AddCommand(nnew));
    6969        getLayerManager().getEditDataSet().setSelected(nnew);
    7070        MapView mapView = MainApplication.getMap().mapView;
  • trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java

    r10763 r12641  
    1717import javax.swing.JOptionPane;
    1818
    19 import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.command.Command;
    2120import org.openstreetmap.josm.command.MoveCommand;
     
    2625import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2726import org.openstreetmap.josm.data.osm.Way;
     27import org.openstreetmap.josm.gui.MainApplication;
    2828import org.openstreetmap.josm.gui.Notification;
    2929import org.openstreetmap.josm.tools.Geometry;
     
    283283        }
    284284
    285         Main.main.undoRedo.add(new SequenceCommand(tr("Align Nodes in Circle"), cmds));
     285        MainApplication.undoRedo.add(new SequenceCommand(tr("Align Nodes in Circle"), cmds));
    286286    }
    287287
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r12620 r12641  
    1717import javax.swing.JOptionPane;
    1818
    19 import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.command.Command;
    2120import org.openstreetmap.josm.command.MoveCommand;
     
    2625import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2726import org.openstreetmap.josm.data.osm.Way;
     27import org.openstreetmap.josm.gui.MainApplication;
    2828import org.openstreetmap.josm.gui.Notification;
    2929import org.openstreetmap.josm.tools.Logging;
     
    172172
    173173        try {
    174             Main.main.undoRedo.add(buildCommand());
     174            MainApplication.undoRedo.add(buildCommand());
    175175        } catch (InvalidSelection except) {
    176176            Logging.debug(except);
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r12620 r12641  
    3232import org.openstreetmap.josm.data.preferences.BooleanProperty;
    3333import org.openstreetmap.josm.gui.ExtendedDialog;
     34import org.openstreetmap.josm.gui.MainApplication;
    3435import org.openstreetmap.josm.gui.Notification;
    3536import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog;
     
    173174                if (!reverseWayTagCommands.isEmpty()) {
    174175                    // commands need to be executed for CombinePrimitiveResolverDialog
    175                     Main.main.undoRedo.add(new SequenceCommand(tr("Reverse Ways"), reverseWayTagCommands));
     176                    MainApplication.undoRedo.add(new SequenceCommand(tr("Reverse Ways"), reverseWayTagCommands));
    176177                }
    177178                wayTags = TagCollection.unionOfAllPrimitives(reversedTagWays);
     
    192193            if (!reverseWayTagCommands.isEmpty()) {
    193194                // undo reverseWayTagCorrector and merge into SequenceCommand below
    194                 Main.main.undoRedo.undo();
     195                MainApplication.undoRedo.undo();
    195196            }
    196197        }
     
    236237            return;
    237238        final Way selectedWay = combineResult.a;
    238         Main.main.undoRedo.add(combineResult.b);
     239        MainApplication.undoRedo.add(combineResult.b);
    239240        if (selectedWay != null) {
    240241            GuiHelper.runInEDT(() -> ds.setSelected(selectedWay));
  • trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java

    r10467 r12641  
    2828import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2929import org.openstreetmap.josm.data.osm.Way;
     30import org.openstreetmap.josm.gui.MainApplication;
    3031import org.openstreetmap.josm.gui.Notification;
    3132import org.openstreetmap.josm.tools.Geometry;
     
    240241        }
    241242
    242         Main.main.undoRedo.add(new SequenceCommand(tr("Create Circle"), cmds));
     243        MainApplication.undoRedo.add(new SequenceCommand(tr("Create Circle"), cmds));
    243244    }
    244245
  • trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java

    r12636 r12641  
    107107            // to avoid EDT violations
    108108            SwingUtilities.invokeLater(() -> {
    109                     Main.main.undoRedo.add(command);
     109                    MainApplication.undoRedo.add(command);
    110110
    111111                    // Use 'SwingUtilities.invokeLater' to make sure the relationListDialog
  • trunk/src/org/openstreetmap/josm/actions/DistributeAction.java

    r12620 r12641  
    1616import javax.swing.JOptionPane;
    1717
    18 import org.openstreetmap.josm.Main;
    1918import org.openstreetmap.josm.command.Command;
    2019import org.openstreetmap.josm.command.MoveCommand;
     
    2322import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2423import org.openstreetmap.josm.data.osm.Way;
     24import org.openstreetmap.josm.gui.MainApplication;
    2525import org.openstreetmap.josm.gui.Notification;
    2626import org.openstreetmap.josm.tools.Logging;
     
    9898
    9999        // Do it!
    100         Main.main.undoRedo.add(new SequenceCommand(tr("Distribute Nodes"), cmds));
     100        MainApplication.undoRedo.add(new SequenceCommand(tr("Distribute Nodes"), cmds));
    101101    }
    102102
  • trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java

    r12636 r12641  
    1111import java.util.Set;
    1212
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.actions.mapmode.DrawAction;
    1514import org.openstreetmap.josm.command.ChangeCommand;
     
    115114                newFollower.addNode(newPoint);
    116115            }
    117             Main.main.undoRedo.add(new SequenceCommand(tr("Follow line"),
     116            MainApplication.undoRedo.add(new SequenceCommand(tr("Follow line"),
    118117                    new ChangeCommand(follower, newFollower),
    119118                    new SelectCommand(newFollower.isClosed() // see #10028 - unselect last node when closing a way
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r12636 r12641  
    4141import org.openstreetmap.josm.data.osm.TagCollection;
    4242import org.openstreetmap.josm.data.osm.Way;
     43import org.openstreetmap.josm.gui.MainApplication;
    4344import org.openstreetmap.josm.gui.Notification;
    4445import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog;
     
    569570            //FIXME: this is dirty hack
    570571            makeCommitsOneAction(tr("Reverting changes"));
    571             Main.main.undoRedo.undo();
    572             Main.main.undoRedo.redoCommands.clear();
     572            MainApplication.undoRedo.undo();
     573            MainApplication.undoRedo.redoCommands.clear();
    573574        }
    574575    }
     
    826827    private static void commitCommand(Command c) {
    827828        if (Main.main != null) {
    828             Main.main.undoRedo.add(c);
     829            MainApplication.undoRedo.add(c);
    829830        } else {
    830831            c.executeCommand();
     
    15921593        cmds.clear();
    15931594        if (Main.main != null) {
    1594             UndoRedoHandler ur = Main.main.undoRedo;
     1595            UndoRedoHandler ur = MainApplication.undoRedo;
    15951596            int i = Math.max(ur.commands.size() - cmdsCount, 0);
    15961597            for (; i < ur.commands.size(); i++) {
  • trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java

    r12630 r12641  
    1919import java.util.TreeSet;
    2020
    21 import org.openstreetmap.josm.Main;
    2221import org.openstreetmap.josm.command.ChangeCommand;
    2322import org.openstreetmap.josm.command.Command;
     
    160159
    161160        if (cmds.isEmpty()) return;
    162         Main.main.undoRedo.add(new SequenceCommand(getValue(NAME).toString(), cmds));
     161        MainApplication.undoRedo.add(new SequenceCommand(getValue(NAME).toString(), cmds));
    163162    }
    164163
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r12636 r12641  
    9595            Command cmd = mergeNodes(getLayerManager().getEditLayer(), selectedNodes, targetNode, targetLocationNode);
    9696            if (cmd != null) {
    97                 Main.main.undoRedo.add(cmd);
     97                MainApplication.undoRedo.add(cmd);
    9898                getLayerManager().getEditLayer().data.setSelected(targetNode);
    9999            }
     
    274274            Command cmd = mergeNodes(layer, nodes, target, targetLocationNode);
    275275            if (cmd != null) {
    276                 Main.main.undoRedo.add(cmd);
     276                MainApplication.undoRedo.add(cmd);
    277277                layer.data.setSelected(target);
    278278            }
  • trunk/src/org/openstreetmap/josm/actions/MirrorAction.java

    r10467 r12641  
    1414import javax.swing.JOptionPane;
    1515
    16 import org.openstreetmap.josm.Main;
    1716import org.openstreetmap.josm.command.Command;
    1817import org.openstreetmap.josm.command.MoveCommand;
     
    2120import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2221import org.openstreetmap.josm.data.osm.Way;
     22import org.openstreetmap.josm.gui.MainApplication;
    2323import org.openstreetmap.josm.gui.Notification;
    2424import org.openstreetmap.josm.tools.Shortcut;
     
    8080        }
    8181
    82         Main.main.undoRedo.add(new SequenceCommand(tr("Mirror"), cmds));
     82        MainApplication.undoRedo.add(new SequenceCommand(tr("Mirror"), cmds));
    8383    }
    8484
  • trunk/src/org/openstreetmap/josm/actions/MoveAction.java

    r12637 r12641  
    136136        Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection);
    137137
    138         Command c = Main.main.undoRedo.getLastCommand();
     138        Command c = MainApplication.undoRedo.getLastCommand();
    139139
    140140        ds.beginUpdate();
     
    145145            } else {
    146146                c = new MoveCommand(selection, distx, disty);
    147                 Main.main.undoRedo.add(c);
     147                MainApplication.undoRedo.add(c);
    148148            }
    149149        } finally {
  • trunk/src/org/openstreetmap/josm/actions/MoveNodeAction.java

    r12630 r12641  
    5050
    5151        // move the node
    52         Main.main.undoRedo.add(new MoveCommand(n, coordinates));
     52        MainApplication.undoRedo.add(new MoveCommand(n, coordinates));
    5353        MainApplication.getMap().mapView.repaint();
    5454    }
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r12620 r12641  
    3030import org.openstreetmap.josm.data.osm.Way;
    3131import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
     32import org.openstreetmap.josm.gui.MainApplication;
    3233import org.openstreetmap.josm.gui.Notification;
    3334import org.openstreetmap.josm.tools.JosmRuntimeException;
     
    116117                }
    117118                if (!commands.isEmpty()) {
    118                     Main.main.undoRedo.add(new SequenceCommand(tr("Orthogonalize / Undo"), commands));
     119                    MainApplication.undoRedo.add(new SequenceCommand(tr("Orthogonalize / Undo"), commands));
    119120                } else {
    120121                    throw new InvalidUserInputException("Commands are empty");
     
    165166        try {
    166167            final SequenceCommand command = orthogonalize(sel);
    167             Main.main.undoRedo.add(new SequenceCommand(tr("Orthogonalize"), command));
     168            MainApplication.undoRedo.add(new SequenceCommand(tr("Orthogonalize"), command));
    168169        } catch (InvalidUserInputException ex) {
    169170            Logging.debug(ex);
  • trunk/src/org/openstreetmap/josm/actions/PurgeAction.java

    r12636 r12641  
    3838import org.openstreetmap.josm.data.osm.Way;
    3939import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
     40import org.openstreetmap.josm.gui.MainApplication;
    4041import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    4142import org.openstreetmap.josm.gui.help.HelpUtil;
     
    125126        }
    126127
    127         Main.main.undoRedo.add(cmd);
     128        MainApplication.undoRedo.add(cmd);
    128129        if (clearUndoRedo) {
    129             Main.main.undoRedo.clean();
     130            MainApplication.undoRedo.clean();
    130131            getLayerManager().getEditDataSet().clearSelectionHistory();
    131132        }
  • trunk/src/org/openstreetmap/josm/actions/RedoAction.java

    r12630 r12641  
    3737            return;
    3838        map.repaint();
    39         Main.main.undoRedo.redo();
     39        MainApplication.undoRedo.redo();
    4040    }
    4141
    4242    @Override
    4343    protected void updateEnabledState() {
    44         setEnabled(Main.main != null && !Main.main.undoRedo.redoCommands.isEmpty());
     44        setEnabled(Main.main != null && !MainApplication.undoRedo.redoCommands.isEmpty());
    4545    }
    4646
    4747    @Override
    4848    public void commandChanged(int queueSize, int redoSize) {
    49         if (Main.main.undoRedo.redoCommands.isEmpty()) {
     49        if (MainApplication.undoRedo.redoCommands.isEmpty()) {
    5050            putValue(NAME, tr("Redo"));
    5151            setTooltip(tr("Redo the last undone action."));
     
    5353            putValue(NAME, tr("Redo ..."));
    5454            setTooltip(tr("Redo {0}",
    55                     Main.main.undoRedo.redoCommands.getFirst().getDescriptionText()));
     55                    MainApplication.undoRedo.redoCommands.getFirst().getDescriptionText()));
    5656        }
    5757    }
  • trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java

    r12620 r12641  
    2626import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2727import org.openstreetmap.josm.data.osm.Way;
     28import org.openstreetmap.josm.gui.MainApplication;
    2829import org.openstreetmap.josm.gui.Notification;
    2930import org.openstreetmap.josm.tools.Logging;
     
    137138            c.addAll(revResult.getCommands());
    138139        }
    139         Main.main.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c));
     140        MainApplication.undoRedo.add(new SequenceCommand(tr("Reverse ways"), c));
    140141    }
    141142
  • trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java

    r12527 r12641  
    3232import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    3333import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
     34import org.openstreetmap.josm.gui.MainApplication;
    3435import org.openstreetmap.josm.gui.Notification;
    3536import org.openstreetmap.josm.tools.ImageProvider;
     
    123124                    allCommands
    124125                    );
    125             Main.main.undoRedo.add(rootCommand);
     126            MainApplication.undoRedo.add(rootCommand);
    126127        } finally {
    127128            ds.endUpdate();
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r12636 r12641  
    215215            if (wayToKeep != null) {
    216216                final SplitWayResult result = doSplitWay(getLayerManager().getEditLayer(), selectedWay, wayToKeep, newWays, sel);
    217                 Main.main.undoRedo.add(result.getCommand());
     217                MainApplication.undoRedo.add(result.getCommand());
    218218                if (!result.getNewSelection().isEmpty()) {
    219219                    getLayerManager().getEditDataSet().setSelected(result.getNewSelection());
     
    296296                SplitWayResult result = doSplitWay(MainApplication.getLayerManager().getEditLayer(),
    297297                        selectedWay, list.getSelectedValue(), newWays, selection);
    298                 Main.main.undoRedo.add(result.getCommand());
     298                MainApplication.undoRedo.add(result.getCommand());
    299299                if (!result.getNewSelection().isEmpty()) {
    300300                    MainApplication.getLayerManager().getEditDataSet().setSelected(result.getNewSelection());
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r12630 r12641  
    314314        }
    315315
    316         Main.main.undoRedo.add(new SequenceCommand(tr("Unglued Node"), cmds));
     316        MainApplication.undoRedo.add(new SequenceCommand(tr("Unglued Node"), cmds));
    317317        getLayerManager().getEditDataSet().setSelected(n);
    318318        mv.repaint();
     
    553553     */
    554554    private void execCommands(List<Command> cmds, List<Node> newNodes) {
    555         Main.main.undoRedo.add(new SequenceCommand(/* for correct i18n of plural forms - see #9110 */
     555        MainApplication.undoRedo.add(new SequenceCommand(/* for correct i18n of plural forms - see #9110 */
    556556                trn("Dupe into {0} node", "Dupe into {0} nodes", newNodes.size() + 1L, newNodes.size() + 1L), cmds));
    557557        // select one of the new nodes
     
    641641        notifyWayPartOfRelation(Collections.singleton(selectedWay));
    642642
    643         Main.main.undoRedo.add(new SequenceCommand(
     643        MainApplication.undoRedo.add(new SequenceCommand(
    644644                trn("Dupe {0} node into {1} nodes", "Dupe {0} nodes into {1} nodes",
    645645                        selectedNodes.size(), selectedNodes.size(), selectedNodes.size()+allNewNodes.size()), cmds));
  • trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java

    r12031 r12641  
    1515import javax.swing.JOptionPane;
    1616
    17 import org.openstreetmap.josm.Main;
    1817import org.openstreetmap.josm.command.RemoveNodesCommand;
    1918import org.openstreetmap.josm.data.osm.Node;
    2019import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2120import org.openstreetmap.josm.data.osm.Way;
     21import org.openstreetmap.josm.gui.MainApplication;
    2222import org.openstreetmap.josm.gui.Notification;
    2323import org.openstreetmap.josm.tools.Shortcut;
     
    8989
    9090        // I'm sure there's a better way to handle this
    91         Main.main.undoRedo.add(new RemoveNodesCommand(selectedWay, selectedNodes));
     91        MainApplication.undoRedo.add(new RemoveNodesCommand(selectedWay, selectedNodes));
    9292    }
    9393
  • trunk/src/org/openstreetmap/josm/actions/UndoAction.java

    r12630 r12641  
    3737            return;
    3838        map.repaint();
    39         Main.main.undoRedo.undo();
     39        MainApplication.undoRedo.undo();
    4040    }
    4141
    4242    @Override
    4343    protected void updateEnabledState() {
    44         setEnabled(Main.main != null && !Main.main.undoRedo.commands.isEmpty());
     44        setEnabled(Main.main != null && !MainApplication.undoRedo.commands.isEmpty());
    4545    }
    4646
    4747    @Override
    4848    public void commandChanged(int queueSize, int redoSize) {
    49         if (Main.main.undoRedo.commands.isEmpty()) {
     49        if (MainApplication.undoRedo.commands.isEmpty()) {
    5050            putValue(NAME, tr("Undo"));
    5151            setTooltip(tr("Undo the last action."));
     
    5353            putValue(NAME, tr("Undo ..."));
    5454            setTooltip(tr("Undo {0}",
    55                     Main.main.undoRedo.commands.getLast().getDescriptionText()));
     55                    MainApplication.undoRedo.commands.getLast().getDescriptionText()));
    5656        }
    5757    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r12636 r12641  
    157157        // if c is null, an error occurred or the user aborted. Don't do anything in that case.
    158158        if (c != null) {
    159             Main.main.undoRedo.add(c);
     159            MainApplication.undoRedo.add(c);
    160160            //FIXME: This should not be required, DeleteCommand should update the selection, otherwise undo/redo won't work.
    161161            lm.getEditDataSet().setSelected();
     
    304304        Command c = buildDeleteCommands(e, e.getModifiersEx(), false);
    305305        if (c != null) {
    306             Main.main.undoRedo.add(c);
     306            MainApplication.undoRedo.add(c);
    307307        }
    308308
     
    355355        if (cmd != null) {
    356356            // cmd can be null if the user cancels dialogs DialogCommand displays
    357             Main.main.undoRedo.add(cmd);
     357            MainApplication.undoRedo.add(cmd);
    358358            for (Relation relation : toDelete) {
    359359                if (layer.data.getSelectedRelations().contains(relation)) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r12639 r12641  
    617617        Command c = new SequenceCommand(title, cmds);
    618618
    619         Main.main.undoRedo.add(c);
     619        MainApplication.undoRedo.add(c);
    620620        if (!wayIsFinished) {
    621621            lastUsedNode = n;
     
    13341334        @Override
    13351335        public void actionPerformed(ActionEvent e) {
    1336             Main.main.undoRedo.undo();
    1337             Command lastCmd = Main.main.undoRedo.getLastCommand();
     1336            MainApplication.undoRedo.undo();
     1337            Command lastCmd = MainApplication.undoRedo.getLastCommand();
    13381338            if (lastCmd == null) return;
    13391339            Node n = null;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r12636 r12641  
    496496                        moveCommand2 = new MoveCommand(movingNodeList.get(1), movement2.getX(), movement2.getY());
    497497                        Command c = new SequenceCommand(tr("Extrude Way"), moveCommand, moveCommand2);
    498                         Main.main.undoRedo.add(c);
     498                        MainApplication.undoRedo.add(c);
    499499                    } else {
    500500                        // reuse existing move commands
     
    511511                        //make a new move command
    512512                        moveCommand = new MoveCommand(new ArrayList<OsmPrimitive>(movingNodeList), bestMovement);
    513                         Main.main.undoRedo.add(moveCommand);
     513                        MainApplication.undoRedo.add(moveCommand);
    514514                    } else {
    515515                        //reuse existing move command
     
    594594            SequenceCommand cmds = new SequenceCommand(tr("Add a new node to an existing way"),
    595595                    new AddCommand(n), new ChangeCommand(ws.way, wnew));
    596             Main.main.undoRedo.add(cmds);
     596            MainApplication.undoRedo.add(cmds);
    597597        }
    598598    }
     
    624624        cmds.add(new AddCommand(wnew));
    625625        Command c = new SequenceCommand(tr("Extrude Way"), cmds);
    626         Main.main.undoRedo.add(c);
     626        MainApplication.undoRedo.add(c);
    627627        getLayerManager().getEditDataSet().setSelected(wnew);
    628628    }
     
    712712        }
    713713        Command c = new SequenceCommand(tr("Extrude Way"), cmds);
    714         Main.main.undoRedo.add(c);
     714        MainApplication.undoRedo.add(c);
    715715        joinNodesIfCollapsed(changedNodes);
    716716    }
     
    724724        Command mergeCmd = MergeNodesAction.mergeNodes(MainApplication.getLayerManager().getEditLayer(), changedNodes, targetNode, locNode);
    725725        if (mergeCmd != null) {
    726             Main.main.undoRedo.add(mergeCmd);
     726            MainApplication.undoRedo.add(mergeCmd);
    727727        } else {
    728728            // undo extruding command itself
    729             Main.main.undoRedo.undo();
     729            MainApplication.undoRedo.undo();
    730730        }
    731731    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r12630 r12641  
    473473                        virtualSegments.size(), virtualSegments.size());
    474474
    475                 Main.main.undoRedo.add(new SequenceCommand(text, virtualCmds));
     475                MainApplication.undoRedo.add(new SequenceCommand(text, virtualCmds));
    476476
    477477            } else if (alt && !ctrl && candidateNode != null) {
     
    490490                        final Command deleteCmd = DeleteCommand.delete(getLayerManager().getEditLayer(), Collections.singleton(targetWay), true);
    491491                        if (deleteCmd != null) {
    492                             Main.main.undoRedo.add(deleteCmd);
     492                            MainApplication.undoRedo.add(deleteCmd);
    493493                        }
    494494                    } else {
    495                         Main.main.undoRedo.add(new ChangeCommand(targetWay, newWay));
     495                        MainApplication.undoRedo.add(new ChangeCommand(targetWay, newWay));
    496496                    }
    497497                } else if (candidateNode.isTagged()) {
     
    502502                    final Command deleteCmd = DeleteCommand.delete(getLayerManager().getEditLayer(), Collections.singleton(candidateNode), true);
    503503                    if (deleteCmd != null) {
    504                         Main.main.undoRedo.add(deleteCmd);
     504                        MainApplication.undoRedo.add(deleteCmd);
    505505                    }
    506506                }
     
    512512                EastNorth cursorEN = mv.getEastNorth(mousePos.x, mousePos.y);
    513513
    514                 Main.main.undoRedo.add(new MoveCommand(candidateNode, cursorEN.east() - nodeEN.east(), cursorEN.north() - nodeEN.north()));
     514                MainApplication.undoRedo.add(new MoveCommand(candidateNode, cursorEN.east() - nodeEN.east(), cursorEN.north() - nodeEN.north()));
    515515            }
    516516        }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWays.java

    r12463 r12641  
    1111import java.util.Set;
    1212
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.command.AddCommand;
    1514import org.openstreetmap.josm.command.Command;
     
    1918import org.openstreetmap.josm.data.osm.NodeGraph;
    2019import org.openstreetmap.josm.data.osm.Way;
     20import org.openstreetmap.josm.gui.MainApplication;
    2121import org.openstreetmap.josm.tools.Geometry;
    2222
     
    182182     */
    183183    public void commit() {
    184         Main.main.undoRedo.add(new SequenceCommand("Make parallel way(s)", makeAddWayAndNodesCommandList()));
     184        MainApplication.undoRedo.add(new SequenceCommand("Make parallel way(s)", makeAddWayAndNodesCommandList()));
    185185    }
    186186
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r12636 r12641  
    711711                } else {
    712712                    c = new MoveCommand(selection, startEN, currentEN);
    713                     Main.main.undoRedo.add(c);
     713                    MainApplication.undoRedo.add(c);
    714714                }
    715715                for (Node n : affectedNodes) {
     
    744744                        ((RotateCommand) c).handleEvent(currentEN);
    745745                    } else {
    746                         Main.main.undoRedo.add(new RotateCommand(selection, currentEN));
     746                        MainApplication.undoRedo.add(new RotateCommand(selection, currentEN));
    747747                    }
    748748                } else if (mode == Mode.SCALE) {
     
    750750                        ((ScaleCommand) c).handleEvent(currentEN);
    751751                    } else {
    752                         Main.main.undoRedo.add(new ScaleCommand(selection, currentEN));
     752                        MainApplication.undoRedo.add(new ScaleCommand(selection, currentEN));
    753753                    }
    754754                }
     
    799799     */
    800800    private static Command getLastCommandInDataset(DataSet ds) {
    801         Command lastCommand = Main.main.undoRedo.getLastCommand();
     801        Command lastCommand = MainApplication.undoRedo.getLastCommand();
    802802        if (lastCommand instanceof SequenceCommand) {
    803803            lastCommand = ((SequenceCommand) lastCommand).getLastCommand();
     
    825825            ed.showDialog();
    826826            if (ed.getValue() != 1) {
    827                 Main.main.undoRedo.undo();
     827                MainApplication.undoRedo.undo();
    828828            }
    829829        }
     
    848848
    849849            if (ed.getValue() != 1) {
    850                 Main.main.undoRedo.undo();
     850                MainApplication.undoRedo.undo();
    851851            }
    852852        } else {
     
    12471247                    "Add and move a virtual new node to {0} ways", virtualWays.size(),
    12481248                    virtualWays.size());
    1249             Main.main.undoRedo.add(new SequenceCommand(text, virtualCmds));
     1249            MainApplication.undoRedo.add(new SequenceCommand(text, virtualCmds));
    12501250            getLayerManager().getEditDataSet().setSelected(Collections.singleton((OsmPrimitive) virtualNode));
    12511251            clear();
  • trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java

    r12636 r12641  
    1111import javax.swing.JOptionPane;
    1212
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.command.Command;
    1514import org.openstreetmap.josm.command.SequenceCommand;
     
    4645        }
    4746        if (!cmds.isEmpty()) {
    48             Main.main.undoRedo.add(new SequenceCommand(tr("Add selection to relation"), cmds));
     47            MainApplication.undoRedo.add(new SequenceCommand(tr("Add selection to relation"), cmds));
    4948            new Notification(
    5049                    "<html>"+
  • trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java

    r12639 r12641  
    1818import javax.swing.plaf.basic.BasicArrowButton;
    1919
    20 import org.openstreetmap.josm.Main;
    2120import org.openstreetmap.josm.actions.JosmAction;
    2221import org.openstreetmap.josm.data.osm.Relation;
     
    5049        arrow = editButton.createArrow(this);
    5150        arrow.setToolTipText(tr("List of recent relations"));
    52         Main.main.undoRedo.addCommandQueueListener(this);
     51        MainApplication.undoRedo.addCommandQueueListener(this);
    5352        enableArrow();
    5453        shortcut = Shortcut.registerShortcut(
  • trunk/src/org/openstreetmap/josm/actions/upload/DiscardTagsHook.java

    r8338 r12641  
    1010import java.util.Map;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.command.ChangePropertyCommand;
    1413import org.openstreetmap.josm.command.SequenceCommand;
    1514import org.openstreetmap.josm.data.APIDataSet;
    1615import org.openstreetmap.josm.data.osm.OsmPrimitive;
     16import org.openstreetmap.josm.gui.MainApplication;
    1717
    1818/**
     
    4444            SequenceCommand removeKeys = new SequenceCommand(tr("Removed obsolete tags"),
    4545                    new ChangePropertyCommand(objectsToUpload, map));
    46             Main.main.undoRedo.add(removeKeys);
     46            MainApplication.undoRedo.add(removeKeys);
    4747        }
    4848        return true;
  • trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java

    r12288 r12641  
    2020import org.openstreetmap.josm.data.osm.Relation;
    2121import org.openstreetmap.josm.data.osm.Tag;
     22import org.openstreetmap.josm.gui.MainApplication;
    2223
    2324/**
     
    204205
    205206            if (!cmds.isEmpty()) {
    206                 Main.main.undoRedo.add(new SequenceCommand(tr("Fix deprecated tags"), cmds));
     207                MainApplication.undoRedo.add(new SequenceCommand(tr("Fix deprecated tags"), cmds));
    207208            }
    208209        }
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12639 r12641  
    6969import org.openstreetmap.josm.actions.search.SearchAction;
    7070import org.openstreetmap.josm.data.Bounds;
     71import org.openstreetmap.josm.data.UndoRedoHandler;
    7172import org.openstreetmap.josm.data.Version;
    7273import org.openstreetmap.josm.data.osm.DataSet;
     
    164165
    165166    /**
     167     * The commands undo/redo handler.
     168     * @since 12641 (as a replacement to {@code Main.main.undoRedo})
     169     */
     170    public static final UndoRedoHandler undoRedo = new UndoRedoHandler();
     171
     172    /**
    166173     * Provides access to the layers displayed in the main view.
    167174     */
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r12636 r12641  
    678678
    679679        add(editMenu, undo);
    680         Main.main.undoRedo.addCommandQueueListener(undo);
     680        MainApplication.undoRedo.addCommandQueueListener(undo);
    681681        add(editMenu, redo);
    682         Main.main.undoRedo.addCommandQueueListener(redo);
     682        MainApplication.undoRedo.addCommandQueueListener(redo);
    683683        editMenu.addSeparator();
    684684        add(editMenu, copy);
  • trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractTagPaster.java

    r10737 r12641  
    1414import javax.swing.TransferHandler.TransferSupport;
    1515
    16 import org.openstreetmap.josm.Main;
    1716import org.openstreetmap.josm.command.ChangePropertyCommand;
    1817import org.openstreetmap.josm.command.Command;
     
    2019import org.openstreetmap.josm.data.coor.EastNorth;
    2120import org.openstreetmap.josm.data.osm.OsmPrimitive;
     21import org.openstreetmap.josm.gui.MainApplication;
    2222import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2323import org.openstreetmap.josm.tools.I18n;
     
    6565            @I18n.QuirkyPluralString
    6666            final String title = title1 + ' ' + title2;
    67             Main.main.undoRedo.add(new SequenceCommand(title, commands));
     67            MainApplication.undoRedo.add(new SequenceCommand(title, commands));
    6868        }
    6969    }
  • trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java

    r12279 r12641  
    2424import org.openstreetmap.josm.data.osm.WayData;
    2525import org.openstreetmap.josm.gui.ExtendedDialog;
     26import org.openstreetmap.josm.gui.MainApplication;
    2627import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
    2728import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    5758
    5859        /* Now execute the commands to add the duplicated contents of the paste buffer to the map */
    59         Main.main.undoRedo.add(command);
     60        MainApplication.undoRedo.add(command);
    6061        return true;
    6162    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java

    r12636 r12641  
    3636import javax.swing.tree.TreeSelectionModel;
    3737
    38 import org.openstreetmap.josm.Main;
    3938import org.openstreetmap.josm.actions.AutoScaleAction;
    4039import org.openstreetmap.josm.command.Command;
     
    233232            listener.updateEnabledState();
    234233        }
    235         Main.main.undoRedo.addCommandQueueListener(this);
     234        MainApplication.undoRedo.addCommandQueueListener(this);
    236235    }
    237236
     
    249248        undoTreeModel.setRoot(new DefaultMutableTreeNode());
    250249        redoTreeModel.setRoot(new DefaultMutableTreeNode());
    251         Main.main.undoRedo.removeCommandQueueListener(this);
     250        MainApplication.undoRedo.removeCommandQueueListener(this);
    252251    }
    253252
     
    261260            return;
    262261
    263         List<Command> undoCommands = Main.main.undoRedo.commands;
     262        List<Command> undoCommands = MainApplication.undoRedo.commands;
    264263        DefaultMutableTreeNode undoRoot = new DefaultMutableTreeNode();
    265264        for (int i = 0; i < undoCommands.size(); ++i) {
     
    268267        undoTreeModel.setRoot(undoRoot);
    269268
    270         List<Command> redoCommands = Main.main.undoRedo.redoCommands;
     269        List<Command> redoCommands = MainApplication.undoRedo.redoCommands;
    271270        DefaultMutableTreeNode redoRoot = new DefaultMutableTreeNode();
    272271        for (int i = 0; i < redoCommands.size(); ++i) {
     
    457456            case UNDO:
    458457                int numUndo = ((DefaultMutableTreeNode) undoTreeModel.getRoot()).getChildCount() - idx;
    459                 Main.main.undoRedo.undo(numUndo);
     458                MainApplication.undoRedo.undo(numUndo);
    460459                break;
    461460            case REDO:
    462461                int numRedo = idx+1;
    463                 Main.main.undoRedo.redo(numRedo);
     462                MainApplication.undoRedo.redo(numRedo);
    464463                break;
    465464            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r12636 r12641  
    520520                }
    521521            }
    522             Main.main.undoRedo.add(new SequenceCommand(name, commands));
     522            MainApplication.undoRedo.add(new SequenceCommand(name, commands));
    523523            refreshView();
    524524        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java

    r12279 r12641  
    2121import org.openstreetmap.josm.gui.DefaultNameFormatter;
    2222import org.openstreetmap.josm.gui.ExtendedDialog;
     23import org.openstreetmap.josm.gui.MainApplication;
    2324import org.openstreetmap.josm.gui.conflict.pair.ConflictResolver;
    2425import org.openstreetmap.josm.gui.help.HelpBrowser;
     
    203204                }
    204205            }
    205             Main.main.undoRedo.add(resolver.buildResolveCommand());
     206            MainApplication.undoRedo.add(resolver.buildResolveCommand());
    206207            buttonAction(1, evt);
    207208        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

    r12636 r12641  
    613613                final Command fixCommand = error.getFix();
    614614                if (fixCommand != null) {
    615                     SwingUtilities.invokeAndWait(() -> Main.main.undoRedo.addNoRedraw(fixCommand));
     615                    SwingUtilities.invokeAndWait(() -> MainApplication.undoRedo.addNoRedraw(fixCommand));
    616616                }
    617617                // It is wanted to ignore an error if it said fixable, even if fixCommand was null
     
    644644                monitor.subTask(tr("Updating map ..."));
    645645                SwingUtilities.invokeAndWait(() -> {
    646                     Main.main.undoRedo.afterAdd();
     646                    MainApplication.undoRedo.afterAdd();
    647647                    MainApplication.getLayerManager().getLayersOfType(ValidatorLayer.class).forEach(ValidatorLayer::invalidate);
    648648                    tree.resetErrors();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r12639 r12641  
    830830            Command command = TaggingPreset.createCommand(getSelection(), tags);
    831831            if (command != null) {
    832                 Main.main.undoRedo.add(command);
     832                MainApplication.undoRedo.add(command);
    833833            }
    834834        }
     
    997997
    998998            Collection<OsmPrimitive> sel = Main.main.getInProgressSelection();
    999             Main.main.undoRedo.add(new ChangePropertyCommand(sel, tags));
     999            MainApplication.undoRedo.add(new ChangePropertyCommand(sel, tags));
    10001000
    10011001            membershipTable.clearSelection();
     
    10281028                rel.removeMembersFor(primitive);
    10291029            }
    1030             Main.main.undoRedo.add(new ChangeCommand(cur, rel));
     1030            MainApplication.undoRedo.add(new ChangeCommand(cur, rel));
    10311031
    10321032            tagTable.clearSelection();
     
    12661266            if (sel.isEmpty() || clipboard == null)
    12671267                return;
    1268             Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, Utils.strip(clipboard)));
     1268            MainApplication.undoRedo.add(new ChangePropertyCommand(sel, key, Utils.strip(clipboard)));
    12691269        }
    12701270    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r12636 r12641  
    507507                return;
    508508            if (key.equals(newkey) || value == null) {
    509                 Main.main.undoRedo.add(new ChangePropertyCommand(sel, newkey, value));
     509                MainApplication.undoRedo.add(new ChangePropertyCommand(sel, newkey, value));
    510510                AutoCompletionManager.rememberUserInput(newkey, value, true);
    511511            } else {
     
    541541                    AutoCompletionManager.rememberUserInput(newkey, value, false);
    542542                }
    543                 Main.main.undoRedo.add(new SequenceCommand(
     543                MainApplication.undoRedo.add(new SequenceCommand(
    544544                        trn("Change properties of up to {0} object",
    545545                                "Change properties of up to {0} objects", sel.size(), sel.size()),
     
    10681068            AutoCompletionManager.rememberUserInput(key, value, false);
    10691069            commandCount++;
    1070             Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, value));
     1070            MainApplication.undoRedo.add(new ChangePropertyCommand(sel, key, value));
    10711071            changedKey = key;
    10721072            clearEntries();
     
    10791079
    10801080        public void undoAllTagsAdding() {
    1081             Main.main.undoRedo.undo(commandCount);
     1081            MainApplication.undoRedo.undo(commandCount);
    10821082        }
    10831083
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java

    r9661 r12641  
    1414import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    1515import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
     16import org.openstreetmap.josm.gui.MainApplication;
    1617import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1718import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
     
    5051            ((JComponent) editor).getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), "refresh");
    5152        }
    52         Main.main.undoRedo.addCommandQueueListener(this);
     53        MainApplication.undoRedo.addCommandQueueListener(this);
    5354        updateEnabledState();
    5455    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java

    r12630 r12641  
    7373        if (newRelation.getMembersCount() == 0 && !newRelation.hasKeys())
    7474            return;
    75         Main.main.undoRedo.add(new AddCommand(layer, newRelation));
     75        MainApplication.undoRedo.add(new AddCommand(layer, newRelation));
    7676
    7777        // make sure everybody is notified about the changes
     
    9595        memberTableModel.applyToRelation(editedRelation);
    9696        Conflict<Relation> conflict = new Conflict<>(editor.getRelation(), editedRelation);
    97         Main.main.undoRedo.add(new ConflictAddCommand(layer, conflict));
     97        MainApplication.undoRedo.add(new ConflictAddCommand(layer, conflict));
    9898    }
    9999
     
    107107        memberTableModel.applyToRelation(editedRelation);
    108108        if (!editedRelation.hasEqualSemanticAttributes(editor.getRelation(), false)) {
    109             Main.main.undoRedo.add(new ChangeCommand(editor.getRelation(), editedRelation));
     109            MainApplication.undoRedo.add(new ChangeCommand(editor.getRelation(), editedRelation));
    110110        }
    111111    }
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r12636 r12641  
    609609            return;
    610610
    611         Main.main.undoRedo.clean(this);
     611        MainApplication.undoRedo.clean(this);
    612612
    613613        // if uploaded, clean the modified flags as well
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

    r12637 r12641  
    398398            Command cmd = createCommand(sel, getChangedTags());
    399399            if (cmd != null) {
    400                 Main.main.undoRedo.add(cmd);
     400                MainApplication.undoRedo.add(cmd);
    401401            }
    402402        } else if (answer == DIALOG_ANSWER_NEW_RELATION) {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java

    r12636 r12641  
    258258                    String key = (String) tm.getValueAt(i, 1);
    259259                    Object value = tm.getValueAt(i, 2);
    260                     Main.main.undoRedo.add(new ChangePropertyCommand(sel,
     260                    MainApplication.undoRedo.add(new ChangePropertyCommand(sel,
    261261                            key, value instanceof String ? (String) value : ""));
    262262                }
     
    312312            if (MainApplication.getLayerManager().getEditDataSet() != null) {
    313313                for (String[] row : keyValue) {
    314                     Main.main.undoRedo.add(new ChangePropertyCommand(primitives, row[0], row[1]));
     314                    MainApplication.undoRedo.add(new ChangePropertyCommand(primitives, row[0], row[1]));
    315315                }
    316316            }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java

    r12636 r12641  
    9999            node = new Node(ll);
    100100            // Now execute the commands to add this node.
    101             Main.main.undoRedo.add(new AddCommand(node));
     101            MainApplication.undoRedo.add(new AddCommand(node));
    102102        }
    103103
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

    r12636 r12641  
    167167        allCoordinates.clear();
    168168        commands.add(new AddCommand(way));
    169         Main.main.undoRedo.add(new SequenceCommand(tr("Add way"), commands));
     169        MainApplication.undoRedo.add(new SequenceCommand(tr("Add way"), commands));
    170170        MainApplication.getLayerManager().getEditDataSet().setSelected(way);
    171171        if (PermissionPrefWithDefault.CHANGE_VIEWPORT.isAllowed()) {
  • trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java

    r12636 r12641  
    199199        final SplitWayAction.SplitWayResult result = SplitWayAction.splitWay(
    200200                layer, w2, SplitWayAction.buildSplitChunks(w2, Arrays.asList(n3, n4, n5)), new ArrayList<OsmPrimitive>(), strategy);
    201         Main.main.undoRedo.add(result.getCommand());
     201        MainApplication.undoRedo.add(result.getCommand());
    202202
    203203        assertEquals(6, route.getMembersCount());
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java

    r12636 r12641  
    1717import org.junit.Rule;
    1818import org.junit.Test;
    19 import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.data.coor.EastNorth;
    2120import org.openstreetmap.josm.data.osm.DataSet;
     
    9392            assertNotNull(renderer.getListCellRendererComponent(lstPrimitives, n3, 0, false, false));
    9493
    95             Main.main.undoRedo.undo();
     94            MainApplication.undoRedo.undo();
    9695
    9796            assertEquals(2, w.getNodesCount());
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java

    r12563 r12641  
    1212import org.junit.Rule;
    1313import org.junit.Test;
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.command.PseudoCommand;
    1615import org.openstreetmap.josm.command.SequenceCommand;
     
    2019import org.openstreetmap.josm.data.osm.Relation;
    2120import org.openstreetmap.josm.data.osm.Way;
     21import org.openstreetmap.josm.gui.MainApplication;
    2222import org.openstreetmap.josm.testutils.JOSMTestRules;
    2323
     
    4242    public void testCheckUpload() {
    4343        // Empty data set
    44         Main.main.undoRedo.commands.clear();
     44        MainApplication.undoRedo.commands.clear();
    4545        new FixDataHook().checkUpload(new APIDataSet());
    46         assertTrue(Main.main.undoRedo.commands.isEmpty());
     46        assertTrue(MainApplication.undoRedo.commands.isEmpty());
    4747
    4848        // Complete data set
     
    7777        ads.init(Arrays.asList(emptyNode, emptyWay, emptyRelation, w1, w2, w3, w4, w5, w6, w7, r1, r2));
    7878
    79         Main.main.undoRedo.commands.clear();
     79        MainApplication.undoRedo.commands.clear();
    8080        new FixDataHook().checkUpload(ads);
    81         assertEquals(1, Main.main.undoRedo.commands.size());
     81        assertEquals(1, MainApplication.undoRedo.commands.size());
    8282
    83         SequenceCommand seq = (SequenceCommand) Main.main.undoRedo.commands.iterator().next();
     83        SequenceCommand seq = (SequenceCommand) MainApplication.undoRedo.commands.iterator().next();
    8484        Collection<? extends OsmPrimitive> prims = seq.getParticipatingPrimitives();
    8585        assertNotNull(prims);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java

    r12636 r12641  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.TestUtils;
    1110import org.openstreetmap.josm.command.Command;
     
    5251            Command cmd1 = TestUtils.newCommand();
    5352            Command cmd2 = TestUtils.newCommand();
    54             Main.main.undoRedo.add(cmd1);
    55             Main.main.undoRedo.add(cmd2);
    56             Main.main.undoRedo.undo(1);
     53            MainApplication.undoRedo.add(cmd1);
     54            MainApplication.undoRedo.add(cmd2);
     55            MainApplication.undoRedo.undo(1);
    5756
    58             assertFalse(Main.main.undoRedo.commands.isEmpty());
    59             assertFalse(Main.main.undoRedo.redoCommands.isEmpty());
     57            assertFalse(MainApplication.undoRedo.commands.isEmpty());
     58            assertFalse(MainApplication.undoRedo.redoCommands.isEmpty());
    6059
    6160            MapFrame map = MainApplication.getMap();
     
    6867            assertFalse(dlg.isVisible());
    6968        } finally {
    70             Main.main.undoRedo.clean();
     69            MainApplication.undoRedo.clean();
    7170            MainApplication.getLayerManager().removeLayer(layer);
    7271        }
Note: See TracChangeset for help on using the changeset viewer.