- Timestamp:
- 2010-01-13T20:12:10+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/conflict
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java
r2624 r2846 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn; 5 6 6 7 import java.awt.BorderLayout; … … 166 167 tabbedPane.setIconAt(1, mergeComplete); 167 168 } else { 168 tabbedPane.setTitleAt(1, tr ("Tags({0} conflicts)", newValue));169 tabbedPane.setToolTipTextAt(1, tr ("{0} pending tag conflicts to be resolved"));169 tabbedPane.setTitleAt(1, trn("Tags({0} conflict)", "Tags({0} conflicts)", newValue, newValue)); 170 tabbedPane.setToolTipTextAt(1, trn("{0} pending tag conflict to be resolved", "{0} pending tag conflicts to be resolved", newValue, newValue)); 170 171 tabbedPane.setIconAt(1, mergeIncomplete); 171 172 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java
r2569 r2846 12 12 import java.beans.PropertyChangeEvent; 13 13 import java.beans.PropertyChangeListener; 14 import java.text.MessageFormat; 14 15 import java.util.ArrayList; 15 16 import java.util.HashMap; … … 320 321 ArrayList<T> mergedEntries = getMergedEntries(); 321 322 if (current < 0 || current >= mergedEntries.size()) 322 throw new IllegalArgumentException( tr("Parameter current out of range. Got {0}.", current));323 throw new IllegalArgumentException(MessageFormat.format("Parameter current out of range. Got {0}.", current)); 323 324 for (int i=rows.length -1; i>=0; i--) { 324 325 int row = rows[i]; … … 372 373 373 374 if (current < 0 || current >= mergedEntries.size()) 374 throw new IllegalArgumentException( tr("Parameter current out of range. Got {0}.", current));375 throw new IllegalArgumentException(MessageFormat.format("Parameter current out of range. Got {0}.", current)); 375 376 if (current == mergedEntries.size() -1) { 376 377 copyToEnd(source, rows); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
r2626 r2846 35 35 import javax.swing.event.ListSelectionListener; 36 36 37 import org.openstreetmap.josm.tools.CheckParameterUtil; 37 38 import org.openstreetmap.josm.tools.ImageProvider; 38 39 … … 866 867 */ 867 868 protected void setParticipatingInSynchronizedScrolling(Adjustable adjustable, boolean isParticipating) { 868 if (adjustable == null) 869 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "adjustable")); 870 869 CheckParameterUtil.ensureParameterNotNull(adjustable, "adjustable"); 871 870 if (! synchronizedAdjustables.contains(adjustable)) 872 throw new IllegalStateException(tr("Adjustable {0} not registered yet. Can 't set participation in synchronized adjustment.", adjustable));871 throw new IllegalStateException(tr("Adjustable {0} not registered yet. Cannot set participation in synchronized adjustment.", adjustable)); 873 872 874 873 enabledMap.put(adjustable, isParticipating); … … 906 905 * @exception IllegalArgumentException thrown, if adjustable is null 907 906 */ 908 protected void adapt(final JCheckBox view, final Adjustable adjustable) throws IllegalArgumentException, IllegalStateException { 909 if (adjustable == null) 910 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "adjustable")); 911 if (view == null) 912 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "view")); 907 protected void adapt(final JCheckBox view, final Adjustable adjustable) throws IllegalStateException { 908 CheckParameterUtil.ensureParameterNotNull(adjustable, "adjustable"); 909 CheckParameterUtil.ensureParameterNotNull(view, "view"); 913 910 914 911 if (! synchronizedAdjustables.contains(adjustable)) { -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModel.java
r2512 r2846 14 14 import org.openstreetmap.josm.gui.conflict.pair.ListMergeModel; 15 15 import org.openstreetmap.josm.gui.conflict.pair.ListRole; 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 16 17 17 18 public class NodeListMergeModel extends ListMergeModel<Node>{ … … 29 30 */ 30 31 public void populate(Way my, Way their) { 31 if (my == null) 32 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "my")); 33 if (their == null) 34 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "their")); 32 CheckParameterUtil.ensureParameterNotNull(my, "my"); 33 CheckParameterUtil.ensureParameterNotNull(their, "their"); 35 34 getMergedEntries().clear(); 36 35 getMyEntries().clear(); … … 63 62 */ 64 63 public WayNodesConflictResolverCommand buildResolveCommand(Way my, Way their) { 65 if (my == null) 66 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "my")); 67 if (their == null) 68 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "their")); 64 CheckParameterUtil.ensureParameterNotNull(my, "my"); 65 CheckParameterUtil.ensureParameterNotNull(their, "their"); 69 66 if (! isFrozen()) 70 throw new IllegalArgumentException(tr("Merged nodes not frozen yet. Can 't build resolution command."));67 throw new IllegalArgumentException(tr("Merged nodes not frozen yet. Cannot build resolution command.")); 71 68 return new WayNodesConflictResolverCommand(my, their, getMergedEntries()); 72 69 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java
r2512 r2846 6 6 import java.awt.Color; 7 7 import java.awt.Component; 8 import java.text.MessageFormat; 8 9 import java.util.ArrayList; 9 10 import java.util.Collections; … … 178 179 default: 179 180 // should not happen 180 throw new RuntimeException( tr("Unexpected column index. Got {0}.", column));181 throw new RuntimeException(MessageFormat.format("Unexpected column index. Got {0}.", column)); 181 182 } 182 183 return this; -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java
r2612 r2846 4 4 import static org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType.UNDECIDED; 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.beans.PropertyChangeListener; … … 31 32 import org.openstreetmap.josm.io.MultiFetchServerObjectReader; 32 33 import org.openstreetmap.josm.io.OsmTransferException; 34 import org.openstreetmap.josm.tools.CheckParameterUtil; 33 35 34 36 /** … … 292 294 */ 293 295 public void decideDeletedStateConflict(MergeDecisionType decision) throws IllegalArgumentException{ 294 if (decision == null) 295 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "decision")); 296 CheckParameterUtil.ensureParameterNotNull(decision, "decision"); 296 297 this.deletedMergeDecision = decision; 297 298 setChanged(); … … 307 308 */ 308 309 public void decideVisibleStateConflict(MergeDecisionType decision) throws IllegalArgumentException { 309 if (decision == null) 310 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "decision")); 310 CheckParameterUtil.ensureParameterNotNull(decision, "decision"); 311 311 this.visibleMergeDecision = decision; 312 312 setChanged(); … … 468 468 int ret = JOptionPane.showOptionDialog( 469 469 Main.parent, 470 tr("<html>There are {0} additional nodes used by way {1}<br>" 471 + "which are deleted on the server.<br>" 472 + "<br>" 473 + "Do you want to undelete these nodes too?</html>", 474 Long.toString(dependent.size()), Long.toString(way.getId())), 475 tr("Undelete additional nodes?"), 476 JOptionPane.YES_NO_OPTION, 477 JOptionPane.QUESTION_MESSAGE, 478 null, 479 options, 480 options[0] 470 "<html>" + trn("There is {0} additional node used by way {1}<br>" 471 + "which is deleted on the server." 472 + "<br><br>" 473 + "Do you want to undelete this node too?", 474 "There are {0} additional nodes used by way {1}<br>" 475 + "which are deleted on the server." 476 + "<br><br>" 477 + "Do you want to undelete these nodes too?", 478 dependent.size(), dependent.size(), way.getId()) 479 + "</html>", 480 tr("Undelete additional nodes?"), 481 JOptionPane.YES_NO_OPTION, 482 JOptionPane.QUESTION_MESSAGE, 483 null, 484 options, 485 options[0] 481 486 ); 482 487 … … 497 502 int ret = JOptionPane.showOptionDialog( 498 503 Main.parent, 499 tr("<html>There are {0} additional primitives referred to by relation {1}<br>" 500 + "which are deleted on the server.<br>" 501 + "<br>" 502 + "Do you want to undelete them too?</html>", 503 Long.toString(dependent.size()), Long.toString(r.getId())), 504 tr("Undelete dependent primitives?"), 505 JOptionPane.YES_NO_OPTION, 506 JOptionPane.QUESTION_MESSAGE, 507 null, 508 options, 509 options[0] 504 "<html>" + trn("There is {0} additional primitive referred to by relation {1}<br>" 505 + "which is deleted on the server." 506 + "<br><br>" 507 + "Do you want to undelete this too?", 508 "There are {0} additional primitives referred to by relation {1}<br>" 509 + "which are deleted on the server." 510 + "<br><br>" 511 + "Do you want to undelete these too?", 512 dependent.size(), dependent.size(), r.getId()) 513 + "</html>", 514 tr("Undelete dependent primitives?"), 515 JOptionPane.YES_NO_OPTION, 516 JOptionPane.QUESTION_MESSAGE, 517 null, 518 options, 519 options[0] 510 520 ); 511 521 -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java
r2569 r2846 14 14 import org.openstreetmap.josm.gui.conflict.pair.ListMergeModel; 15 15 import org.openstreetmap.josm.gui.conflict.pair.ListRole; 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 16 17 /** 17 18 * The model for merging two lists of relation members … … 64 65 */ 65 66 public void populate(Relation my, Relation their) { 66 if (my == null) 67 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "my")); 68 if (their == null) 69 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "their")); 67 CheckParameterUtil.ensureParameterNotNull(my, "my"); 68 CheckParameterUtil.ensureParameterNotNull(their, "their"); 70 69 71 70 getMergedEntries().clear(); … … 107 106 */ 108 107 public RelationMemberConflictResolverCommand buildResolveCommand(Relation my, Relation their) { 109 if (my == null) 110 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "my")); 111 if (their == null) 112 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "their")); 108 CheckParameterUtil.ensureParameterNotNull(my, "my"); 109 CheckParameterUtil.ensureParameterNotNull(their, "their"); 113 110 if (! isFrozen()) 114 throw new IllegalArgumentException(tr("Merged nodes not frozen yet. Can 't build resolution command"));111 throw new IllegalArgumentException(tr("Merged nodes not frozen yet. Cannot build resolution command")); 115 112 ArrayList<RelationMember> entries = getMergedEntries(); 116 113 return new RelationMemberConflictResolverCommand(my, their, entries); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeItem.java
r2512 r2846 6 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; 7 7 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 8 import org.openstreetmap.josm.tools.CheckParameterUtil; 8 9 9 10 /** … … 30 31 */ 31 32 public TagMergeItem(String key, String myTagValue, String theirTagValue) { 32 if (key == null) { 33 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "key")); 34 } 33 CheckParameterUtil.ensureParameterNotNull(key, "key"); 35 34 this.key = key; 36 35 this.myTagValue = myTagValue; … … 50 49 */ 51 50 public TagMergeItem(String key, OsmPrimitive my, OsmPrimitive their) { 52 if (key == null) throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "key"));53 if (my == null) throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "my"));54 if (their == null) throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "their"));51 CheckParameterUtil.ensureParameterNotNull(key, "key"); 52 CheckParameterUtil.ensureParameterNotNull(my, "my"); 53 CheckParameterUtil.ensureParameterNotNull(their, "their"); 55 54 this.key = key; 56 55 myTagValue = my.get(key); … … 66 65 */ 67 66 public void decide(MergeDecisionType decision) throws IllegalArgumentException { 68 if (decision == null) throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "decision"));67 CheckParameterUtil.ensureParameterNotNull(decision, "decision"); 69 68 this.mergeDecision = decision; 70 69 } … … 96 95 */ 97 96 public void applyToMyPrimitive(OsmPrimitive primitive) throws IllegalArgumentException, IllegalStateException { 98 if (primitive == null) throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "primitive"));97 CheckParameterUtil.ensureParameterNotNull(primitive, "primitive"); 99 98 if (mergeDecision == MergeDecisionType.UNDECIDED) { 100 99 throw new IllegalStateException(tr("Cannot apply undecided tag merge item.")); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeTableCellRenderer.java
r2512 r2846 6 6 import java.awt.Color; 7 7 import java.awt.Component; 8 import java.text.MessageFormat; 8 9 9 10 import javax.swing.JLabel; … … 37 38 default: 38 39 // should not happen, but just in case 39 throw new IllegalArgumentException( tr("Parameter 'col' must be 0 or 1. Got {0}.", col));40 throw new IllegalArgumentException(MessageFormat.format("Parameter 'col' must be 0 or 1. Got {0}.", col)); 40 41 } 41 42 return this; -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java
r2626 r2846 253 253 putValue(Action.NAME, ""); 254 254 } else { 255 putValue(Action.NAME, tr(">"));255 putValue(Action.NAME, ">"); 256 256 } 257 257 putValue(Action.SHORT_DESCRIPTION, tr("Keep the selected key/value pairs from the local dataset")); … … 282 282 putValue(Action.NAME, ""); 283 283 } else { 284 putValue(Action.NAME, tr(">"));284 putValue(Action.NAME, ">"); 285 285 } 286 286 putValue(Action.SHORT_DESCRIPTION, tr("Keep the selected key/value pairs from the server dataset")); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueResolutionDecision.java
r2512 r2846 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.text.MessageFormat; 6 7 import java.util.ArrayList; 7 8 import java.util.Collection; … … 15 16 import org.openstreetmap.josm.data.osm.Tag; 16 17 import org.openstreetmap.josm.data.osm.TagCollection; 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 17 19 /** 18 20 * Represents a decision for a conflict due to multiple possible value for a tag. … … 48 50 */ 49 51 public MultiValueResolutionDecision(TagCollection tags) throws IllegalArgumentException { 50 if (tags == null) 51 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "tags")); 52 CheckParameterUtil.ensureParameterNotNull(tags, "tags"); 52 53 if (tags.isEmpty()) 53 throw new IllegalArgumentException( tr("Parameter ''{0}'' must not be empty.", "tags"));54 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' must not be empty.", "tags")); 54 55 if (tags.getKeys().size() != 1) 55 throw new IllegalArgumentException( tr("Parameter ''{0}'' with tags for exactly one key expected. Got {1}.", "tags", tags.getKeys().size()));56 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' with tags for exactly one key expected. Got {1}.", "tags", tags.getKeys().size())); 56 57 this.tags = tags; 57 58 autoDecide(); … … 96 97 */ 97 98 public void keepOne(String value) throws IllegalArgumentException, IllegalStateException { 98 if (value == null) 99 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "value")); 99 CheckParameterUtil.ensureParameterNotNull(value, "value"); 100 100 if (!tags.getValues().contains(value)) 101 throw new IllegalStateException(tr("Tag collection does n't include the selected value ''{0}''.", value));101 throw new IllegalStateException(tr("Tag collection does not include the selected value ''{0}''.", value)); 102 102 this.value = value; 103 103 this.type = MultiValueDecisionType.KEEP_ONE; … … 246 246 */ 247 247 public Command buildChangeCommand(OsmPrimitive primitive) throws IllegalArgumentException, IllegalStateException { 248 if (primitive == null) 249 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "primitive")); 248 CheckParameterUtil.ensureParameterNotNull(primitive, "primitive"); 250 249 if (!isDecided()) 251 250 throw new IllegalStateException(tr("Not decided yet.")); … … 265 264 */ 266 265 public Command buildChangeCommand(Collection<? extends OsmPrimitive> primitives) { 267 if (primitives == null) 268 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "primitives")); 266 CheckParameterUtil.ensureParameterNotNull(primitives, "primitives"); 269 267 if (!isDecided()) 270 268 throw new IllegalStateException(tr("Not decided yet.")); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecision.java
r2512 r2846 5 5 import org.openstreetmap.josm.data.osm.Relation; 6 6 import org.openstreetmap.josm.data.osm.RelationMember; 7 import org.openstreetmap.josm.tools.CheckParameterUtil; 7 8 8 9 import static org.openstreetmap.josm.tools.I18n.tr; … … 18 19 19 20 public RelationMemberConflictDecision(Relation relation, int pos) throws IllegalArgumentException { 20 if (relation == null) 21 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "relation")); 21 CheckParameterUtil.ensureParameterNotNull(relation, "relation"); 22 22 RelationMember member = relation.getMember(pos); 23 23 if (member == null) -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverModel.java
r2779 r2846 17 17 18 18 import org.openstreetmap.josm.data.osm.TagCollection; 19 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 20 20 21 public class TagConflictResolverModel extends DefaultTableModel { … … 121 122 */ 122 123 public void populate(TagCollection tags, Set<String> keysWithConflicts) { 123 if (tags == null) 124 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null.", "tags")); 124 CheckParameterUtil.ensureParameterNotNull(tags, "tags"); 125 125 this.tags = tags; 126 126 displayedKeys = new ArrayList<String>();
Note:
See TracChangeset
for help on using the changeset viewer.