Changeset 6309 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2013-10-06T23:43:21+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
r6087 r6309 99 99 * @return the map with the current tags in the tag editor model. 100 100 */ 101 public Map<String,String> getTags( ) {102 return pnlTagEditor.getModel().getTags( );101 public Map<String,String> getTags(boolean keepEmpty) { 102 return pnlTagEditor.getModel().getTags(keepEmpty); 103 103 } 104 104 -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r6296 r6309 4 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 import static org.openstreetmap.josm.tools.I18n.trn; 6 7 7 8 import java.awt.BorderLayout; … … 52 53 import org.openstreetmap.josm.tools.ImageProvider; 53 54 import org.openstreetmap.josm.tools.InputMapUtils; 55 import org.openstreetmap.josm.tools.Utils; 54 56 import org.openstreetmap.josm.tools.WindowGeometry; 55 57 … … 299 301 cs = new Changeset(); 300 302 } 301 cs.setKeys(pnlTagSettings.getTags( ));303 cs.setKeys(pnlTagSettings.getTags(false)); 302 304 return cs; 303 305 } … … 454 456 } 455 457 } 458 459 /* test for empty tags in the changeset metadata and proceed only after user's confirmation */ 460 List<String> emptyChangesetTags = new ArrayList<String>(); 461 for (final Entry<String, String> i : pnlTagSettings.getTags(true).entrySet()) { 462 if (i.getKey() == null || i.getKey().trim().isEmpty() 463 || i.getValue() == null || i.getValue().trim().isEmpty()) { 464 emptyChangesetTags.add(tr("{0}={1}", i.getKey(), i.getValue())); 465 } 466 } 467 if (!emptyChangesetTags.isEmpty() && JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog( 468 Main.parent, 469 trn( 470 "<html>The following changeset tag contains an empty key/value:<br>{0}<br>Continue?</html>", 471 "<html>The following changeset tags contain an empty key/value:<br>{0}<br>Continue?</html>", 472 emptyChangesetTags.size(), Utils.joinAsHtmlUnorderedList(emptyChangesetTags)), 473 tr("Empty metadata"), 474 JOptionPane.OK_CANCEL_OPTION, 475 JOptionPane.WARNING_MESSAGE 476 )) { 477 tpConfigPanels.setSelectedIndex(0); 478 pnlBasicUploadSettings.initEditingOfUploadComment(); 479 return; 480 } 481 456 482 UploadStrategySpecification strategy = getUploadStrategySpecification(); 457 483 if (strategy.getStrategy().equals(UploadStrategy.CHUNKED_DATASET_STRATEGY)) { -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r6258 r6309 410 410 public void applyToPrimitive(Tagged primitive) { 411 411 Map<String,String> tags = primitive.getKeys(); 412 applyToTags(tags );412 applyToTags(tags, false); 413 413 primitive.setKeys(tags); 414 414 } … … 420 420 * 421 421 */ 422 public void applyToTags(Map<String, String> tags ) {422 public void applyToTags(Map<String, String> tags, boolean keepEmpty) { 423 423 tags.clear(); 424 424 for (TagModel tag: this.tags) { … … 431 431 // tag name holds an empty key. Don't apply it to the selection. 432 432 // 433 if ( tag.getName().trim().isEmpty() || tag.getValue().trim().isEmpty()) {433 if (!keepEmpty && (tag.getName().trim().isEmpty() || tag.getValue().trim().isEmpty())) { 434 434 continue; 435 435 } … … 439 439 440 440 public Map<String,String> getTags() { 441 return getTags(false); 442 } 443 444 public Map<String,String> getTags(boolean keepEmpty) { 441 445 Map<String,String> tags = new HashMap<String, String>(); 442 applyToTags(tags );446 applyToTags(tags, keepEmpty); 443 447 return tags; 444 448 }
Note:
See TracChangeset
for help on using the changeset viewer.