Ignore:
Timestamp:
2014-01-18T14:42:11+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #8992 - Allow to open several relation editors at once

File:
1 edited

Legend:

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

    r6336 r6725  
    88import java.util.HashSet;
    99import java.util.Set;
     10
     11import javax.swing.JOptionPane;
    1012
    1113import org.openstreetmap.josm.Main;
     
    6567    @Override
    6668    public void actionPerformed(ActionEvent e) {
    67         if (!isEnabled() || relations.size()!=1) return;
    68         launchEditor(relations.iterator().next());
     69        if (!isEnabled() || relations.isEmpty()) return;
     70        if (relations.size() > Main.pref.getInteger("warn.open.maxrelations", 5)) {
     71            if (JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main.parent,
     72                    "<html>"+tr("You are about to open <b>{0}</b> different relation editors simultaneously.<br/>Do you want to continue ?",
     73                            relations.size())+"</html>",
     74                    tr("Confirmation"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE)) {
     75                return;
     76            }
     77        }
     78        for (Relation r : relations) {
     79            launchEditor(r);
     80        }
    6981    }
    7082
    7183    @Override
    7284    protected void updateEnabledState() {
    73         // only one selected relation can be edited
    74         setEnabled( relations.size()==1 );
     85        setEnabled( !relations.isEmpty() );
    7586    }
    7687}
Note: See TracChangeset for help on using the changeset viewer.