Changeset 2880 in josm for trunk/src/org


Ignore:
Timestamp:
2010-01-23T10:22:15+01:00 (15 years ago)
Author:
jttt
Message:

Fixed #4411 Can't upload due to conflicts, but conflict list is empty

File:
1 edited

Legend:

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

    r2869 r2880  
    4646import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    4747import org.openstreetmap.josm.gui.SideButton;
    48 import org.openstreetmap.josm.gui.layer.Layer;
    4948import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    5049import org.openstreetmap.josm.tools.ImageProvider;
     
    5655 *
    5756 */
    58 public final class ConflictDialog extends ToggleDialog implements MapView.LayerChangeListener, IConflictListener, SelectionChangedListener{
     57public final class ConflictDialog extends ToggleDialog implements MapView.EditLayerChangeListener, IConflictListener, SelectionChangedListener{
    5958
    6059    static public Color getColor() {
     
    7271    private ResolveAction actResolve;
    7372    private SelectAction actSelect;
    74 
    75     private OsmDataLayer layer = null;
    7673
    7774    /**
     
    125122    public void showNotify() {
    126123        DataSet.selListeners.add(this);
    127         MapView.addLayerChangeListener(this);
     124        MapView.addEditLayerChangeListener(this);
     125        refreshView();
    128126    }
    129127
    130128    @Override
    131129    public void hideNotify() {
    132         MapView.removeLayerChangeListener(this);
     130        MapView.removeEditLayerChangeListener(this);
    133131        DataSet.selListeners.remove(this);
    134132    }
     
    164162     */
    165163    public final void refreshView() {
     164        OsmDataLayer editLayer =  Main.main.getEditLayer();
     165        conflicts = editLayer == null?new ConflictCollection():editLayer.getConflicts();
    166166        model.fireContentChanged();
    167167    }
     
    210210    }
    211211
     212    public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
     213        if (oldLayer != null) {
     214            oldLayer.getConflicts().removeConflictListener(this);
     215        }
     216        if (newLayer != null) {
     217            newLayer.getConflicts().addConflictListener(this);
     218        }
     219        refreshView();
     220    }
     221
     222
    212223    /**
    213224     * replies the conflict collection currently held by this dialog; may be null
     
    217228    public ConflictCollection getConflicts() {
    218229        return conflicts;
    219     }
    220 
    221     /**
    222      * invoked if the active {@see Layer} changes
    223      */
    224     public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    225         if (oldLayer instanceof OsmDataLayer) {
    226             this.layer = (OsmDataLayer)oldLayer;
    227             this.layer.getConflicts().removeConflictListener(this);
    228         }
    229         this.layer = null;
    230         if (newLayer instanceof OsmDataLayer) {
    231             this.layer = (OsmDataLayer)newLayer;
    232             layer.getConflicts().addConflictListener(this);
    233             this.conflicts = layer.getConflicts();
    234         }
    235         refreshView();
    236     }
    237 
    238     public void layerAdded(Layer newLayer) {
    239         // ignore
    240     }
    241 
    242     public void layerRemoved(Layer oldLayer) {
    243         if (this.layer == oldLayer) {
    244             this.layer = null;
    245             refreshView();
    246         }
    247230    }
    248231
     
    376359        }
    377360    }
     361
    378362}
Note: See TracChangeset for help on using the changeset viewer.