source: subversion/applications/editors/josm/plugins/reverter/src/reverter/RevertChangesetAction.java

Last change on this file was 34028, checked in by donvip, 15 months ago

fix #josm15821 - better handling of batch reverts

File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package reverter;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7import java.awt.event.KeyEvent;
8import java.util.Collection;
9
10import org.openstreetmap.josm.actions.JosmAction;
11import org.openstreetmap.josm.gui.MainApplication;
12import org.openstreetmap.josm.tools.Shortcut;
13
14import reverter.ChangesetReverter.RevertType;
15
16public class RevertChangesetAction extends JosmAction {
17
18    public RevertChangesetAction() {
19        super(tr("Revert changeset"), "revert-changeset", tr("Revert changeset"),
20            Shortcut.registerShortcut("tool:revert", tr("Tool: {0}", tr("Revert changeset")), KeyEvent.VK_T, Shortcut.CTRL_SHIFT),
21                true);
22    }
23
24    @Override
25    public void actionPerformed(ActionEvent e) {
26        final ChangesetIdQuery dlg = new ChangesetIdQuery();
27        if (dlg.showDialog().getValue() != 1) return;
28        final Collection<Integer> changesetIds = dlg.getIdsInReverseOrder();
29        final RevertType revertType = dlg.getRevertType();
30        if (revertType == null) return;
31
32        boolean newLayer = dlg.isNewLayerRequired();
33        final boolean autoConfirmDownload = newLayer || changesetIds.size() > 1;
34        MainApplication.worker.submit(new RevertChangesetTask(changesetIds, revertType, autoConfirmDownload, newLayer));
35    }
36}
Note: See TracBrowser for help on using the repository browser.