Ignore:
Timestamp:
2020-10-29T00:14:19+01:00 (4 years ago)
Author:
simon04
Message:

Add EditLevel0LActionTest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/comfort0/src/net/simon04/comfort0/EditLevel0LAction.java

    r35622 r35627  
    107107    static List<PrimitiveData> readLevel0(Reader reader, final DataSet dataSet) throws ParseException {
    108108        final List<PrimitiveData> primitives = new Level0LParser(reader).primitives();
    109         buildChangeCommands(dataSet, primitives);
     109        final SequenceCommand command = buildChangeCommands(dataSet, primitives);
     110        GuiHelper.runInEDT(() -> {
     111            if (command == null || command.getChildren().isEmpty()) {
     112                return;
     113            }
     114            new Notification(trn(
     115                    "Comfort0: Changing {0} primitive",
     116                    "Comfort0: Changing {0} primitives", command.getChildren().size(), command.getChildren().size())).show();
     117            UndoRedoHandler.getInstance().add(command);
     118        });
    110119        return primitives;
    111120    }
    112121
    113     static void buildChangeCommands(DataSet dataSet, List<PrimitiveData> primitives) {
     122    static SequenceCommand buildChangeCommands(DataSet dataSet, List<PrimitiveData> primitives) {
    114123        final List<Command> commands = new ArrayList<>();
    115124        for (PrimitiveData fromLevel0L : primitives) {
     
    132141            }
    133142        }
    134 
    135143        if (commands.isEmpty()) {
    136             return;
     144            return null;
    137145        }
    138         final SequenceCommand command = new SequenceCommand("Comfort0", commands);
    139         GuiHelper.runInEDT(() -> {
    140             new Notification(trn(
    141                     "Comfort0: Changing {0} primitive",
    142                     "Comfort0: Changing {0} primitives", commands.size(), commands.size())).show();
    143             UndoRedoHandler.getInstance().add(command);
    144         });
     146        return new SequenceCommand("Comfort0", commands);
    145147    }
    146148}
Note: See TracChangeset for help on using the changeset viewer.