Changeset 7918 in josm


Ignore:
Timestamp:
2014-12-31T19:07:38+01:00 (10 years ago)
Author:
Don-vip
Message:

see #10903 - forbids to edit deleted relations

File:
1 edited

Legend:

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

    r7005 r7918  
    2121
    2222/**
    23  * The action for editing a relation 
     23 * The action for editing a relation.
    2424 * @since 5793
    2525 */
     
    3636
    3737    /**
    38      * Returns the set of currently selected relation members for the given relation. 
     38     * Returns the set of currently selected relation members for the given relation.
    3939     * @param r The relation to inspect
    4040     * @return The set of currently selected relation members for the given relation.
     
    6161     */
    6262    public static void launchEditor(Relation toEdit) {
    63         if (toEdit == null || !Main.isDisplayingMapView()) return;
     63        if (toEdit == null || toEdit.isDeleted() || !Main.isDisplayingMapView()) return;
    6464        RelationEditor.getEditor(Main.main.getEditLayer(), toEdit,
    6565                getMembersForCurrentSelection(toEdit)).setVisible(true);
     
    7171        if (relations.size() > Main.pref.getInteger("warn.open.maxrelations", 5) &&
    7272            /* I18N english text for value 1 makes no real sense, never called for values <= maxrel (usually 5) */
    73             JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main.parent, 
     73            JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main.parent,
    7474                    "<html>"+trn("You are about to open <b>{0}</b> different relation editor simultaneously.<br/>Do you want to continue?",
    7575                            "You are about to open <b>{0}</b> different relation editors simultaneously.<br/>Do you want to continue?",
    76                             relations.size(), relations.size())+"</html>", 
     76                            relations.size(), relations.size())+"</html>",
    7777                    tr("Confirmation"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE)) {
    7878            return;
     
    8585    @Override
    8686    protected void updateEnabledState() {
    87         setEnabled( !relations.isEmpty() );
     87        boolean enabled = false;
     88        for (Relation r : relations) {
     89            if (!r.isDeleted()) {
     90                enabled = true;
     91                break;
     92            }
     93        }
     94        setEnabled(enabled);
    8895    }
    8996}
Note: See TracChangeset for help on using the changeset viewer.