Changeset 26202 in osm for applications


Ignore:
Timestamp:
2011-06-29T21:47:54+02:00 (14 years ago)
Author:
glebius
Message:
  • Make it possible to select multiple GPX layers when importing.
  • By default select all of them.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.java

    r23189 r26202  
    5858        final JList layerList = new JList(dModel);
    5959        Collection<Layer> data = Main.map.mapView.getAllLayers();
    60         Layer lastLayer = null;
    6160        int layerCnt = 0;
    6261
     
    6463            if(l instanceof GpxLayer){
    6564                dModel.addElement(l);
    66                 lastLayer = l;
    6765                layerCnt++;
    6866            }
    6967        }
    70         if(layerCnt == 1){
    71             layerList.setSelectedValue(lastLayer, true);
    72         }
    7368        if(layerCnt > 0){
     69            layerList.setSelectionInterval(0, layerCnt-1);
    7470            layerList.setCellRenderer(new DefaultListCellRenderer(){
    7571                @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
     
    10399            }
    104100
    105             GpxLayer gpx = (GpxLayer)layerList.getSelectedValue();
    106 
    107             synchronized(importing) {
    108                 this.data.load(gpx.data, dropFirst.isSelected());
     101            for (Object o : layerList.getSelectedValues()) {
     102                GpxLayer gpx = (GpxLayer )o;
     103                synchronized(importing) {
     104                    this.data.load(gpx.data, dropFirst.isSelected());
     105                }
    109106            }
    110107            Main.map.mapView.repaint();
Note: See TracChangeset for help on using the changeset viewer.