Ignore:
Timestamp:
2020-04-04T07:29:00+02:00 (5 years ago)
Author:
gerdp
Message:

see #19028: Plugin reverter uses a more recent API that minimal requested

  • revert changes down to 35400 to be able to dist a release that works with older JOSM versions
Location:
applications/editors/josm/plugins/reverter/src/reverter
Files:
3 edited

Legend:

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

    r35402 r35407  
    5353
    5454    private void addChangeCommandIfNotEquals(OsmPrimitive target, OsmPrimitive newTarget, boolean nominal) {
    55                 if (!target.hasEqualSemanticAttributes(newTarget) || target.isDeleted() != newTarget.isDeleted()
    56                                 || target.isVisible() != newTarget.isVisible()
    57                                 || !getNonDiscardableTags(target).equals(getNonDiscardableTags(newTarget))) {
     55        if (target.isIncomplete() != newTarget.isIncomplete() || target.isDeleted() != newTarget.isDeleted()
     56                || target.isVisible() != newTarget.isVisible()
     57                || !getNonDiscardableTags(target).equals(getNonDiscardableTags(newTarget))) {
    5858            cmds.add(new ChangeCommand(target, newTarget));
    5959            if (nominal) {
  • applications/editors/josm/plugins/reverter/src/reverter/RevertChangesetCommand.java

    r35400 r35407  
    1919     * Create the command by specifying the list of commands to execute.
    2020     * @param name The description text
    21      * @param sequenz The sequence that was already executed.
     21     * @param sequenz The sequence that should be executed.
    2222     */
    2323    public RevertChangesetCommand(String name, Collection<Command> sequenz) {
    2424        super(name, sequenz);
    2525        ReverterPlugin.reverterUsed = true;
    26         setSequenceComplete(true);
    2726    }
    2827
     
    3736    }
    3837
    39     @Override
    40     public void undoCommand() {
    41         getAffectedDataSet().update(super::undoCommand);
    42     }
    43 
    44     @Override
    45     public boolean executeCommand() {
    46         return getAffectedDataSet().update(super::executeCommand);
    47     }
    48 
    4938}
  • applications/editors/josm/plugins/reverter/src/reverter/RevertChangesetTask.java

    r35400 r35407  
    1515
    1616import org.openstreetmap.josm.command.Command;
     17import org.openstreetmap.josm.command.SequenceCommand;
    1718import org.openstreetmap.josm.command.conflict.ConflictAddCommand;
    1819import org.openstreetmap.josm.data.UndoRedoHandler;
     
    9899                newLayer = false; // reuse layer for subsequent reverts
    99100            } catch (OsmTransferException e) {
    100                                 if (!allcmds.isEmpty()) {
    101                                         GuiHelper.runInEDT(() -> UndoRedoHandler.getInstance().undo(allcmds.size()));
    102                                 }
    103                                 Logging.error(e);
     101                Logging.error(e);
    104102                throw e;
    105103            } catch (UserCancelException e) {
    106                                 if (!allcmds.isEmpty()) {
    107                                         GuiHelper.runInEDT(() -> UndoRedoHandler.getInstance().undo(allcmds.size()));
    108                                 }
    109104                Logging.warn("Revert canceled");
    110105                Logging.trace(e);
     
    113108        }
    114109        if (!allcmds.isEmpty()) {
    115             Command cmd = allcmds.size() == 1 ? allcmds.get(0) : new RevertChangesetCommand(tr("Revert changesets"), allcmds);
     110            Command cmd = allcmds.size() == 1 ? allcmds.get(0) : new SequenceCommand(tr("Revert changesets"), allcmds);
    116111            GuiHelper.runInEDT(() -> {
    117                 UndoRedoHandler.getInstance().add(cmd, false);
     112                UndoRedoHandler.getInstance().add(cmd);
    118113                if (numberOfConflicts > 0) {
    119114                    MainApplication.getMap().conflictDialog.warnNumNewConflicts(numberOfConflicts);
     
    174169                numberOfConflicts++;
    175170            }
    176             c.executeCommand();
    177171        }
    178172        final String desc;
Note: See TracChangeset for help on using the changeset viewer.