Changeset 1989 in josm
- Timestamp:
- 2009-08-23T19:34:25+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/AddCommand.java
r1857 r1989 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.openstreetmap.josm.tools.I18n.marktr; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 61 62 62 63 @Override public MutableTreeNode description() { 64 String msg; 65 switch(OsmPrimitiveType.from(osm)) { 66 case NODE: msg = marktr("Add node {0}"); break; 67 case WAY: msg = marktr("Add way {0}"); break; 68 case RELATION: msg = marktr("Add relation {0}"); break; 69 default: /* should not happen */msg = ""; break; 70 } 71 63 72 return new DefaultMutableTreeNode( 64 73 new JLabel( 65 tr("Add {0} {1}", 66 OsmPrimitiveType.from(osm).getLocalizedDisplayNameSingular(), 74 tr(msg, 67 75 new PrimitiveNameFormatter().getName(osm) 68 76 ), -
trunk/src/org/openstreetmap/josm/command/ChangeCommand.java
r1814 r1989 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.openstreetmap.josm.tools.I18n.marktr; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 44 45 45 46 @Override public MutableTreeNode description() { 47 String msg = ""; 48 switch(OsmPrimitiveType.from(osm)) { 49 case NODE: msg = marktr("Change node {0}"); break; 50 case WAY: msg = marktr("Change way {0}"); break; 51 case RELATION: msg = marktr("Change relation {0}"); break; 52 } 46 53 return new DefaultMutableTreeNode( 47 new JLabel(tr("Change {0} {1}", 48 OsmPrimitiveType.from(osm).getLocalizedDisplayNameSingular(), 54 new JLabel(tr(msg, 49 55 new PrimitiveNameFormatter().getName(osm)), 50 56 ImageProvider.get(OsmPrimitiveType.from(osm)), -
trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r1814 r1989 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 import static org.openstreetmap.josm.tools.I18n.trn; 6 7 … … 98 99 OsmPrimitive primitive = objects.iterator().next(); 99 100 String name = formatter.getName(primitive); 100 text = value == null 101 ? tr("Remove \"{0}\" for {1} ''{2}''", key, 102 OsmPrimitiveType.from(primitive).getLocalizedDisplayNameSingular(), 103 name) 104 : tr("Set {0}={1} for {2} ''{3}''", 105 key, 106 value, 107 OsmPrimitiveType.from(primitive).getLocalizedDisplayNameSingular(), 108 name 109 ); 101 String msg = ""; 102 if (value == null) { 103 switch(OsmPrimitiveType.from(primitive)) { 104 case NODE: msg = marktr("Remove \"{0}\" for node ''{1}''"); break; 105 case WAY: msg = marktr("Remove \"{0}\" for way ''{1}''"); break; 106 case RELATION: msg = marktr("Remove \"{0}\" for relation ''{1}''"); break; 107 } 108 text = tr(msg, key, name); 109 } else { 110 switch(OsmPrimitiveType.from(primitive)) { 111 case NODE: msg = marktr("Set {0}={1} for node ''{2}''"); break; 112 case WAY: msg = marktr("Set {0}={1} for way ''{2}''"); break; 113 case RELATION: msg = marktr("Set {0}={1} for relation ''{2}''"); break; 114 } 115 text = tr(msg, key, value, name); 116 } 110 117 } 111 118 else -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r1937 r1989 15 15 import java.util.LinkedList; 16 16 import java.util.List; 17 import java.util.Set; 17 18 18 19 import javax.swing.JLabel; … … 107 108 if (toDelete.size() == 1) { 108 109 OsmPrimitive primitive = toDelete.iterator().next(); 109 return new DefaultMutableTreeNode(new JLabel(tr("Delete {1} {0}", new PrimitiveNameFormatter() 110 .getName(primitive), OsmPrimitiveType.from(primitive).getLocalizedDisplayNameSingular()), 111 ImageProvider.get(OsmPrimitiveType.from(primitive)), JLabel.HORIZONTAL)); 112 } 113 114 String cname = null; 115 String apiname = null; 116 String cnamem = null; 110 String msg = ""; 111 switch(OsmPrimitiveType.from(primitive)) { 112 case NODE: msg = "Delete node {0}"; break; 113 case WAY: msg = "Delete way {0}"; break; 114 case RELATION:msg = "Delete relation {0}"; break; 115 } 116 117 return new DefaultMutableTreeNode(new JLabel(tr(msg, new PrimitiveNameFormatter().getName(primitive)), 118 ImageProvider.get(OsmPrimitiveType.from(primitive)), JLabel.HORIZONTAL)); 119 } 120 121 Set<OsmPrimitiveType> typesToDelete = new HashSet<OsmPrimitiveType>(); 117 122 for (OsmPrimitive osm : toDelete) { 118 if (cname == null) { 119 apiname = OsmPrimitiveType.from(osm).getAPIName(); 120 cname = OsmPrimitiveType.from(osm).getLocalizedDisplayNameSingular(); 121 cnamem = OsmPrimitiveType.from(osm).getLocalizedDisplayNamePlural(); 122 } else if (!cname.equals(OsmPrimitiveType.from(osm).getLocalizedDisplayNameSingular())) { 123 apiname = "object"; 124 cname = trn("object", "objects", 1); 125 cnamem = trn("object", "objects", 2); 126 } 127 } 128 DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(tr("Delete {0} {1}", toDelete.size(), trn( 129 cname, cnamem, toDelete.size())), ImageProvider.get("data", apiname), JLabel.HORIZONTAL)); 123 typesToDelete.add(OsmPrimitiveType.from(osm)); 124 } 125 String msg = ""; 126 String apiname = "object"; 127 if (typesToDelete.size() > 1) { 128 msg = trn("Delete {0} object", "Delete {0} objects", toDelete.size(), toDelete.size()); 129 } else { 130 OsmPrimitiveType t = typesToDelete.iterator().next(); 131 apiname = t.getAPIName(); 132 switch(t) { 133 case NODE: msg = trn("Delete {0} node", "Delete {0} nodes", toDelete.size(), toDelete.size()); break; 134 case WAY: msg = trn("Delete {0} way", "Delete {0} ways", toDelete.size(), toDelete.size()); break; 135 case RELATION: msg = trn("Delete {0} relation", "Delete {0} relations", toDelete.size(), toDelete.size()); break; 136 } 137 } 138 DefaultMutableTreeNode root = new DefaultMutableTreeNode( 139 new JLabel(msg, ImageProvider.get("data", apiname), JLabel.HORIZONTAL) 140 ); 130 141 for (OsmPrimitive osm : toDelete) { 131 142 root.add(new DefaultMutableTreeNode(new JLabel(new PrimitiveNameFormatter().getName(osm), ImageProvider -
trunk/src/org/openstreetmap/josm/command/RemoveRelationMemberCommand.java
r1951 r1989 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 6 7 import java.util.Collection; … … 64 65 65 66 @Override public MutableTreeNode description() { 67 String msg = ""; 68 switch(OsmPrimitiveType.from(member.member)) { 69 case NODE: msg = marktr("Remove node ''{0}'' at position {1} from relation ''{2}''"); break; 70 case WAY: msg = marktr("Remove way ''{0}'' at position {1} from relation ''{2}''"); break; 71 case RELATION: msg = marktr("Remove relation ''{0}'' at position {1} from relation ''{2}''"); break; 72 } 66 73 return new DefaultMutableTreeNode( 67 74 new JLabel( 68 tr("Remove relation member {0} {1}", 69 OsmPrimitiveType.from(relation).getLocalizedDisplayNameSingular(), 75 tr(msg, 76 new PrimitiveNameFormatter().getName(member.member), 77 relation.getMembers().indexOf(member), 70 78 new PrimitiveNameFormatter().getName(relation) 71 79 ), -
trunk/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java
r1954 r1989 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 6 7 import java.util.Collection; … … 64 65 @Override 65 66 public MutableTreeNode description() { 67 String msg = ""; 68 switch(OsmPrimitiveType.from(conflict.getMy())) { 69 case NODE: msg = marktr("Resolve {0} tag conflicts in node {1}"); break; 70 case WAY: msg = marktr("Resolve {0} tag conflicts in way {1}"); break; 71 case RELATION: msg = marktr("Resolve {0} tag conflicts in relation {1}"); break; 72 } 66 73 return new DefaultMutableTreeNode( 67 74 new JLabel( 68 tr( "Resolve {0} tag conflicts in {1} {2}",getNumDecidedConflicts(), OsmPrimitiveType.from(conflict.getMy()).getLocalizedDisplayNameSingular(), conflict.getMy().id),75 tr(msg,getNumDecidedConflicts(), conflict.getMy().id), 69 76 ImageProvider.get("data", "object"), 70 77 JLabel.HORIZONTAL -
trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java
r1750 r1989 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 6 7 import java.util.Collection; … … 36 37 @Override 37 38 public MutableTreeNode description() { 39 String msg = ""; 40 switch(OsmPrimitiveType.from(conflict.getMy())) { 41 case NODE: msg = marktr("Resolve version conflicts for node {0}"); break; 42 case WAY: msg = marktr("Resolve version conflicts for way {0}"); break; 43 case RELATION: msg = marktr("Resolve version conflicts for relation {0}"); break; 44 } 38 45 return new DefaultMutableTreeNode( 39 46 new JLabel( 40 tr( "Resolve version conflicts for {0} {1}",OsmPrimitiveType.from(conflict.getMy()).getLocalizedDisplayNameSingular(),conflict.getMy().id),47 tr(msg,conflict.getMy().id), 41 48 ImageProvider.get("data", "object"), 42 49 JLabel.HORIZONTAL -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java
r1814 r1989 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import javax.swing.ImageIcon;6 7 5 public enum OsmPrimitiveType { 8 6 9 NODE ("node" , tr("node"), tr("nodes")),10 WAY ("way" , tr("way"), tr("ways")),11 RELATION ("relation" , tr("relation"), tr("relations")),12 CHANGESET ("changeset" , tr("changeset"), tr("changesets"));7 NODE ("node"), 8 WAY ("way"), 9 RELATION ("relation"), 10 CHANGESET ("changeset"); 13 11 14 12 private String apiTypeName; 15 private String localizedDisplayNameSingular;16 private String localizedDisplayNamePlural;17 13 18 OsmPrimitiveType(String apiTypeName , String localizedDisplayNameSingular, String localizedDisplayNamePlural) {14 OsmPrimitiveType(String apiTypeName) { 19 15 this.apiTypeName = apiTypeName; 20 this.localizedDisplayNameSingular = localizedDisplayNameSingular;21 this.localizedDisplayNamePlural = localizedDisplayNamePlural;22 16 } 23 17 24 18 public String getAPIName() { 25 19 return apiTypeName; 26 }27 28 public String getLocalizedDisplayNameSingular() {29 return localizedDisplayNameSingular;30 }31 32 public String getLocalizedDisplayNamePlural() {33 return localizedDisplayNamePlural;34 20 } 35 21 -
trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
r1967 r1989 78 78 public static void explainGeneric(Exception e) { 79 79 String msg = e.getMessage(); 80 if (msg == null ) {80 if (msg == null || msg.trim().equals("")) { 81 81 msg = e.toString(); 82 82 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
r1954 r1989 586 586 null, 587 587 tr("<html>To keep your local version, JOSM<br>" 588 + "has to reset the id of {0} {1} to 0.<br>"588 + "has to reset the id of primitive {0} to 0.<br>" 589 589 + "On the next upload the server will assign<br>" 590 590 + "it a new id.<br>" 591 591 + "Do yo agree?</html>", 592 OsmPrimitiveType.from(model.getMyPrimitive()).getLocalizedDisplayNamePlural(),593 592 model.getMyPrimitive().id 594 593 ), -
trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java
r1847 r1989 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 6 7 import java.awt.BorderLayout; … … 338 339 339 340 protected void renderText(History h) { 340 setText(h.getEarliest().getType().getLocalizedDisplayNameSingular() + " " + h.getId()); 341 String msg = ""; 342 switch(h.getEarliest().getType()) { 343 case NODE: msg = marktr("Node {0}"); break; 344 case WAY: msg = marktr("Way {0}"); break; 345 case RELATION: msg = marktr("Relation {0}"); break; 346 } 347 setText(tr(msg,h.getId())); 341 348 } 342 349 … … 412 419 continue; 413 420 } 414 progressMonitor.indeterminateSubTask(tr("Loading history for {0} with id {1}", 415 OsmPrimitiveType.from(primitive).getLocalizedDisplayNameSingular(), 421 String msg = ""; 422 switch(OsmPrimitiveType.from(primitive)) { 423 case NODE: msg = marktr("Loading history for node {0}"); break; 424 case WAY: msg = marktr("Loading history for way {0}"); break; 425 case RELATION: msg = marktr("Loading history for relation {0}"); break; 426 } 427 progressMonitor.indeterminateSubTask(tr(msg, 416 428 Long.toString(primitive.id))); 417 429 OsmServerHistoryReader reader = null; -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java
r1987 r1989 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 6 7 import java.awt.BorderLayout; … … 34 35 */ 35 36 protected void renderTitle(History h) { 36 String title = tr( 37 "History for {0} {1}", 38 h.getEarliest().getType().getLocalizedDisplayNameSingular(), 37 String title = ""; 38 switch(h.getEarliest().getType()) { 39 case NODE: title = marktr("History for node {0}"); break; 40 case WAY: title = marktr("History for way {0}"); break; 41 case RELATION: title = marktr("History for relation {0}"); break; 42 } 43 setTitle(tr( 44 title, 39 45 Long.toString(h.getId()) 40 ); 41 setTitle(title); 46 )); 42 47 } 43 48 -
trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java
r1709 r1989 3 3 4 4 import java.awt.Color; 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import java.awt.Component; 6 7 import java.util.HashMap; … … 73 74 bgColor = BGCOLOR_EMPTY_ROW; 74 75 } else { 75 text = member.getPrimitiveType().getLocalizedDisplayNameSingular() + " " + member.getPrimitiveId(); 76 text = ""; 77 switch(member.getPrimitiveType()) { 78 case NODE: text = tr("Node {0}", member.getPrimitiveId()); break; 79 case WAY: text = tr("Way {0}", member.getPrimitiveId()); break; 80 case RELATION: text = tr("Relation {0}", member.getPrimitiveId()); break; 81 } 76 82 if (model.isSameInOppositeWay(row)) { 77 83 bgColor = Color.WHITE; -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r1938 r1989 365 365 for (long id : pkg) { 366 366 try { 367 progressMonitor.setCustomText(tr("Fetching {0} with id {1} from ''{2}''", type.getLocalizedDisplayNameSingular(), id, OsmApi.getOsmApi().getBaseUrl())); 367 String msg = ""; 368 switch(type) { 369 case NODE: msg = tr("Fetching node with id {0} from ''{1}''", id, OsmApi.getOsmApi().getBaseUrl()); break; 370 case WAY: msg = tr("Fetching way with id {0} from ''{1}''", id, OsmApi.getOsmApi().getBaseUrl()); break; 371 case RELATION: msg = tr("Fetching relation with id {0} from ''{1}''", id, OsmApi.getOsmApi().getBaseUrl()); break; 372 } 373 progressMonitor.setCustomText(msg); 368 374 singleGetId(type, id, progressMonitor); 369 375 } catch(OsmApiException e) { … … 397 403 */ 398 404 protected void fetchPrimitives(Set<Long> ids, OsmPrimitiveType type, ProgressMonitor progressMonitor) throws OsmTransferException{ 399 progressMonitor.setCustomText(tr("Fetching a package of {0} from ''{1}''", type.getLocalizedDisplayNameSingular(), OsmApi.getOsmApi().getBaseUrl())); 405 String msg = ""; 406 switch(type) { 407 case NODE: msg = tr("Fetching a package of nodes from ''{0}''", OsmApi.getOsmApi().getBaseUrl()); break; 408 case WAY: msg = tr("Fetching a package of ways from ''{0}''", OsmApi.getOsmApi().getBaseUrl()); break; 409 case RELATION: msg = tr("Fetching a package of relations from ''{0}''", OsmApi.getOsmApi().getBaseUrl()); break; 410 } 411 progressMonitor.setCustomText(msg); 400 412 Set<Long> toFetch = new HashSet<Long>(ids); 401 413 toFetch.addAll(ids); -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r1894 r1989 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.marktr; 5 6 6 7 import java.util.Collection; … … 95 96 int progress = progressMonitor.getTicks(); 96 97 String time_left_str = timeLeft(progress, primitives.size()); 98 String msg = ""; 99 switch(OsmPrimitiveType.from(osm)) { 100 case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break; 101 case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break; 102 case RELATION: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading relation ''{4}'' (id: {5})"); break; 103 } 97 104 progressMonitor.subTask( 98 tr("{0}% ({1}/{2}), {3} left. Uploading {4}: {5} (id: {6})", 99 Math.round(100.0*progress/primitives.size()), progress, 100 primitives.size(), time_left_str, 101 OsmPrimitiveType.from(osm).getLocalizedDisplayNameSingular(), 105 tr(msg, 106 Math.round(100.0*progress/primitives.size()), 107 progress, 108 primitives.size(), 109 time_left_str, 102 110 NAME_FORMATTER.getName(osm), 103 111 osm.id));
Note:
See TracChangeset
for help on using the changeset viewer.