Changeset 9245 in josm for trunk/src


Ignore:
Timestamp:
2016-01-01T20:25:44+01:00 (9 years ago)
Author:
simon04
Message:

fix #12101 - Possibility to create a duplicate way with split dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r9230 r9245  
    1919import java.util.List;
    2020import java.util.Set;
     21import java.util.concurrent.atomic.AtomicInteger;
    2122
    2223import javax.swing.DefaultListCellRenderer;
     
    132133    public void actionPerformed(ActionEvent e) {
    133134
     135        if (SegmentToKeepSelectionDialog.DISPLAY_COUNT.get() > 0) {
     136            new Notification(tr("Cannot split since another split operation is already in progress"))
     137                    .setIcon(JOptionPane.WARNING_MESSAGE).show();
     138            return;
     139        }
     140
    134141        Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();
    135142
     
    216223     */
    217224    static class SegmentToKeepSelectionDialog extends ExtendedDialog {
     225        static final AtomicInteger DISPLAY_COUNT = new AtomicInteger();
    218226        final Way selectedWay;
    219227        final List<Way> newWays;
     
    238246            pane.add(list, GBC.eop().fill(GBC.HORIZONTAL));
    239247            setContent(pane);
     248            setDefaultCloseOperation(HIDE_ON_CLOSE);
    240249        }
    241250
     
    283292            super.setVisible(visible);
    284293            if (visible) {
     294                DISPLAY_COUNT.incrementAndGet();
    285295                list.setSelectedValue(wayToKeep, true);
    286296            } else {
    287297                setHighlightedWaySegments(Collections.<WaySegment>emptyList());
     298                DISPLAY_COUNT.decrementAndGet();
    288299            }
    289300        }
Note: See TracChangeset for help on using the changeset viewer.