Changeset 5497 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2012-09-03T18:56:02+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r5266 r5497 14 14 import org.openstreetmap.josm.Main; 15 15 import org.openstreetmap.josm.actions.upload.ApiPreconditionCheckerHook; 16 import org.openstreetmap.josm.actions.upload.DiscardTagsHook; 16 17 import org.openstreetmap.josm.actions.upload.RelationUploadOrderHook; 17 18 import org.openstreetmap.josm.actions.upload.UploadHook; … … 50 51 */ 51 52 private static final LinkedList<UploadHook> uploadHooks = new LinkedList<UploadHook>(); 53 private static final LinkedList<UploadHook> lateUploadHooks = new LinkedList<UploadHook>(); 52 54 static { 53 55 uploadHooks.add(new ValidateUploadHook()); … … 61 63 */ 62 64 uploadHooks.add(new RelationUploadOrderHook()); 65 66 /** 67 * Removes discardable tags like created_by on modified objects 68 */ 69 lateUploadHooks.add(new DiscardTagsHook()); 63 70 } 64 71 … … 69 76 */ 70 77 public static void registerUploadHook(UploadHook hook) { 78 registerUploadHook(hook, false); 79 } 80 81 /** 82 * Registers an upload hook. Adds the hook at the first position of the upload hooks. 83 * 84 * @param hook the upload hook. Ignored if null. 85 * @param late true, if the hook should be executed after the upload dialog 86 * has been confirmed. Late upload hooks should in general succeed and not 87 * abort the upload. 88 */ 89 public static void registerUploadHook(UploadHook hook, boolean late) { 71 90 if(hook == null) return; 72 if (!uploadHooks.contains(hook)) { 73 uploadHooks.add(0,hook); 91 if (late) { 92 if (!lateUploadHooks.contains(hook)) { 93 lateUploadHooks.add(0, hook); 94 } 95 } else { 96 if (!uploadHooks.contains(hook)) { 97 uploadHooks.add(0, hook); 98 } 74 99 } 75 100 } … … 84 109 if (uploadHooks.contains(hook)) { 85 110 uploadHooks.remove(hook); 111 } 112 if (lateUploadHooks.contains(hook)) { 113 lateUploadHooks.remove(hook); 86 114 } 87 115 } … … 122 150 * want to continue 123 151 */ 124 public static finalboolean warnUploadDiscouraged(OsmDataLayer layer) {152 public static boolean warnUploadDiscouraged(OsmDataLayer layer) { 125 153 return GuiHelper.warnUser(tr("Upload discouraged"), 126 154 "<html>" + … … 200 228 dialog.rememberUserInput(); 201 229 230 for (UploadHook hook : lateUploadHooks) { 231 if (!hook.checkUpload(apiData)) 232 return; 233 } 234 202 235 Main.worker.execute( 203 236 new UploadPrimitivesTask(
Note:
See TracChangeset
for help on using the changeset viewer.