Changeset 3045 in josm for trunk


Ignore:
Timestamp:
2010-02-26T15:42:31+01:00 (10 years ago)
Author:
mjulius
Message:

fixes #4611 - relation dialog - unreported conflict

remove deleted members from new relations

File:
1 edited

Legend:

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

    r3035 r3045  
    108108        super(layer, relation, selectedMembers);
    109109
    110         setRememberWindowGeometry(getClass().getName() + ".geometry", 
     110        setRememberWindowGeometry(getClass().getName() + ".geometry",
    111111                WindowGeometry.centerInWindow(Main.parent, new Dimension(700, 650)));
    112        
     112
    113113        // initialize the autocompletion infrastructure
    114114        //
     
    10211021         */
    10221022        protected void applyNewRelation() {
    1023             // If the user wanted to create a new relation, but hasn't added any members or
    1024             // tags, don't add an empty relation
    1025             if (memberTableModel.getRowCount() == 0 && tagEditorPanel.getModel().getKeys().isEmpty())
    1026                 return;
    10271023            Relation newRelation = new Relation();
    10281024            tagEditorPanel.getModel().applyToPrimitive(newRelation);
    10291025            memberTableModel.applyToRelation(newRelation);
     1026            List<RelationMember> newMembers = new ArrayList<RelationMember>();
     1027            for (RelationMember rm: newRelation.getMembers()) {
     1028                if (!rm.getMember().isDeleted()) {
     1029                    newMembers.add(rm);
     1030                }
     1031            }
     1032            if (newRelation.getMembersCount() != newMembers.size()) {
     1033                newRelation.setMembers(newMembers);
     1034                String msg = tr("One or more members of this new relation have been deleted while the relation editor\n" +
     1035                "was open. They have been removed from the relation members list.");
     1036                JOptionPane.showMessageDialog(Main.parent, msg, tr("Warning"), JOptionPane.WARNING_MESSAGE);
     1037            }
     1038            // If the user wanted to create a new relation, but hasn't added any members or
     1039            // tags, don't add an empty relation
     1040            if (newRelation.getMembersCount() == 0 && !newRelation.hasKeys())
     1041                return;
    10301042            Main.main.undoRedo.add(new AddCommand(getLayer(),newRelation));
    10311043
Note: See TracChangeset for help on using the changeset viewer.