Ignore:
Timestamp:
2016-07-01T09:50:06+02:00 (8 years ago)
Author:
donvip
Message:

remove calls to deprecated methods

Location:
applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/XmlBoundsLayer.java

    r30735 r32489  
    1414import org.openstreetmap.josm.actions.JosmAction;
    1515import org.openstreetmap.josm.data.osm.DataSet;
    16 import org.openstreetmap.josm.gui.MapView;
    17 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    1816import org.openstreetmap.josm.gui.layer.Layer;
     17import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
     18import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
     19import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
     20import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
     21import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     22import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    1923import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2024import org.openstreetmap.josm.plugins.imageryxmlbounds.actions.BoundsLayerSaveAction;
     
    2933 * @author Don-vip
    3034 */
    31 public class XmlBoundsLayer extends OsmDataLayer implements LayerChangeListener, XmlBoundsConstants {
     35public class XmlBoundsLayer extends OsmDataLayer implements LayerChangeListener, ActiveLayerChangeListener, XmlBoundsConstants {
    3236
    3337    @Override
     
    8084    public XmlBoundsLayer(DataSet data, String name, File associatedFile) {
    8185        super(data, name, associatedFile);
    82         MapView.addLayerChangeListener(this);
     86        Main.getLayerManager().addLayerChangeListener(this);
     87        Main.getLayerManager().addActiveLayerChangeListener(this);
    8388    }
    8489
     
    99104
    100105    @Override
    101     public void activeLayerChange(Layer oldLayer, Layer newLayer) {
     106    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
     107        Layer newLayer = Main.getLayerManager().getActiveLayer();
     108        Layer oldLayer = e.getPreviousActiveLayer();
    102109        if (newLayer == this && !(oldLayer instanceof XmlBoundsLayer)) {
    103110            for (JosmAction action : ACTIONS_TO_DISABLE) {
     
    113120
    114121    @Override
    115     public void layerAdded(Layer newLayer) {
     122    public void layerOrderChanged(LayerOrderChangeEvent e) {
    116123        // Do nothing
    117124    }
    118125
    119126    @Override
    120     public void layerRemoved(Layer oldLayer) {
    121         if (Main.main.getEditLayer() instanceof XmlBoundsLayer) {
     127    public void layerAdded(LayerAddEvent e) {
     128        // Do nothing
     129    }
     130
     131    @Override
     132    public void layerRemoving(LayerRemoveEvent e) {
     133        if (Main.getLayerManager().getEditLayer() instanceof XmlBoundsLayer) {
    122134            for (JosmAction action : ACTIONS_TO_DISABLE) {
    123135                action.setEnabled(false);
  • applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/actions/EditEntriesAction.java

    r30735 r32489  
    6060            @Override
    6161            public void run() {
    62                 Main.main.addLayer(layer);
     62                Main.getLayerManager().addLayer(layer);
    6363                layer.onPostLoadFromFile();
    6464            }
  • applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/io/XmlBoundsImporter.java

    r30735 r32489  
    7474                                tr("Open Imagery XML file"), JOptionPane.INFORMATION_MESSAGE);
    7575                    }
    76                     Main.main.addLayer(layer);
     76                    Main.getLayerManager().addLayer(layer);
    7777                    layer.onPostLoadFromFile();
    7878                }
Note: See TracChangeset for help on using the changeset viewer.