Changeset 2846 in josm for trunk


Ignore:
Timestamp:
2010-01-13T20:12:10+01:00 (15 years ago)
Author:
mjulius
Message:

fix messages for gui/conflict

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  
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
     5import static org.openstreetmap.josm.tools.I18n.trn;
    56
    67import java.awt.BorderLayout;
     
    166167                tabbedPane.setIconAt(1, mergeComplete);
    167168            } 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));
    170171                tabbedPane.setIconAt(1, mergeIncomplete);
    171172            }
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java

    r2569 r2846  
    1212import java.beans.PropertyChangeEvent;
    1313import java.beans.PropertyChangeListener;
     14import java.text.MessageFormat;
    1415import java.util.ArrayList;
    1516import java.util.HashMap;
     
    320321        ArrayList<T> mergedEntries = getMergedEntries();
    321322        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));
    323324        for (int i=rows.length -1; i>=0; i--) {
    324325            int row = rows[i];
     
    372373
    373374        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));
    375376        if (current == mergedEntries.size() -1) {
    376377            copyToEnd(source, rows);
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java

    r2626 r2846  
    3535import javax.swing.event.ListSelectionListener;
    3636
     37import org.openstreetmap.josm.tools.CheckParameterUtil;
    3738import org.openstreetmap.josm.tools.ImageProvider;
    3839
     
    866867         */
    867868        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");
    871870            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));
    873872
    874873            enabledMap.put(adjustable, isParticipating);
     
    906905         * @exception IllegalArgumentException thrown, if adjustable is null
    907906         */
    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");
    913910
    914911            if (! synchronizedAdjustables.contains(adjustable)) {
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModel.java

    r2512 r2846  
    1414import org.openstreetmap.josm.gui.conflict.pair.ListMergeModel;
    1515import org.openstreetmap.josm.gui.conflict.pair.ListRole;
     16import org.openstreetmap.josm.tools.CheckParameterUtil;
    1617
    1718public class NodeListMergeModel extends ListMergeModel<Node>{
     
    2930     */
    3031    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");
    3534        getMergedEntries().clear();
    3635        getMyEntries().clear();
     
    6362     */
    6463    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");
    6966        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."));
    7168        return new WayNodesConflictResolverCommand(my, their, getMergedEntries());
    7269    }
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java

    r2512 r2846  
    66import java.awt.Color;
    77import java.awt.Component;
     8import java.text.MessageFormat;
    89import java.util.ArrayList;
    910import java.util.Collections;
     
    178179            default:
    179180                // 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));
    181182        }
    182183        return this;
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java

    r2612 r2846  
    44import static org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType.UNDECIDED;
    55import static org.openstreetmap.josm.tools.I18n.tr;
     6import static org.openstreetmap.josm.tools.I18n.trn;
    67
    78import java.beans.PropertyChangeListener;
     
    3132import org.openstreetmap.josm.io.MultiFetchServerObjectReader;
    3233import org.openstreetmap.josm.io.OsmTransferException;
     34import org.openstreetmap.josm.tools.CheckParameterUtil;
    3335
    3436/**
     
    292294     */
    293295    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");
    296297        this.deletedMergeDecision = decision;
    297298        setChanged();
     
    307308     */
    308309    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");
    311311        this.visibleMergeDecision = decision;
    312312        setChanged();
     
    468468        int ret = JOptionPane.showOptionDialog(
    469469                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]
    481486        );
    482487
     
    497502        int ret = JOptionPane.showOptionDialog(
    498503                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]
    510520        );
    511521
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java

    r2569 r2846  
    1414import org.openstreetmap.josm.gui.conflict.pair.ListMergeModel;
    1515import org.openstreetmap.josm.gui.conflict.pair.ListRole;
     16import org.openstreetmap.josm.tools.CheckParameterUtil;
    1617/**
    1718 * The model for merging two lists of relation members
     
    6465     */
    6566    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");
    7069
    7170        getMergedEntries().clear();
     
    107106     */
    108107    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");
    113110        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"));
    115112        ArrayList<RelationMember> entries = getMergedEntries();
    116113        return new RelationMemberConflictResolverCommand(my, their, entries);
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeItem.java

    r2512 r2846  
    66import org.openstreetmap.josm.data.osm.OsmPrimitive;
    77import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
     8import org.openstreetmap.josm.tools.CheckParameterUtil;
    89
    910/**
     
    3031     */
    3132    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");
    3534        this.key  = key;
    3635        this.myTagValue = myTagValue;
     
    5049     */
    5150    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");
    5554        this.key = key;
    5655        myTagValue = my.get(key);
     
    6665     */
    6766    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");
    6968        this.mergeDecision = decision;
    7069    }
     
    9695     */
    9796    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");
    9998        if (mergeDecision == MergeDecisionType.UNDECIDED) {
    10099            throw new IllegalStateException(tr("Cannot apply undecided tag merge item."));
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeTableCellRenderer.java

    r2512 r2846  
    66import java.awt.Color;
    77import java.awt.Component;
     8import java.text.MessageFormat;
    89
    910import javax.swing.JLabel;
     
    3738        default:
    3839            // 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));
    4041        }
    4142        return this;
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java

    r2626 r2846  
    253253                putValue(Action.NAME, "");
    254254            } else {
    255                 putValue(Action.NAME, tr(">"));
     255                putValue(Action.NAME, ">");
    256256            }
    257257            putValue(Action.SHORT_DESCRIPTION, tr("Keep the selected key/value pairs from the local dataset"));
     
    282282                putValue(Action.NAME, "");
    283283            } else {
    284                 putValue(Action.NAME, tr(">"));
     284                putValue(Action.NAME, ">");
    285285            }
    286286            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  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.text.MessageFormat;
    67import java.util.ArrayList;
    78import java.util.Collection;
     
    1516import org.openstreetmap.josm.data.osm.Tag;
    1617import org.openstreetmap.josm.data.osm.TagCollection;
     18import org.openstreetmap.josm.tools.CheckParameterUtil;
    1719/**
    1820 * Represents a decision for a conflict due to multiple possible value for a tag.
     
    4850     */
    4951    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");
    5253        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"));
    5455        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()));
    5657        this.tags = tags;
    5758        autoDecide();
     
    9697     */
    9798    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");
    100100        if (!tags.getValues().contains(value))
    101             throw new IllegalStateException(tr("Tag collection doesn't include the selected value ''{0}''.", value));
     101            throw new IllegalStateException(tr("Tag collection does not include the selected value ''{0}''.", value));
    102102        this.value = value;
    103103        this.type = MultiValueDecisionType.KEEP_ONE;
     
    246246     */
    247247    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");
    250249        if (!isDecided())
    251250            throw new IllegalStateException(tr("Not decided yet."));
     
    265264     */
    266265    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");
    269267        if (!isDecided())
    270268            throw new IllegalStateException(tr("Not decided yet."));
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecision.java

    r2512 r2846  
    55import org.openstreetmap.josm.data.osm.Relation;
    66import org.openstreetmap.josm.data.osm.RelationMember;
     7import org.openstreetmap.josm.tools.CheckParameterUtil;
    78
    89import static org.openstreetmap.josm.tools.I18n.tr;
     
    1819
    1920    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");
    2222        RelationMember member = relation.getMember(pos);
    2323        if (member == null)
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverModel.java

    r2779 r2846  
    1717
    1818import org.openstreetmap.josm.data.osm.TagCollection;
     19import org.openstreetmap.josm.tools.CheckParameterUtil;
    1920
    2021public class TagConflictResolverModel extends DefaultTableModel {
     
    121122     */
    122123    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");
    125125        this.tags = tags;
    126126        displayedKeys = new ArrayList<String>();
Note: See TracChangeset for help on using the changeset viewer.