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

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

Location:
trunk/src/org/openstreetmap/josm/actions/mapmode
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 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();
Note: See TracChangeset for help on using the changeset viewer.