Ticket #7370: 7370.patch

File 7370.patch, 38.5 KB (added by simon04, 8 years ago)
  • src/org/openstreetmap/josm/actions/RedoAction.java

    diff --git a/src/org/openstreetmap/josm/actions/RedoAction.java b/src/org/openstreetmap/josm/actions/RedoAction.java
    index 7979dd4..724c187 100644
    a b public class RedoAction extends JosmAction implements OsmDataLayer.CommandQueueL 
    4848        } else {
    4949            putValue(NAME, tr("Redo ..."));
    5050            setTooltip(tr("Redo {0}",
    51                     Main.main.undoRedo.redoCommands.getFirst().getDescrpitionText()));
     51                    Main.main.undoRedo.redoCommands.getFirst().getDescriptionText()));
    5252        }
    5353    }
    5454}
  • src/org/openstreetmap/josm/actions/UndoAction.java

    diff --git a/src/org/openstreetmap/josm/actions/UndoAction.java b/src/org/openstreetmap/josm/actions/UndoAction.java
    index 960c69b..dc5b8f4 100644
    a b public class UndoAction extends JosmAction implements OsmDataLayer.CommandQueueL 
    4848        } else {
    4949            putValue(NAME, tr("Undo ..."));
    5050            setTooltip(tr("Undo {0}",
    51                     Main.main.undoRedo.commands.getFirst().getDescrpitionText()));
     51                    Main.main.undoRedo.commands.getFirst().getDescriptionText()));
    5252        }
    5353    }
    5454}
  • src/org/openstreetmap/josm/command/AddCommand.java

    diff --git a/src/org/openstreetmap/josm/command/AddCommand.java b/src/org/openstreetmap/josm/command/AddCommand.java
    index 10bb586..70b9899 100644
    a b import static org.openstreetmap.josm.tools.I18n.tr; 
    77import java.util.Collection;
    88import java.util.Collections;
    99
    10 import javax.swing.JLabel;
     10import javax.swing.Icon;
    1111
    1212import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    public class AddCommand extends Command { 
    5959        added.add(osm);
    6060    }
    6161
    62     @Override public JLabel getDescription() {
     62    @Override
     63    public String getDescriptionText() {
    6364        String msg;
    6465        switch(OsmPrimitiveType.from(osm)) {
    6566        case NODE: msg = marktr("Add node {0}"); break;
    public class AddCommand extends Command { 
    6768        case RELATION: msg = marktr("Add relation {0}"); break;
    6869        default: /* should not happen */msg = ""; break;
    6970        }
     71        return tr(msg, osm.getDisplayName(DefaultNameFormatter.getInstance()));
     72    }
    7073
    71         return new JLabel(
    72                 tr(msg, osm.getDisplayName(DefaultNameFormatter.getInstance())),
    73                 ImageProvider.get(OsmPrimitiveType.from(osm)),
    74                 JLabel.HORIZONTAL);
     74    @Override
     75    public Icon getDescriptionIcon() {
     76        return ImageProvider.get(OsmPrimitiveType.from(osm));
    7577    }
    7678
    7779    @Override
  • src/org/openstreetmap/josm/command/AddPrimitivesCommand.java

    diff --git a/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java b/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
    index f576e46..1f85d01 100644
    a b import java.util.ArrayList; 
    77import java.util.Collection;
    88import java.util.HashSet;
    99import java.util.List;
     10import javax.swing.Icon;
    1011
    1112import javax.swing.JLabel;
    1213
    public class AddPrimitivesCommand extends Command { 
    100101        }
    101102    }
    102103
    103     @Override public JLabel getDescription() {
     104    @Override
     105    public String getDescriptionText() {
    104106        int size = data != null ? data.size() : createdPrimitives.size();
    105         return new JLabel(trn("Added {0} object", "Added {0} objects", size, size), null,
    106                 JLabel.HORIZONTAL
    107         );
     107        return trn("Added {0} object", "Added {0} objects", size, size);
     108    }
     109
     110    @Override
     111    public Icon getDescriptionIcon() {
     112        return null;
    108113    }
    109114
    110115    @Override
  • src/org/openstreetmap/josm/command/ChangeCommand.java

    diff --git a/src/org/openstreetmap/josm/command/ChangeCommand.java b/src/org/openstreetmap/josm/command/ChangeCommand.java
    index 7eb4473..b7df87e 100644
    a b import static org.openstreetmap.josm.tools.I18n.marktr; 
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    77import java.util.Collection;
    8 
    9 import javax.swing.JLabel;
     8import javax.swing.Icon;
    109
    1110import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1211import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    public class ChangeCommand extends Command { 
    4948        modified.add(osm);
    5049    }
    5150
    52     @Override public JLabel getDescription() {
     51    @Override
     52    public String getDescriptionText() {
    5353        String msg = "";
    5454        switch(OsmPrimitiveType.from(osm)) {
    5555        case NODE: msg = marktr("Change node {0}"); break;
    5656        case WAY: msg = marktr("Change way {0}"); break;
    5757        case RELATION: msg = marktr("Change relation {0}"); break;
    5858        }
    59         return new JLabel(tr(msg,
    60                     osm.getDisplayName(DefaultNameFormatter.getInstance())),
    61                     ImageProvider.get(OsmPrimitiveType.from(osm)),
    62                     JLabel.HORIZONTAL);
     59        return tr(msg, osm.getDisplayName(DefaultNameFormatter.getInstance()));
     60    }
     61
     62    @Override
     63    public Icon getDescriptionIcon() {
     64        return ImageProvider.get(OsmPrimitiveType.from(osm));
    6365    }
    6466}
  • src/org/openstreetmap/josm/command/ChangeNodesCommand.java

    diff --git a/src/org/openstreetmap/josm/command/ChangeNodesCommand.java b/src/org/openstreetmap/josm/command/ChangeNodesCommand.java
    index 7a1356a..46a7ec2 100644
    a b import static org.openstreetmap.josm.tools.I18n.tr; 
    55
    66import java.util.Collection;
    77import java.util.List;
    8 
    9 import javax.swing.JLabel;
     8import javax.swing.Icon;
    109
    1110import org.openstreetmap.josm.data.osm.Node;
    1211import org.openstreetmap.josm.data.osm.Way;
    public class ChangeNodesCommand extends Command { 
    4544        modified.add(way);
    4645    }
    4746
    48     @Override public JLabel getDescription() {
    49         String msg = tr("Changed nodes of {0}", way.getDisplayName(DefaultNameFormatter.getInstance()));
    50         return new JLabel(msg,
    51                         ImageProvider.get(OsmPrimitiveType.WAY),
    52                         JLabel.HORIZONTAL);
     47    @Override
     48    public String getDescriptionText() {
     49        return tr("Changed nodes of {0}", way.getDisplayName(DefaultNameFormatter.getInstance()));
     50    }
     51
     52    @Override
     53    public Icon getDescriptionIcon() {
     54        return ImageProvider.get(OsmPrimitiveType.WAY);
    5355    }
    5456}
  • src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    diff --git a/src/org/openstreetmap/josm/command/ChangePropertyCommand.java b/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
    index 6a0c26e..1ffd2f2 100644
    a b import java.util.HashMap; 
    1313import java.util.LinkedList;
    1414import java.util.List;
    1515import java.util.Map;
    16 
    17 import javax.swing.JLabel;
     16import javax.swing.Icon;
    1817
    1918import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.data.osm.OsmPrimitive;
    public class ChangePropertyCommand extends Command { 
    144143        modified.addAll(objects);
    145144    }
    146145
    147     @Override public JLabel getDescription() {
     146    @Override
     147    public String getDescriptionText() {
    148148        String text;
    149149        if (objects.size() == 1 && tags.size() == 1) {
    150150            OsmPrimitive primitive = objects.iterator().next();
    public class ChangePropertyCommand extends Command { 
    186186            } else
    187187                text = tr("Set {0} properties for {1} objects", tags.size(), objects.size());
    188188        }
    189         return new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL);
     189        return text;
     190    }
     191
     192    @Override
     193    public Icon getDescriptionIcon() {
     194        return ImageProvider.get("data", "key");
    190195    }
    191196
    192197    @Override public Collection<PseudoCommand> getChildren() {
    public class ChangePropertyCommand extends Command { 
    195200        List<PseudoCommand> children = new ArrayList<PseudoCommand>();
    196201        for (final OsmPrimitive osm : objects) {
    197202            children.add(new PseudoCommand() {
    198                 @Override public JLabel getDescription() {
    199                     return new JLabel(
    200                                 osm.getDisplayName(DefaultNameFormatter.getInstance()),
    201                                 ImageProvider.get(OsmPrimitiveType.from(osm)),
    202                                 JLabel.HORIZONTAL);
     203                @Override public String getDescriptionText() {
     204                    return osm.getDisplayName(DefaultNameFormatter.getInstance());
     205                }
    203206
     207                @Override public Icon getDescriptionIcon() {
     208                    return ImageProvider.get(OsmPrimitiveType.from(osm));
    204209                }
     210
    205211                @Override public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
    206212                    return Collections.singleton(osm);
    207213                }
  • src/org/openstreetmap/josm/command/ChangePropertyKeyCommand.java

    diff --git a/src/org/openstreetmap/josm/command/ChangePropertyKeyCommand.java b/src/org/openstreetmap/josm/command/ChangePropertyKeyCommand.java
    index bca899e..5719307 100644
    a b import java.util.Collection; 
    99import java.util.Collections;
    1010import java.util.LinkedList;
    1111import java.util.List;
     12import javax.swing.Icon;
    1213
    13 import javax.swing.JLabel;
    14 
    15 import org.openstreetmap.josm.command.Command;
    16 import org.openstreetmap.josm.command.PseudoCommand;
    1714import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1815import org.openstreetmap.josm.data.validation.util.NameVisitor;
    1916import org.openstreetmap.josm.tools.ImageProvider;
    public class ChangePropertyKeyCommand extends Command { 
    7067    }
    7168
    7269    @Override
    73     public JLabel getDescription() {
     70    public String getDescriptionText() {
    7471        String text = tr( "Replace \"{0}\" by \"{1}\" for", key, newKey);
    7572        if (objects.size() == 1) {
    7673            NameVisitor v = new NameVisitor();
    public class ChangePropertyKeyCommand extends Command { 
    7976        } else {
    8077            text += " "+objects.size()+" "+trn("object","objects",objects.size());
    8178        }
    82         return new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL);
     79        return text;
     80    }
     81
     82    @Override
     83    public Icon getDescriptionIcon() {
     84        return ImageProvider.get("data", "key");
    8385    }
    8486
    8587    @Override
    public class ChangePropertyKeyCommand extends Command { 
    9395            osm.visit(v);
    9496            children.add(new PseudoCommand() {
    9597                @Override
    96                 public JLabel getDescription() {
    97                     return v.toLabel();
     98                public String getDescriptionText() {
     99                    return v.name;
     100                }
     101                @Override
     102                public Icon getDescriptionIcon() {
     103                    return v.icon;
    98104                }
    99105                @Override
    100106                public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
  • src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java

    diff --git a/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java b/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java
    index 38eb158..6cc60ed 100644
    a b import static org.openstreetmap.josm.tools.I18n.tr; 
    55
    66import java.util.Collection;
    77
    8 import javax.swing.JLabel;
    9 
    10 import org.openstreetmap.josm.Main;
     8import javax.swing.Icon;
    119import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1210import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1311import org.openstreetmap.josm.data.osm.Relation;
    public class ChangeRelationMemberRoleCommand extends Command { 
    6361        modified.add(relation);
    6462    }
    6563
    66     @Override public JLabel getDescription() {
    67         return new JLabel(
    68                         tr("Change relation member role for {0} {1}",
    69                                 OsmPrimitiveType.from(relation),
    70                                 relation.getDisplayName(DefaultNameFormatter.getInstance())
    71                         ),
    72                         ImageProvider.get(OsmPrimitiveType.from(relation)),
    73                         JLabel.HORIZONTAL
    74         );
     64    @Override
     65    public String getDescriptionText() {
     66        return tr("Change relation member role for {0} {1}",
     67                OsmPrimitiveType.from(relation),
     68                relation.getDisplayName(DefaultNameFormatter.getInstance()));
     69    }
     70
     71    @Override
     72    public Icon getDescriptionIcon() {
     73        return ImageProvider.get(OsmPrimitiveType.from(relation));
    7574    }
    7675}
  • src/org/openstreetmap/josm/command/Command.java

    diff --git a/src/org/openstreetmap/josm/command/Command.java b/src/org/openstreetmap/josm/command/Command.java
    index 3d4a21e..514ec5f 100644
    a b abstract public class Command extends PseudoCommand { 
    161161        return cloneMap.keySet();
    162162    }
    163163
    164     public String getDescrpitionText() {
    165         Object o = getDescription();
    166         if (o instanceof JLabel) {
    167             return ((JLabel) o).getText();
    168         } else {
    169             return o.toString();
    170         }
    171     }
    172 
    173164    /**
    174165     * Check whether user is about to operate on data outside of the download area.
    175166     * Request confirmation if he is.
  • src/org/openstreetmap/josm/command/ConflictAddCommand.java

    diff --git a/src/org/openstreetmap/josm/command/ConflictAddCommand.java b/src/org/openstreetmap/josm/command/ConflictAddCommand.java
    index 157c8d5..d49e3dd 100644
    a b package org.openstreetmap.josm.command; 
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    66import java.util.Collection;
    7 
    8 import javax.swing.JLabel;
     7import javax.swing.Icon;
    98import javax.swing.JOptionPane;
    109
    1110import org.openstreetmap.josm.Main;
    public class ConflictAddCommand extends Command { 
    6261        // nothing to fill
    6362    }
    6463
    65     @Override public JLabel getDescription() {
    66         return new JLabel(
    67                 tr("Add conflict for ''{0}''",
    68                         conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance())
    69                 ),
    70                 ImageProvider.get(OsmPrimitiveType.from(conflict.getMy())),
    71                 JLabel.HORIZONTAL
    72         );
     64    @Override
     65    public String getDescriptionText() {
     66        return tr("Add conflict for ''{0}''",
     67                conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance()));
     68    }
     69
     70    @Override
     71    public Icon getDescriptionIcon() {
     72        return ImageProvider.get(OsmPrimitiveType.from(conflict.getMy()));
    7373    }
    7474}
  • src/org/openstreetmap/josm/command/CoordinateConflictResolveCommand.java

    diff --git a/src/org/openstreetmap/josm/command/CoordinateConflictResolveCommand.java b/src/org/openstreetmap/josm/command/CoordinateConflictResolveCommand.java
    index acc5119..a47edb4 100644
    a b package org.openstreetmap.josm.command; 
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    66import java.util.Collection;
    7 
    8 import javax.swing.JLabel;
     7import javax.swing.Icon;
    98
    109import org.openstreetmap.josm.data.conflict.Conflict;
    1110import org.openstreetmap.josm.data.osm.Node;
    public class CoordinateConflictResolveCommand extends ConflictResolveCommand { 
    3736        this.decision = decision;
    3837    }
    3938
    40     @Override public JLabel getDescription() {
    41         return new JLabel(
    42                         tr("Resolve conflicts in coordinates in {0}",conflict.getMy().getId()),
    43                         ImageProvider.get("data", "object"),
    44                         JLabel.HORIZONTAL
    45         );
     39    @Override
     40    public String getDescriptionText() {
     41        return tr("Resolve conflicts in coordinates in {0}", conflict.getMy().getId());
     42    }
     43
     44    @Override
     45    public Icon getDescriptionIcon() {
     46        return ImageProvider.get("data", "object");
    4647    }
    4748
    4849    @Override
  • src/org/openstreetmap/josm/command/DeleteCommand.java

    diff --git a/src/org/openstreetmap/josm/command/DeleteCommand.java b/src/org/openstreetmap/josm/command/DeleteCommand.java
    index ceb5e26..e6751cc 100644
    a b import java.util.List; 
    1818import java.util.Map;
    1919import java.util.Set;
    2020import java.util.Map.Entry;
     21import javax.swing.Icon;
    2122
    2223import javax.swing.JLabel;
    2324
    public class DeleteCommand extends Command { 
    148149            Collection<OsmPrimitive> added) {
    149150    }
    150151
    151     @Override public JLabel getDescription() {
    152         if (toDelete.size() == 1) {
     152    private Set<OsmPrimitiveType> getTypesToDelete() {
     153        Set<OsmPrimitiveType> typesToDelete = new HashSet<OsmPrimitiveType>();
     154        for (OsmPrimitive osm : toDelete) {
     155            typesToDelete.add(OsmPrimitiveType.from(osm));
     156        }
     157        return typesToDelete;
     158    }
     159
     160    @Override
     161    public String getDescriptionText() {
     162           if (toDelete.size() == 1) {
    153163            OsmPrimitive primitive = toDelete.iterator().next();
    154164            String msg = "";
    155165            switch(OsmPrimitiveType.from(primitive)) {
    public class DeleteCommand extends Command { 
    158168            case RELATION:msg = marktr("Delete relation {0}"); break;
    159169            }
    160170
    161             return new JLabel(tr(msg, primitive.getDisplayName(DefaultNameFormatter.getInstance())),
    162                     ImageProvider.get(OsmPrimitiveType.from(primitive)), JLabel.HORIZONTAL);
     171            return tr(msg, primitive.getDisplayName(DefaultNameFormatter.getInstance()));
    163172        } else {
    164             Set<OsmPrimitiveType> typesToDelete = new HashSet<OsmPrimitiveType>();
    165             for (OsmPrimitive osm : toDelete) {
    166                 typesToDelete.add(OsmPrimitiveType.from(osm));
    167             }
     173            Set<OsmPrimitiveType> typesToDelete = getTypesToDelete();
    168174            String msg = "";
    169             String apiname = "object";
    170175            if (typesToDelete.size() > 1) {
    171176                msg = trn("Delete {0} object", "Delete {0} objects", toDelete.size(), toDelete.size());
    172177            } else {
    173178                OsmPrimitiveType t = typesToDelete.iterator().next();
    174                 apiname = t.getAPIName();
    175179                switch(t) {
    176180                case NODE: msg = trn("Delete {0} node", "Delete {0} nodes", toDelete.size(), toDelete.size()); break;
    177181                case WAY: msg = trn("Delete {0} way", "Delete {0} ways", toDelete.size(), toDelete.size()); break;
    178182                case RELATION: msg = trn("Delete {0} relation", "Delete {0} relations", toDelete.size(), toDelete.size()); break;
    179183                }
    180184            }
    181             return  new JLabel(msg, ImageProvider.get("data", apiname), JLabel.HORIZONTAL);
     185            return msg;
     186        }
     187    }
     188
     189    @Override
     190    public Icon getDescriptionIcon() {
     191        if (toDelete.size() == 1) {
     192            return ImageProvider.get(OsmPrimitiveType.from(toDelete.iterator().next()));
     193        }
     194        Set<OsmPrimitiveType> typesToDelete = getTypesToDelete();
     195        if (typesToDelete.size() > 1) {
     196            return ImageProvider.get("data", "object");
     197        } else {
     198            return ImageProvider.get(typesToDelete.iterator().next());
    182199        }
    183200    }
    184201
    public class DeleteCommand extends Command { 
    189206            List<PseudoCommand> children = new ArrayList<PseudoCommand>();
    190207            for (final OsmPrimitive osm : toDelete) {
    191208                children.add(new PseudoCommand() {
    192                     @Override public JLabel getDescription() {
    193                         return new JLabel(
    194                                 tr("Deleted ''{0}''",
    195                                         osm.getDisplayName(DefaultNameFormatter.getInstance())),
    196                                         ImageProvider.get(OsmPrimitiveType.from(osm)), JLabel.HORIZONTAL);
     209
     210                    @Override public String getDescriptionText() {
     211                        return tr("Deleted ''{0}''", osm.getDisplayName(DefaultNameFormatter.getInstance()));
     212                    }
     213
     214                    @Override public Icon getDescriptionIcon() {
     215                        return ImageProvider.get(OsmPrimitiveType.from(osm));
    197216                    }
     217
    198218                    @Override public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
    199219                        return Collections.singleton(osm);
    200220                    }
  • src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java

    diff --git a/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java b/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java
    index ed978da..de64008 100644
    a b import static org.openstreetmap.josm.tools.I18n.tr; 
    55
    66import java.util.Collection;
    77
    8 import javax.swing.JLabel;
     8import javax.swing.Icon;
    99
    1010import org.openstreetmap.josm.data.conflict.Conflict;
     11import org.openstreetmap.josm.data.osm.Node;
    1112import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1213import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
    1314import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    public class DeletedStateConflictResolveCommand extends ConflictResolveCommand { 
    3738        this.decision = decision;
    3839    }
    3940
    40     @Override public JLabel getDescription() {
    41         return new JLabel(
    42                         tr("Resolve conflicts in deleted state in {0}",conflict.getMy().getId()),
    43                         ImageProvider.get("data", "object"),
    44                         JLabel.HORIZONTAL
    45         );
     41    @Override
     42    public String getDescriptionText() {
     43        return tr("Resolve conflicts in deleted state in {0}", conflict.getMy().getId());
     44    }
     45
     46    @Override
     47    public Icon getDescriptionIcon() {
     48        return ImageProvider.get("data", "object");
    4649    }
    4750
    4851    @Override
  • src/org/openstreetmap/josm/command/ModifiedConflictResolveCommand.java

    diff --git a/src/org/openstreetmap/josm/command/ModifiedConflictResolveCommand.java b/src/org/openstreetmap/josm/command/ModifiedConflictResolveCommand.java
    index 9d7ddbc..1c81cca 100644
    a b import static org.openstreetmap.josm.tools.I18n.marktr; 
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    77import java.util.Collection;
     8import javax.swing.Icon;
    89
    910import javax.swing.JLabel;
    1011
    public class ModifiedConflictResolveCommand extends ConflictResolveCommand { 
    3233        this.conflict = conflict;
    3334    }
    3435
    35     @Override public JLabel getDescription() {
     36    @Override
     37    public String getDescriptionText() {
    3638        String msg = "";
    3739        switch(OsmPrimitiveType.from(conflict.getMy())) {
    3840        case NODE: msg = marktr("Set the ''modified'' flag for node {0}"); break;
    3941        case WAY: msg = marktr("Set the ''modified'' flag for way {0}"); break;
    4042        case RELATION: msg = marktr("Set the ''modified'' flag for relation {0}"); break;
    4143        }
    42         return new JLabel(
    43                         tr(msg,conflict.getMy().getId()),
    44                         ImageProvider.get("data", "object"),
    45                         JLabel.HORIZONTAL
    46         );
     44        return tr(msg,conflict.getMy().getId());
     45    }
     46
     47    @Override
     48    public Icon getDescriptionIcon() {
     49        return ImageProvider.get("data", "object");
    4750    }
    4851
    4952    @Override
  • src/org/openstreetmap/josm/command/MoveCommand.java

    diff --git a/src/org/openstreetmap/josm/command/MoveCommand.java b/src/org/openstreetmap/josm/command/MoveCommand.java
    index 43417d9..85bf24d 100644
    a b import java.util.Collections; 
    88import java.util.Iterator;
    99import java.util.LinkedList;
    1010import java.util.List;
     11import javax.swing.Icon;
    1112
    1213import javax.swing.JLabel;
    1314
    public class MoveCommand extends Command { 
    130131        }
    131132    }
    132133
    133     @Override public JLabel getDescription() {
    134         return new JLabel(trn("Move {0} node", "Move {0} nodes", nodes.size(), nodes.size()), ImageProvider.get("data", "node"), JLabel.HORIZONTAL);
     134    @Override
     135    public String getDescriptionText() {
     136        return trn("Move {0} node", "Move {0} nodes", nodes.size(), nodes.size());
     137    }
     138
     139    @Override
     140    public Icon getDescriptionIcon() {
     141        return ImageProvider.get("data", "node");
    135142    }
    136143
    137144    @Override
  • src/org/openstreetmap/josm/command/PseudoCommand.java

    diff --git a/src/org/openstreetmap/josm/command/PseudoCommand.java b/src/org/openstreetmap/josm/command/PseudoCommand.java
    index 6c30120..4186327 100644
    a b  
    22package org.openstreetmap.josm.command;
    33
    44import java.util.Collection;
     5import javax.swing.Icon;
     6import javax.swing.JLabel;
    57
    68import org.openstreetmap.josm.data.osm.OsmPrimitive;
    79
    import org.openstreetmap.josm.data.osm.OsmPrimitive; 
    1315abstract public class PseudoCommand {
    1416    /**
    1517     * Provide a description that can be presented in a list or tree view.
     18     * @deprecated This abstract method is deprecated.
     19     * On 2012-03-01, this abstract method will be removed.
     20     * At the same moment, the methods {@link #getDescrpitionText()} and {@link #getDescrpitionIcon()}
     21     * will be made abstract.
     22     * For a smooth transition, replace {@link #getDescription()} by implementations of
     23     * {@link #getDescrpitionText()} and {@link #getDescrpitionIcon()} as early as possible.
     24     * {@link #getDescription()} is no longer abstract and can therefore be removed.
    1625     */
    17     abstract public Object getDescription();
     26    @Deprecated
     27    public Object getDescription() {
     28        return null;
     29    }
     30
     31    /**
     32     * Provides a description text representing this command.
     33     */
     34    public String getDescriptionText() {
     35        Object o = getDescription();
     36        if (o instanceof JLabel) {
     37            return ((JLabel) o).getText();
     38        } else {
     39            return o.toString();
     40        }
     41    }
     42
     43    /**
     44     * Provides a descriptive icon of this command.
     45     */
     46    public Icon getDescriptionIcon() {
     47        Object o = getDescription();
     48        if (o instanceof JLabel) {
     49            return ((JLabel) o).getIcon();
     50        } else {
     51            return null;
     52        }
     53    }
    1854
    1955    /**
    2056     * Return the primitives that take part in this command.
  • src/org/openstreetmap/josm/command/PurgeCommand.java

    diff --git a/src/org/openstreetmap/josm/command/PurgeCommand.java b/src/org/openstreetmap/josm/command/PurgeCommand.java
    index b025813..afc3aad 100644
    a b import java.util.List; 
    1212import java.util.Map;
    1313import java.util.Set;
    1414
    15 import javax.swing.JLabel;
     15import javax.swing.Icon;
    1616
    1717import org.openstreetmap.josm.data.osm.DataSet;
    1818import org.openstreetmap.josm.data.osm.Hash;
    public class PurgeCommand extends Command { 
    251251    }
    252252
    253253    @Override
    254     public Object getDescription() {
    255         return new JLabel(trn("Purged {0} object", "Purged {0} objects", toPurge.size(), toPurge.size()), ImageProvider.get("data", "purge"), JLabel.HORIZONTAL);
     254    public String getDescriptionText() {
     255        return trn("Purged {0} object", "Purged {0} objects", toPurge.size(), toPurge.size());
     256    }
     257
     258    @Override
     259    public Icon getDescriptionIcon() {
     260        return ImageProvider.get("data", "purge");
    256261    }
    257262
    258263    @Override
  • src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java

    diff --git a/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java b/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java
    index 7a0fb89..1f1849d 100644
    a b import static org.openstreetmap.josm.tools.I18n.tr; 
    66import java.util.Collection;
    77import java.util.List;
    88
    9 import javax.swing.JLabel;
     9import javax.swing.Icon;
    1010
    1111import org.openstreetmap.josm.Main;
    1212import org.openstreetmap.josm.data.osm.OsmPrimitive;
    public class RelationMemberConflictResolverCommand extends Command { 
    4545        this.mergedMembers = mergedMembers;
    4646    }
    4747
    48     @Override public JLabel getDescription() {
    49         return new JLabel(
    50                         tr("Resolve conflicts in member list of relation {0}", my.getId()),
    51                         ImageProvider.get("data", "object"),
    52                         JLabel.HORIZONTAL
    53         );
     48    @Override
     49    public String getDescriptionText() {
     50        return tr("Resolve conflicts in member list of relation {0}", my.getId());
     51    }
     52
     53    @Override
     54    public Icon getDescriptionIcon() {
     55        return ImageProvider.get("data", "object");
    5456    }
    5557
    5658    @Override
  • src/org/openstreetmap/josm/command/RotateCommand.java

    diff --git a/src/org/openstreetmap/josm/command/RotateCommand.java b/src/org/openstreetmap/josm/command/RotateCommand.java
    index 288b96f..ad6603e 100644
    a b import static org.openstreetmap.josm.tools.I18n.trn; 
    55
    66import java.util.Collection;
    77
    8 import javax.swing.JLabel;
     8import javax.swing.Icon;
    99
    1010import org.openstreetmap.josm.data.coor.EastNorth;
    1111import org.openstreetmap.josm.data.osm.Node;
    public class RotateCommand extends TransformNodesCommand { 
    9898    }
    9999
    100100    @Override
    101     public JLabel getDescription() {
    102         return new JLabel(trn("Rotate {0} node", "Rotate {0} nodes", nodes.size(), nodes.size()), ImageProvider.get("data", "node"), JLabel.HORIZONTAL);
     101    public String getDescriptionText() {
     102        return trn("Rotate {0} node", "Rotate {0} nodes", nodes.size(), nodes.size());
     103    }
     104
     105    @Override
     106    public Icon getDescriptionIcon() {
     107        return ImageProvider.get("data", "node");
    103108    }
    104109}
  • src/org/openstreetmap/josm/command/ScaleCommand.java

    diff --git a/src/org/openstreetmap/josm/command/ScaleCommand.java b/src/org/openstreetmap/josm/command/ScaleCommand.java
    index 69f4403..b01a2a2 100644
    a b import static org.openstreetmap.josm.tools.I18n.trn; 
    55
    66import java.util.Collection;
    77
    8 import javax.swing.JLabel;
     8import javax.swing.Icon;
    99
    1010import org.openstreetmap.josm.data.coor.EastNorth;
    1111import org.openstreetmap.josm.data.osm.Node;
    public class ScaleCommand extends TransformNodesCommand { 
    8080    }
    8181
    8282    @Override
    83     public JLabel getDescription() {
    84         return new JLabel(trn("Scale {0} node", "Scale {0} nodes", nodes.size(), nodes.size()), ImageProvider.get("data", "node"), JLabel.HORIZONTAL);
     83    public String getDescriptionText() {
     84        return trn("Scale {0} node", "Scale {0} nodes", nodes.size(), nodes.size());
    8585    }
    8686
     87    @Override
     88    public Icon getDescriptionIcon() {
     89        return ImageProvider.get("data", "node");
     90    }
    8791}
  • src/org/openstreetmap/josm/command/SequenceCommand.java

    diff --git a/src/org/openstreetmap/josm/command/SequenceCommand.java b/src/org/openstreetmap/josm/command/SequenceCommand.java
    index 3dae28c..c8af9f7 100644
    a b import java.util.Arrays; 
    77import java.util.Collection;
    88import java.util.HashSet;
    99import java.util.List;
     10import javax.swing.Icon;
    1011
    1112import javax.swing.JLabel;
    1213
    public class SequenceCommand extends Command { 
    8687        }
    8788    }
    8889
    89     @Override public JLabel getDescription() {
    90         return new JLabel(tr("Sequence")+": "+name, ImageProvider.get("data", "sequence"), JLabel.HORIZONTAL);
     90    @Override
     91    public String getDescriptionText() {
     92        return tr("Sequence: {0}", name);
     93    }
     94
     95    @Override
     96    public Icon getDescriptionIcon() {
     97        return ImageProvider.get("data", "sequence");
    9198    }
    9299
    93100    @Override
  • src/org/openstreetmap/josm/command/TagConflictResolveCommand.java

    diff --git a/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java b/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java
    index 8739d8a..6f37ad9 100644
    a b import static org.openstreetmap.josm.tools.I18n.tr; 
    66
    77import java.util.Collection;
    88import java.util.List;
     9import javax.swing.Icon;
    910
    10 import javax.swing.JLabel;
    1111
    1212import org.openstreetmap.josm.data.conflict.Conflict;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitive;
    public class TagConflictResolveCommand extends ConflictResolveCommand { 
    5454        this.mergeItems = mergeItems;
    5555    }
    5656
    57     @Override public JLabel getDescription() {
     57    @Override
     58    public String getDescriptionText() {
    5859        String msg = "";
    5960        switch(OsmPrimitiveType.from(conflict.getMy())) {
    6061        case NODE: msg = marktr("Resolve {0} tag conflicts in node {1}"); break;
    6162        case WAY: msg = marktr("Resolve {0} tag conflicts in way {1}"); break;
    6263        case RELATION: msg = marktr("Resolve {0} tag conflicts in relation {1}"); break;
    6364        }
    64         return new JLabel(
    65                         tr(msg,getNumDecidedConflicts(), conflict.getMy().getId()),
    66                         ImageProvider.get("data", "object"),
    67                         JLabel.HORIZONTAL
    68         );
     65        return tr(msg,getNumDecidedConflicts(), conflict.getMy().getId());
     66    }
     67
     68    @Override
     69    public Icon getDescriptionIcon() {
     70        return ImageProvider.get("data", "object");
    6971    }
    7072
    7173    @Override
  • src/org/openstreetmap/josm/command/TransformNodesCommand.java

    diff --git a/src/org/openstreetmap/josm/command/TransformNodesCommand.java b/src/org/openstreetmap/josm/command/TransformNodesCommand.java
    index edafc44..d50dca1 100644
    a b import java.util.HashMap; 
    88import java.util.LinkedList;
    99import java.util.Map;
    1010
    11 import javax.swing.JLabel;
     11import javax.swing.Icon;
    1212
    1313import org.openstreetmap.josm.data.coor.EastNorth;
    1414import org.openstreetmap.josm.data.coor.LatLon;
    public abstract class TransformNodesCommand extends Command { 
    122122    }
    123123
    124124    @Override
    125     public JLabel getDescription() {
    126         return new JLabel(trn("Transform {0} node", "Transform {0} nodes", nodes.size(), nodes.size()), ImageProvider.get("data", "node"), JLabel.HORIZONTAL);
     125    public String getDescriptionText() {
     126        return trn("Transform {0} node", "Transform {0} nodes", nodes.size(), nodes.size());
     127    }
     128
     129    @Override
     130    public Icon getDescriptionIcon() {
     131        return ImageProvider.get("data", "node");
    127132    }
    128133
    129134    /**
  • src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java

    diff --git a/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java b/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java
    index 319af03..6188d33 100644
    a b import static org.openstreetmap.josm.tools.I18n.marktr; 
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    77import java.util.Collection;
    8 
    9 import javax.swing.JLabel;
     8import javax.swing.Icon;
    109
    1110import org.openstreetmap.josm.data.conflict.Conflict;
    1211import org.openstreetmap.josm.data.osm.OsmPrimitive;
    public class VersionConflictResolveCommand extends ConflictResolveCommand { 
    3231        this.conflict = conflict;
    3332    }
    3433
    35     @Override public JLabel getDescription() {
     34    @Override
     35    public String getDescriptionText() {
    3636        String msg = "";
    3737        switch(OsmPrimitiveType.from(conflict.getMy())) {
    3838        case NODE: msg = marktr("Resolve version conflict for node {0}"); break;
    3939        case WAY: msg = marktr("Resolve version conflict for way {0}"); break;
    4040        case RELATION: msg = marktr("Resolve version conflict for relation {0}"); break;
    4141        }
    42         return new JLabel(
    43                         tr(msg,conflict.getMy().getId()),
    44                         ImageProvider.get("data", "object"),
    45                         JLabel.HORIZONTAL
    46         );
     42        return tr(msg, conflict.getMy().getId());
     43    }
     44
     45    @Override
     46    public Icon getDescriptionIcon() {
     47        return ImageProvider.get("data", "object");
    4748    }
    4849
    4950    @Override
  • src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java

    diff --git a/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java b/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java
    index cb4f319..ce3beb9 100644
    a b import static org.openstreetmap.josm.tools.I18n.tr; 
    66import java.util.Collection;
    77import java.util.List;
    88
    9 import javax.swing.JLabel;
     9import javax.swing.Icon;
    1010
    1111import org.openstreetmap.josm.data.conflict.Conflict;
    1212import org.openstreetmap.josm.data.osm.Node;
    public class WayNodesConflictResolverCommand extends ConflictResolveCommand { 
    3939        this.conflict = (Conflict<Way>) conflict;
    4040        this.mergedNodeList = mergedNodeList;
    4141    }
     42    @Override
     43    public String getDescriptionText() {
     44        return tr("Resolve conflicts in node list of way {0}", conflict.getMy().getId());
     45    }
    4246
    43     @Override public JLabel getDescription() {
    44         return new JLabel(
    45                         tr("Resolve conflicts in node list of way {0}", conflict.getMy().getId()),
    46                         ImageProvider.get("data", "object"),
    47                         JLabel.HORIZONTAL
    48         );
     47    @Override
     48    public Icon getDescriptionIcon() {
     49        return ImageProvider.get("data", "object");
    4950    }
    5051
    5152    @Override
  • src/org/openstreetmap/josm/gui/dialogs/CommandListMutableTreeNode.java

    diff --git a/src/org/openstreetmap/josm/gui/dialogs/CommandListMutableTreeNode.java b/src/org/openstreetmap/josm/gui/dialogs/CommandListMutableTreeNode.java
    index 78d7363..c44bc91 100644
    a b  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.dialogs;
    33
     4import javax.swing.JLabel;
    45import javax.swing.tree.DefaultMutableTreeNode;
    56
    67import org.openstreetmap.josm.command.PseudoCommand;
    public class CommandListMutableTreeNode extends DefaultMutableTreeNode { 
    1415    protected int idx;
    1516
    1617    public CommandListMutableTreeNode(PseudoCommand cmd, int idx) {
    17         super(cmd.getDescription());
     18        super(new JLabel(cmd.getDescriptionText(), cmd.getDescriptionIcon(), JLabel.HORIZONTAL));
    1819        this.cmd = cmd;
    1920        this.idx = idx;
    2021    }