Changeset 3114 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2010-03-11T18:34:17+01:00 (15 years ago)
Author:
Gubaer
Message:

fixed #4719: Double click in selection list does not work anymore

File:
1 edited

Legend:

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

    r3105 r3114  
    1313import java.awt.event.ActionListener;
    1414import java.awt.event.KeyEvent;
     15import java.awt.event.MouseAdapter;
    1516import java.awt.event.MouseEvent;
    1617import java.util.ArrayList;
     
    3536import javax.swing.ListSelectionModel;
    3637import javax.swing.SwingConstants;
     38import javax.swing.SwingUtilities;
    3739import javax.swing.event.ListDataEvent;
    3840import javax.swing.event.ListDataListener;
     
    171173
    172174        lstPrimitives.addMouseListener(new SelectionPopupMenuLauncher());
     175        lstPrimitives.addMouseListener(new DblClickHandler());
    173176    }
    174177
     
    198201        parentButton.add(arrowButton, BorderLayout.EAST);
    199202        return arrowButton;
     203    }
     204
     205    /**
     206     * Responds to double clicks on the list of selected objects
     207     */
     208    class DblClickHandler extends MouseAdapter {
     209        @Override
     210        public void mouseClicked(MouseEvent e) {
     211            if (e.getClickCount() < 2 || ! SwingUtilities.isLeftMouseButton(e)) return;
     212            int idx = lstPrimitives.locationToIndex(e.getPoint());
     213            if (idx < 0) return;
     214            OsmDataLayer layer = Main.main.getEditLayer();
     215            if(layer == null) return;
     216            layer.data.setSelected(Collections.singleton((OsmPrimitive)model.getElementAt(idx)));
     217        }
    200218    }
    201219
Note: See TracChangeset for help on using the changeset viewer.