Changeset 36319 in osm for applications
- Timestamp:
- 2024-08-21T22:49:24+02:00 (4 months ago)
- Location:
- applications/editors/josm/plugins/reverter
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reverter/build.xml
r36122 r36319 4 4 <property name="commit.message" value="Reverter: fix deleted/redacted relation members"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 8723"/>6 <property name="plugin.main.version" value="19044"/> 7 7 8 8 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/reverter/pom.xml
r36282 r36319 17 17 <properties> 18 18 <plugin.src.dir>src</plugin.src.dir> 19 <plugin.main.version>1 8723</plugin.main.version>19 <plugin.main.version>19044</plugin.main.version> 20 20 <plugin.author>Upliner</plugin.author> 21 21 <plugin.class>reverter.ReverterPlugin</plugin.class> -
applications/editors/josm/plugins/reverter/src/reverter/RevertChangesetHandler.java
r33572 r36319 7 7 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 8 8 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler; 9 import org.openstreetmap.josm.tools.Logging; 9 10 11 import java.util.List; 12 import java.util.ArrayList; 13 14 /** 15 * The handler for {@link org.openstreetmap.josm.io.remotecontrol.RemoteControl} revert commands 16 */ 10 17 public class RevertChangesetHandler extends RequestHandler { 11 public static final String command= "revert_changeset";12 p ublic static final String permissionKey= "remotecontrol.permission.revert_changeset";13 p ublic static final boolean permissionDefault= true;18 public static final String COMMAND = "revert_changeset"; 19 private static final String PERMISSION_KEY = "remotecontrol.permission.revert_changeset"; 20 private static final boolean PERMISSION_DEFAULT = true; 14 21 15 private int changesetId;22 private final List<Integer> changesetIds = new ArrayList<>(); 16 23 17 24 @Override 18 protected void handleRequest() throws RequestHandlerErrorException, 19 RequestHandlerBadRequestException { 25 protected void handleRequest() throws RequestHandlerErrorException { 20 26 try { 21 MainApplication.worker.submit(new RevertChangesetTask(changesetId , ChangesetReverter.RevertType.FULL, true));27 MainApplication.worker.submit(new RevertChangesetTask(changesetIds, ChangesetReverter.RevertType.FULL, true, false)); 22 28 } catch (Exception ex) { 23 System.out.println("RemoteControl: Error parsing revert_changeset remote control request:");24 ex.printStackTrace();29 Logging.debug("RemoteControl: Error parsing revert_changeset remote control request:"); 30 Logging.debug(ex); 25 31 throw new RequestHandlerErrorException(ex); 26 32 } … … 34 40 @Override 35 41 public PermissionPrefWithDefault getPermissionPref() { 36 return n ull;42 return new PermissionPrefWithDefault(PERMISSION_KEY, PERMISSION_DEFAULT, tr("Revert changeset(s)")); 37 43 } 38 44 … … 44 50 @Override 45 51 protected void validateRequest() throws RequestHandlerBadRequestException { 46 try { 47 changesetId = Integer.parseInt(args.get("id")); 48 } catch (NumberFormatException e) { 49 throw new RequestHandlerBadRequestException("NumberFormatException: "+e.getMessage()); 52 if (args.get("id") != null) { 53 try { 54 for (String id : args.get("id").split(",", -1)) { 55 changesetIds.add(Integer.parseInt(id)); 56 } 57 } catch (NumberFormatException e) { 58 throw new RequestHandlerBadRequestException("NumberFormatException: " + e.getMessage()); 59 } 60 } else { 61 throw new RequestHandlerBadRequestException("The required id argument must be specified"); 50 62 } 51 63 } -
applications/editors/josm/plugins/reverter/src/reverter/ReverterPlugin.java
r35868 r36319 28 28 MainMenu.add(historyMenu, new RevertChangesetAction()); 29 29 UploadAction.registerUploadHook(new ReverterUploadHook(info)); 30 new RemoteControl().addRequestHandler(RevertChangesetHandler. command, RevertChangesetHandler.class);30 new RemoteControl().addRequestHandler(RevertChangesetHandler.COMMAND, RevertChangesetHandler.class); 31 31 } 32 32 }
Note:
See TracChangeset
for help on using the changeset viewer.