Changeset 35452 in osm


Ignore:
Timestamp:
2020-05-15T10:00:32+02:00 (4 years ago)
Author:
gerdp
Message:

see #josm17196: Undo changes inactive layer

  • change plugins which use direct access on UndoRedoHandler.getInstance().commands or UndoRedoHandler.getInstance().redoCommands

These fields should be private to allow a refactoring.

Location:
applications/editors/josm/plugins
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reverter/src/reverter/ReverterUploadHook.java

    r34974 r35452  
    2828    public boolean checkUpload(APIDataSet apiDataSet) {
    2929        if (ReverterPlugin.reverterUsed) {
    30             for (Command cmd : UndoRedoHandler.getInstance().commands) {
     30            for (Command cmd : UndoRedoHandler.getInstance().getUndoCommands()) {
    3131                if (isReverterCmd(cmd)) {
    3232                    MainApplication.getLayerManager().getEditDataSet().addChangeSetTag("created_by", pluginString);
  • applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/DrawSplineAction.java

    r34557 r35452  
    187187                        + ph.sn.cnext.north()) < EPSILON);
    188188            }
    189             if (ph.point == SplinePoint.ENDPOINT && !UndoRedoHandler.getInstance().commands.isEmpty()) {
    190                 Command cmd = UndoRedoHandler.getInstance().commands.getLast();
     189            if (ph.point == SplinePoint.ENDPOINT && UndoRedoHandler.getInstance().hasUndoCommands()) {
     190                Command cmd = UndoRedoHandler.getInstance().getLastCommand();
    191191                if (cmd instanceof MoveCommand) {
    192192                    mc = (MoveCommand) cmd;
     
    198198                }
    199199            }
    200             if (ph.point != SplinePoint.ENDPOINT && !UndoRedoHandler.getInstance().commands.isEmpty()) {
    201                 Command cmd = UndoRedoHandler.getInstance().commands.getLast();
     200            if (ph.point != SplinePoint.ENDPOINT && UndoRedoHandler.getInstance().hasUndoCommands()) {
     201                Command cmd = UndoRedoHandler.getInstance().getLastCommand();
    202202                if (!(cmd instanceof Spline.EditSplineCommand && ((Spline.EditSplineCommand) cmd).sn == ph.sn))
    203203                    dragControl = true;
     
    210210        }
    211211        if (spl.isClosed()) return;
    212         if (direction == 0)
    213             if (spl.nodeCount() < 2)
     212        if (direction == 0) {
     213            if (spl.nodeCount() < 2) {
    214214                direction = 1;
    215             else
     215            } else {
    216216                return;
     217            }
     218        }
    217219        Node n = null;
    218220        boolean existing = false;
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java

    r34932 r35452  
    4141            Command cmd = null;
    4242
    43             if (UndoRedoHandler.getInstance().commands == null) return;
    44             int num = UndoRedoHandler.getInstance().commands.size();
     43            int num = UndoRedoHandler.getInstance().getUndoCommands().size();
    4544            if (num == 0) return;
    4645            int k = 0, idx;
    4746            // check if executed again, we cycle through all available commands
    4847            if (lastCmd != null && !selection.isEmpty()) {
    49                 idx = UndoRedoHandler.getInstance().commands.lastIndexOf(lastCmd);
     48                idx = UndoRedoHandler.getInstance().getUndoCommands().lastIndexOf(lastCmd);
    5049            } else {
    5150                idx = num;
     
    5554            do {  //  select next history element
    5655                if (idx > 0) idx--; else idx = num-1;
    57                 cmd = UndoRedoHandler.getInstance().commands.get(idx);
     56                cmd = UndoRedoHandler.getInstance().getUndoCommands().get(idx);
    5857                if (cmd.getAffectedDataSet() == ds) {
    5958                    Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java

    r34932 r35452  
    4040            Command cmd;
    4141
    42             if (UndoRedoHandler.getInstance().commands == null) return;
    43             int num = UndoRedoHandler.getInstance().commands.size();
     42            int num = UndoRedoHandler.getInstance().getUndoCommands().size();
    4443            if (num == 0) return;
    4544            int k = 0, idx;
    4645            // check if executed again, we cycle through all available commands
    4746            if (lastCmd != null && !ds.getSelectedWays().isEmpty()) {
    48                 idx = UndoRedoHandler.getInstance().commands.lastIndexOf(lastCmd);
     47                idx = UndoRedoHandler.getInstance().getUndoCommands().lastIndexOf(lastCmd);
    4948            } else {
    5049                idx = num;
     
    5453            do {  //  select next history element
    5554                if (idx > 0) idx--; else idx = num-1;
    56                 cmd = UndoRedoHandler.getInstance().commands.get(idx);
     55                cmd = UndoRedoHandler.getInstance().getUndoCommands().get(idx);
    5756                if (cmd.getAffectedDataSet() == ds) {
    5857                    Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
Note: See TracChangeset for help on using the changeset viewer.