Changeset 32458 in osm for applications/editors/josm


Ignore:
Timestamp:
2016-06-30T00:23:36+02:00 (9 years ago)
Author:
donvip
Message:

remove calls to deprecated methods

Location:
applications/editors/josm/plugins/turnlanes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/turnlanes/build.xml

    r31926 r32458  
    55    <property name="commit.message" value="fix toolbar warnings - toolbar still does not work"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="7001"/>
     7    <property name="plugin.main.version" value="10279"/>
    88
    99    <!--
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/TurnLanesDialog.java

    r30737 r32458  
    1717import javax.swing.JToggleButton;
    1818
     19import org.openstreetmap.josm.Main;
    1920import org.openstreetmap.josm.actions.JosmAction;
    2021import org.openstreetmap.josm.data.SelectionChangedListener;
     
    3233import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
    3334import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
    34 import org.openstreetmap.josm.gui.MapView;
    35 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;
    3635import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
     36import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     37import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    3738import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3839import org.openstreetmap.josm.plugins.turnlanes.model.ModelContainer;
    3940
    40 public class TurnLanesDialog extends ToggleDialog implements EditLayerChangeListener, SelectionChangedListener {
     41public class TurnLanesDialog extends ToggleDialog implements ActiveLayerChangeListener, SelectionChangedListener {
    4142    private class EditAction extends JosmAction {
    4243        private static final long serialVersionUID = 4114119073563457706L;
     
    4546            super(tr("Edit"), "dialogs/edit", tr("Edit turn relations and lane lengths for selected node."), null,
    4647                    false);
    47             //putValue("toolbar", "turnlanes/edit");            Main.toolbar.register(this);
    48             // did not work in 5018
    49 
    5048        }
    5149       
     
    6664            super(tr("Validate"), "dialogs/validator", tr("Validate turn- and lane-length-relations for consistency."),
    6765                    null, false);
    68             // putValue("toolbar", "turnlanes/validate");            Main.toolbar.register(this);
    69             // did not work in 5018
    7066        }
    7167       
     
    150146        super(tr("Turn Lanes"), "turnlanes.png", tr("Edit turn lanes"), null, 200);
    151147       
    152         MapView.addEditLayerChangeListener(this);
     148        Main.getLayerManager().addActiveLayerChangeListener(this);
    153149        DataSet.addSelectionListener(this);
    154150       
     
    192188    }
    193189
    194         @Override
    195         public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
     190    @Override
     191    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
     192        OsmDataLayer oldLayer = e.getPreviousEditLayer();
    196193        if (oldLayer != null) {
    197194            oldLayer.data.removeDataSetListener(dataSetListener);
    198195        }
    199        
     196        OsmDataLayer newLayer = Main.getLayerManager().getEditLayer();
    200197        if (newLayer != null) {
    201198            newLayer.data.addDataSetListener(dataSetListener);
    202199        }
    203         }
    204 
    205         @Override
    206         public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     200    }
     201
     202    @Override
     203    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    207204        if (selected.equals(new HashSet<>(newSelection))) {
    208205            return;
     
    210207        selected.clear();
    211208        selected.addAll(newSelection);
    212        
     209
    213210        refresh();
    214         }
    215 
    216         @Override
    217         public void destroy() {
    218                 super.destroy();
    219         MapView.removeEditLayerChangeListener(this);
     211    }
     212
     213    @Override
     214    public void destroy() {
     215        super.destroy();
     216        Main.getLayerManager().removeActiveLayerChangeListener(this);
    220217        DataSet.removeSelectionListener(this);
    221218        editAction.destroy();
    222219        validateAction.destroy();
    223         }
     220    }
    224221}
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/ValidationPanel.java

    r30737 r32458  
    3737        @Override
    3838        public void actionPerformed(ActionEvent e) {
    39             setIssues(new Validator().validate(Main.main.getCurrentDataSet()));
     39            setIssues(new Validator().validate(Main.getLayerManager().getEditDataSet()));
    4040        }
    4141    };
     
    6262        public void actionPerformed(ActionEvent e) {
    6363            if (selected.getRelation() == null) {
    64                 Main.main.getCurrentDataSet().setSelected(selected.getPrimitives());
     64                Main.getLayerManager().getEditDataSet().setSelected(selected.getPrimitives());
    6565            } else {
    66                 Main.main.getCurrentDataSet().setSelected(selected.getRelation());
     66                Main.getLayerManager().getEditDataSet().setSelected(selected.getRelation());
    6767            }
    6868        }
Note: See TracChangeset for help on using the changeset viewer.