Changeset 3123 in josm for trunk/src/org


Ignore:
Timestamp:
2010-03-12T16:12:19+01:00 (15 years ago)
Author:
Gubaer
Message:

fixed #4725: Much slower selection list handling since 3102
Removed sorting of the selection list, was too slow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r3114 r3123  
    1818import java.util.Collection;
    1919import java.util.Collections;
    20 import java.util.Comparator;
    2120import java.util.HashSet;
    2221import java.util.LinkedList;
    2322import java.util.List;
    2423import java.util.Set;
     24import java.util.logging.Logger;
    2525
    2626import javax.swing.AbstractAction;
     
    4747import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting;
    4848import org.openstreetmap.josm.data.SelectionChangedListener;
    49 import org.openstreetmap.josm.data.osm.NameFormatter;
    5049import org.openstreetmap.josm.data.osm.Node;
    5150import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    6564import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
    6665import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    67 import org.openstreetmap.josm.gui.DefaultNameFormatter;
    6866import org.openstreetmap.josm.gui.MapView;
    6967import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     
    8179 */
    8280public class SelectionListDialog extends ToggleDialog  {
     81    static private final Logger logger = Logger.getLogger(SelectionListDialog.class.getName());
    8382
    8483    private JList lstPrimitives;
     
    518517            }
    519518            this.selection.addAll(selection);
    520             sort();
    521519            fireContentsChanged(this, 0, getSize());
    522520            remember(selection);
    523         }
    524 
    525         /**
    526          * Sorts the primitives in the list
    527          */
    528         public void sort() {
    529             Collections.sort(
    530                     this.selection,
    531                     new Comparator<OsmPrimitive>() {
    532                         NameFormatter nf = DefaultNameFormatter.getInstance();
    533 
    534                         public int compare(OsmPrimitive o1, OsmPrimitive o2) {
    535                             if (o1.getType() != o2.getType())
    536                                 return o1.getType().compareTo(o2.getType());
    537                             return o1.getDisplayName(nf).compareTo(o2.getDisplayName(nf));
    538                         }
    539                     }
    540             );
    541521        }
    542522
Note: See TracChangeset for help on using the changeset viewer.