Ignore:
Timestamp:
2012-10-25T18:00:24+02:00 (12 years ago)
Author:
larry0ua
Message:

'RelToolbox: make natural sort for relation and find relation lists'

Location:
applications/editors/josm/plugins/reltoolbox/src/relcontext
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java

    r28693 r28857  
    22
    33import org.openstreetmap.josm.actions.JosmAction;
    4 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
    54import org.openstreetmap.josm.command.SequenceCommand;
    65import org.openstreetmap.josm.command.Command;
     
    1312import org.openstreetmap.josm.tools.ImageProvider;
    1413import org.openstreetmap.josm.gui.DefaultNameFormatter;
    15 import org.openstreetmap.josm.data.osm.NameFormatter;
    1614import javax.swing.event.ListSelectionEvent;
    1715import javax.swing.table.TableColumnModel;
     
    313311            return;
    314312
    315         final NameFormatter formatter = DefaultNameFormatter.getInstance();
    316         Set<Relation> relations = new TreeSet<Relation>(new Comparator<Relation>() {
    317             public int compare( Relation r1, Relation r2 ) {
    318                 int diff = r1.getDisplayName(formatter).compareTo(r2.getDisplayName(formatter));
    319                 return diff != 0 ? diff : r1.compareTo(r2);
    320             }
    321         });
     313        Set<Relation> relations = new TreeSet<Relation>(
     314                DefaultNameFormatter.getInstance().getRelationComparator());
    322315        for( OsmPrimitive element : newSelection ) {
    323316            for( OsmPrimitive ref : element.getReferrers() ) {
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/FindRelationAction.java

    r28805 r28857  
    1111import org.openstreetmap.josm.Main;
    1212import org.openstreetmap.josm.actions.JosmAction;
    13 import org.openstreetmap.josm.data.osm.NameFormatter;
    1413import org.openstreetmap.josm.data.osm.Relation;
    1514import org.openstreetmap.josm.gui.DefaultNameFormatter;
     
    161160        }
    162161
    163         final NameFormatter formatter = DefaultNameFormatter.getInstance();
    164         Collections.sort(relations, new Comparator<Relation>() {
    165             public int compare( Relation r1, Relation r2 ) {
    166                 return r1.getDisplayName(formatter).compareTo(r2.getDisplayName(formatter));
    167             }
    168         });
     162        Collections.sort(relations, DefaultNameFormatter.getInstance().getRelationComparator());
    169163        data.setRelations(relations);
    170164    }
Note: See TracChangeset for help on using the changeset viewer.