Ignore:
Timestamp:
2016-06-30T00:16:11+02:00 (8 years ago)
Author:
donvip
Message:

remove calls to deprecated methods

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

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RelationEditMode.java

    r27852 r32456  
    6262    @Override
    6363    public void mouseClicked(MouseEvent e) {
    64         if (Main.main.getCurrentDataSet() == null)
     64        if (getLayerManager().getEditDataSet() == null)
    6565            return;
    6666
    6767        Way way = Main.map.mapView.getNearestWay(e.getPoint(), OsmPrimitive.isUsablePredicate);
    68         Collection<Relation> selectedRelations = Main.main.getCurrentDataSet().getSelectedRelations();
     68        Collection<Relation> selectedRelations = getLayerManager().getEditDataSet().getSelectedRelations();
    6969
    7070        if (way != null) {
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java

    r30737 r32456  
    104104    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
    105105
    106         DataSet dataset = Main.main.getCurrentDataSet();
     106        DataSet dataset = Main.getLayerManager().getEditDataSet();
    107107
    108108        if (dataset == null) {
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RoutesPlugin.java

    r32329 r32456  
    1515
    1616import org.openstreetmap.josm.Main;
    17 import org.openstreetmap.josm.gui.MapView;
    18 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    1917import org.openstreetmap.josm.gui.layer.Layer;
     18import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
     19import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
     20import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
     21import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
    2022import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2123import org.openstreetmap.josm.plugins.Plugin;
     
    3133    public RoutesPlugin(PluginInformation info) {
    3234        super(info);
    33         MapView.addLayerChangeListener(this);
     35        Main.getLayerManager().addLayerChangeListener(this);
    3436
    3537        File routesFile = new File(getPluginDir() + File.separator + "routes.xml");
     
    4042                routesFile.getParentFile().mkdir();
    4143                try (
    42                     OutputStream outputStream = new FileOutputStream(routesFile);
    43                     InputStream inputStream = Routes.class.getResourceAsStream("routes.xml");
    44                 ) {
     44                        OutputStream outputStream = new FileOutputStream(routesFile);
     45                        InputStream inputStream = Routes.class.getResourceAsStream("routes.xml");
     46                        ) {
    4547                    byte[] b = new byte[512];
    4648                    int read;
     
    8486                        isShown = true;
    8587                        SwingUtilities.invokeLater(new Runnable() {
     88                            @Override
    8689                            public void run() {
    8790                                for (RouteLayer routeLayer:routeLayers) {
    88                                     Main.main.addLayer(routeLayer);
     91                                    Main.getLayerManager().addLayer(routeLayer);
    8992                                }
    9093                            }
     
    97100                isShown = false;
    98101                SwingUtilities.invokeLater(new Runnable() {
     102                    @Override
    99103                    public void run() {
    100104                        for (RouteLayer routeLayer:routeLayers) {
    101                             Main.main.removeLayer(routeLayer);
     105                            Main.getLayerManager().removeLayer(routeLayer);
    102106                        }
    103107                    }
     
    107111    }
    108112
    109     public void layerAdded(Layer newLayer) {
     113    @Override
     114    public void layerAdded(LayerAddEvent e) {
    110115        checkLayers();
    111116    }
    112117
    113     public void layerRemoved(Layer oldLayer) {
     118    @Override
     119    public void layerRemoving(LayerRemoveEvent e) {
    114120        checkLayers();
    115121    }
     122
     123    @Override
     124    public void layerOrderChanged(LayerOrderChangeEvent e) {
     125        // Do nothing
     126    }
    116127}
Note: See TracChangeset for help on using the changeset viewer.