Changeset 2979 in josm for trunk/src/org/openstreetmap/josm/actions/UploadAction.java
- Timestamp:
- 2010-02-14T13:07:03+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r2598 r2979 18 18 import org.openstreetmap.josm.data.APIDataSet; 19 19 import org.openstreetmap.josm.data.conflict.ConflictCollection; 20 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 21 import org.openstreetmap.josm.gui.help.HelpUtil; 20 22 import org.openstreetmap.josm.gui.io.UploadDialog; 21 23 import org.openstreetmap.josm.gui.io.UploadPrimitivesTask; … … 101 103 } 102 104 105 protected void alertUnresolvedConflicts(OsmDataLayer layer) { 106 HelpAwareOptionPane.showOptionDialog( 107 Main.parent, 108 tr("<html>The data to be uploaded participates in unresolved conflicts of layer ''{0}''.<br>" 109 + "You have to resolve them first.</html>", layer.getName() 110 ), 111 tr("Warning"), 112 JOptionPane.WARNING_MESSAGE, 113 HelpUtil.ht("/Action/Upload#PrimitivesParticipateInConflicts") 114 ); 115 } 116 117 /** 118 * Check whether the preconditions are met to upload data in <code>apiData</code>. 119 * Makes sure primitives in <code>apiData</code> don't participate in conflicts and 120 * runs the installed {@see UploadHook}s. 121 * 122 * @param layer the source layer of the data to be uploaded 123 * @param apiData the data to be uploaded 124 * @return true, if the preconditions are met; false, otherwise 125 */ 103 126 public boolean checkPreUploadConditions(OsmDataLayer layer, APIDataSet apiData) { 104 127 ConflictCollection conflicts = layer.getConflicts(); 105 if (conflicts !=null && !conflicts.isEmpty()) { 106 JOptionPane.showMessageDialog( 107 Main.parent, 108 tr("<html>There are unresolved conflicts in layer ''{0}''.<br>" 109 + "You have to resolve them first.</html>", layer.getName()), 110 tr("Warning"), 111 JOptionPane.WARNING_MESSAGE 112 ); 128 if (apiData.participatesInConflict(conflicts)) { 129 alertUnresolvedConflicts(layer); 113 130 return false; 114 131 } 115 // Call all upload hooks in sequence. The upload confirmation dialog 116 // is one of these. 132 // Call all upload hooks in sequence. 133 // FIXME: this should become an asynchronous task 134 // 117 135 for(UploadHook hook : uploadHooks) 118 136 if(!hook.checkUpload(apiData)) … … 122 140 } 123 141 142 /** 143 * Uploads data to the OSM API. 144 * 145 * @param layer the source layer for the data to upload 146 * @param apiData the primitives to be added, updated, or deleted 147 */ 124 148 public void uploadData(OsmDataLayer layer, APIDataSet apiData) { 125 149 if (apiData.isEmpty()) {
Note:
See TracChangeset
for help on using the changeset viewer.