Changeset 33248 in osm


Ignore:
Timestamp:
2017-04-17T01:11:12+02:00 (8 years ago)
Author:
donvip
Message:

fix #josm14297 - IAE: ChannelDiGraphLayer is not managed by us

Location:
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/ChannelDiGraphLayer.java

    r32596 r33248  
    1212import java.awt.geom.AffineTransform;
    1313import java.awt.geom.Line2D;
    14 import java.beans.PropertyChangeEvent;
    15 import java.beans.PropertyChangeListener;
    1614
    1715import javax.swing.Action;
     
    2422import org.openstreetmap.josm.gui.MapView;
    2523import org.openstreetmap.josm.gui.layer.Layer;
    26 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
    27 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
    28 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
    29 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
    3024import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    3125import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
     
    3832 *
    3933 */
    40 public class ChannelDiGraphLayer extends Layer implements LayerChangeListener, PropertyChangeListener {
     34public class ChannelDiGraphLayer extends Layer {
    4135
    4236    private ChannelDiGraph digraph;
     
    6559    public ChannelDiGraphLayer(ColorSchemeXMLReader cXMLReader) {
    6660        super("ChannelDiGraphLayer");
    67         Main.getLayerManager().addLayerChangeListener(this);
    6861        this.cXMLReader = cXMLReader;
    6962        initColors();
     
    187180    }
    188181
    189     @Override
    190     public void layerOrderChanged(LayerOrderChangeEvent e) {
    191     }
    192 
    193     @Override
    194     public void layerAdded(LayerAddEvent e) {
    195     }
    196 
    197     @Override
    198     public void layerRemoving(LayerRemoveEvent e) {
    199         if (e.getRemovedLayer() == this) {
    200             Main.getLayerManager().removeLayerChangeListener(this);
    201         }
    202     }
    203 
    204182    public ChannelDiGraph getDigraph() {
    205183        return digraph;
     
    209187        this.digraph = digraph;
    210188    }
    211 
    212     @Override
    213     public void propertyChange(PropertyChangeEvent evt) {
    214     }
    215189}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java

    r33163 r33248  
    5656    protected void finish() {
    5757        if (canceled) {
    58             Main.getLayerManager().removeLayer(plugin.getChannelDigraphLayer());
    59             return;
     58            removeDigraphLayer();
     59        }
     60    }
     61
     62    private void removeDigraphLayer() {
     63        ChannelDiGraphLayer layer = plugin.getChannelDigraphLayer();
     64        if (Main.getLayerManager().containsLayer(layer)) {
     65            Main.getLayerManager().removeLayer(layer);
    6066        }
    6167    }
     
    7076            return;
    7177        }
    72         Main.getLayerManager().removeLayer(plugin.getChannelDigraphLayer());
     78        removeDigraphLayer();
    7379        int tickscounter = 4;
    7480        if (sealGraph) {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java

    r32596 r33248  
    5555            showjunction();
    5656            JOptionPane.showMessageDialog(Main.parent,
    57                     tr("The marked channels contains a junctioncandidate (white). To test this candidat mark these channel and press the \"Check\" button again."));
     57                tr("The marked channels contains a junctioncandidate (white). To test this candidat mark these channel and press the \"Check\" button again."));
    5858        } else if (jc.getCheck()) {
    5959            showjunction();
Note: See TracChangeset for help on using the changeset viewer.