Changeset 5497 in josm
- Timestamp:
- 2012-09-03T18:56:02+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 3 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( -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r5442 r5497 609 609 *----------------------------------*/ 610 610 611 612 611 private static volatile Collection<String> uninteresting = null; 612 private static volatile Collection<String> discardable = null; 613 613 614 /** 614 615 * Contains a list of "uninteresting" keys that do not make an object … … 620 621 if (uninteresting == null) { 621 622 uninteresting = Main.pref.getCollection("tags.uninteresting", 622 Arrays.asList( new String[]{"source", "source_ref", "source:", "note", "comment",623 Arrays.asList("source", "source_ref", "source:", "note", "comment", 623 624 "converted_by", "created_by", "watch", "watch:", "fixme", "FIXME", 624 "description", "attribution" }));625 "description", "attribution")); 625 626 } 626 627 return uninteresting; 628 } 629 630 /** 631 * Returns a list of keys which have been deemed uninteresting to the point 632 * that they can be silently removed from data which is being edited. 633 */ 634 public static Collection<String> getDiscardableKeys() { 635 if(discardable == null) { 636 discardable = Main.pref.getCollection("tags.discardable", 637 Arrays.asList("created_by", 638 "tiger:upload_uuid", "tiger:tlid", "tiger:source", "tiger:separated", 639 "geobase:datasetName", "geobase:uuid", "sub_sea:type", 640 "odbl", "odbl:note")); 641 } 642 return discardable; 627 643 } 628 644 -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r5326 r5497 219 219 Collections.sort(entries, byKeyComparator); 220 220 for (Entry<String, String> e : entries) { 221 if ((osm instanceof Changeset) || !("created_by".equals(e.getKey()))) { 222 out.println(" <tag k='"+ XmlWriter.encode(e.getKey()) + 223 "' v='"+XmlWriter.encode(e.getValue())+ "' />"); 224 } 221 out.println(" <tag k='"+ XmlWriter.encode(e.getKey()) + 222 "' v='"+XmlWriter.encode(e.getValue())+ "' />"); 225 223 } 226 224 out.println(" </" + tagname + ">");
Note:
See TracChangeset
for help on using the changeset viewer.