Ignore:
Timestamp:
2017-11-28T00:56:29+01:00 (6 years ago)
Author:
Don-vip
Message:

see #15310 - remove most of deprecated APIs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/Command.java

    r13158 r13173  
    2020import org.openstreetmap.josm.data.osm.Way;
    2121import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor;
    22 import org.openstreetmap.josm.gui.MainApplication;
    23 import org.openstreetmap.josm.gui.layer.Layer;
    24 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2522import org.openstreetmap.josm.tools.CheckParameterUtil;
    2623
     
    129126    private Map<OsmPrimitive, PrimitiveData> cloneMap = new HashMap<>();
    130127
    131     /**
    132      * the layer which this command is applied to
    133      * @deprecated to be removed end of 2017. Use {@link #data} instead
    134      */
    135     @Deprecated
    136     private final OsmDataLayer layer;
    137 
    138128    /** the dataset which this command is applied to */
    139129    private final DataSet data;
    140 
    141     /**
    142      * Creates a new command in the context of the current edit layer, if any
    143      * @deprecated to be removed end of 2017. Use {@link #Command(DataSet)} instead
    144      */
    145     @Deprecated
    146     public Command() {
    147         this.layer = MainApplication.getLayerManager().getEditLayer();
    148         this.data = layer != null ? layer.data : Main.main.getEditDataSet();
    149     }
    150 
    151     /**
    152      * Creates a new command in the context of a specific data layer
    153      *
    154      * @param layer the data layer. Must not be null.
    155      * @throws IllegalArgumentException if layer is null
    156      * @deprecated to be removed end of 2017. Use {@link #Command(DataSet)} instead
    157      */
    158     @Deprecated
    159     public Command(OsmDataLayer layer) {
    160         CheckParameterUtil.ensureParameterNotNull(layer, "layer");
    161         this.layer = layer;
    162         this.data = layer.data;
    163     }
    164130
    165131    /**
     
    172138    public Command(DataSet data) {
    173139        CheckParameterUtil.ensureParameterNotNull(data, "data");
    174         this.layer = null;
    175140        this.data = data;
    176141    }
     
    182147     * The layer should be invalidated after execution so that it can be re-painted.
    183148     * @return true
    184      * @see #invalidateAffectedLayers()
    185149     */
    186150    public boolean executeCommand() {
     
    212176
    213177    /**
    214      * Called when a layer has been removed to have the command remove itself from
    215      * any buffer if it is not longer applicable to the dataset (e.g. it was part of
    216      * the removed layer)
    217      *
    218      * @param oldLayer the old layer that was removed
    219      * @return true if this command is invalid after that layer is removed.
    220      * @deprecated to be removed end of 2017.
    221      */
    222     @Deprecated
    223     public boolean invalidBecauselayerRemoved(Layer oldLayer) {
    224         return layer == oldLayer;
    225     }
    226 
    227     /**
    228178     * Lets other commands access the original version
    229179     * of the object. Usually for undoing.
     
    233183    public PrimitiveData getOrig(OsmPrimitive osm) {
    234184        return cloneMap.get(osm);
    235     }
    236 
    237     /**
    238      * Replies the layer this command is (or was) applied to.
    239      * @return the layer this command is (or was) applied to
    240      * @deprecated to be removed end of 2017. Use {@link #getAffectedDataSet} instead
    241      */
    242     @Deprecated
    243     protected OsmDataLayer getLayer() {
    244         return layer;
    245185    }
    246186
     
    313253    @Override
    314254    public int hashCode() {
    315         return Objects.hash(cloneMap, layer, data);
     255        return Objects.hash(cloneMap, data);
    316256    }
    317257
     
    322262        Command command = (Command) obj;
    323263        return Objects.equals(cloneMap, command.cloneMap) &&
    324                Objects.equals(layer, command.layer) &&
    325264               Objects.equals(data, command.data);
    326265    }
    327 
    328     /**
    329      * Invalidate all layers that were affected by this command.
    330      * @see Layer#invalidate()
    331      * @deprecated to be removed end of 2017.
    332      */
    333     @Deprecated
    334     public void invalidateAffectedLayers() {
    335         OsmDataLayer layer = getLayer();
    336         if (layer != null) {
    337             layer.invalidate();
    338         }
    339     }
    340266}
Note: See TracChangeset for help on using the changeset viewer.