Changeset 27091 in osm for applications/editors/josm/plugins/reverter
- Timestamp:
- 2011-11-19T20:56:55+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/reverter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reverter/build.xml
r26990 r27091 30 30 <project name="reverter" default="dist" basedir="."> 31 31 <!-- enter the SVN commit message --> 32 <property name="commit.message" value="re compile after change in OsmPrimitive in JOSM 4099"/>32 <property name="commit.message" value="reverter: add support for remotecontrol for curl-scripted reverts"/> 33 33 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 34 34 <property name="plugin.main.version" value="4549"/> -
applications/editors/josm/plugins/reverter/src/reverter/RevertChangesetAction.java
r26509 r27091 5 5 import java.awt.event.ActionEvent; 6 6 import java.awt.event.KeyEvent; 7 import java.util.List;8 9 import javax.swing.JOptionPane;10 7 11 8 import org.openstreetmap.josm.Main; 12 9 import org.openstreetmap.josm.actions.JosmAction; 13 import org.openstreetmap.josm.command.Command;14 import org.openstreetmap.josm.gui.PleaseWaitRunnable;15 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor;16 import org.openstreetmap.josm.gui.progress.ProgressMonitor;17 import org.openstreetmap.josm.io.OsmTransferException;18 10 import org.openstreetmap.josm.tools.Shortcut; 19 11 … … 48 40 if (revertType == null) return; 49 41 50 Main.worker.submit(new PleaseWaitRunnable(tr("Reverting...")) { 51 private ChangesetReverter rev; 52 private boolean downloadConfirmed = false; 53 54 private boolean checkAndDownloadMissing() throws OsmTransferException { 55 if (!rev.hasMissingObjects()) return true; 56 if (!downloadConfirmed) { 57 downloadConfirmed = JOptionPane.showConfirmDialog(Main.parent, 58 tr("This changeset has objects that are not present in current dataset.\n" + 59 "It is needed to download them before reverting. Do you want to continue?"), 60 tr("Confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; 61 if (!downloadConfirmed) return false; 62 } 63 final PleaseWaitProgressMonitor monitor = 64 new PleaseWaitProgressMonitor(tr("Fetching missing primitives")); 65 try { 66 rev.downloadMissingPrimitives(monitor); 67 } finally { 68 monitor.close(); 69 } 70 return !monitor.isCanceled(); 71 } 72 73 @Override 74 protected void realRun() throws OsmTransferException { 75 progressMonitor.indeterminateSubTask(tr("Downloading changeset")); 76 rev = new ChangesetReverter(changesetId, revertType, 77 progressMonitor.createSubTaskMonitor(0, true)); 78 if (progressMonitor.isCanceled()) return; 79 80 // Check missing objects 81 rev.checkMissingCreated(); 82 rev.checkMissingUpdated(); 83 if (rev.hasMissingObjects()) { 84 // If missing created or updated objects, ask user 85 rev.checkMissingDeleted(); 86 if (!checkAndDownloadMissing()) return; 87 } else { 88 // Don't ask user to download primitives going to be undeleted 89 rev.checkMissingDeleted(); 90 rev.downloadMissingPrimitives(progressMonitor.createSubTaskMonitor(0, false)); 91 } 92 93 if (progressMonitor.isCanceled()) return; 94 rev.downloadObjectsHistory(progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)); 95 if (progressMonitor.isCanceled()) return; 96 if (!checkAndDownloadMissing()) return; 97 List<Command> cmds = rev.getCommands(); 98 Command cmd = new RevertChangesetCommand(tr(revertType == RevertType.FULL ? "Revert changeset #{0}" : 99 "Partially revert changeset #{0}",changesetId),cmds); 100 Main.main.undoRedo.add(cmd); 101 } 102 103 @Override 104 protected void cancel() { 105 } 106 107 @Override 108 protected void finish() { 109 } 110 }); 42 Main.worker.submit(new RevertChangesetTask(changesetId, revertType)); 111 43 } 112 44 } -
applications/editors/josm/plugins/reverter/src/reverter/ReverterPlugin.java
r25578 r27091 11 11 import org.openstreetmap.josm.actions.UploadAction; 12 12 import org.openstreetmap.josm.gui.MainMenu; 13 import org.openstreetmap.josm.io.remotecontrol.RemoteControl; 13 14 import org.openstreetmap.josm.plugins.Plugin; 14 15 import org.openstreetmap.josm.plugins.PluginInformation; … … 23 24 MainMenu.add(historyMenu, new RevertChangesetAction()); 24 25 UploadAction.registerUploadHook(new ReverterUploadHook(this)); 26 new RemoteControl().addRequestHandler(RevertChangesetHandler.command, RevertChangesetHandler.class); 25 27 } 26 28 }
Note:
See TracChangeset
for help on using the changeset viewer.