Changeset 13173 in josm for trunk/src/org/openstreetmap/josm/command/Command.java
- Timestamp:
- 2017-11-28T00:56:29+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/Command.java
r13158 r13173 20 20 import org.openstreetmap.josm.data.osm.Way; 21 21 import 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;25 22 import org.openstreetmap.josm.tools.CheckParameterUtil; 26 23 … … 129 126 private Map<OsmPrimitive, PrimitiveData> cloneMap = new HashMap<>(); 130 127 131 /**132 * the layer which this command is applied to133 * @deprecated to be removed end of 2017. Use {@link #data} instead134 */135 @Deprecated136 private final OsmDataLayer layer;137 138 128 /** the dataset which this command is applied to */ 139 129 private final DataSet data; 140 141 /**142 * Creates a new command in the context of the current edit layer, if any143 * @deprecated to be removed end of 2017. Use {@link #Command(DataSet)} instead144 */145 @Deprecated146 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 layer153 *154 * @param layer the data layer. Must not be null.155 * @throws IllegalArgumentException if layer is null156 * @deprecated to be removed end of 2017. Use {@link #Command(DataSet)} instead157 */158 @Deprecated159 public Command(OsmDataLayer layer) {160 CheckParameterUtil.ensureParameterNotNull(layer, "layer");161 this.layer = layer;162 this.data = layer.data;163 }164 130 165 131 /** … … 172 138 public Command(DataSet data) { 173 139 CheckParameterUtil.ensureParameterNotNull(data, "data"); 174 this.layer = null;175 140 this.data = data; 176 141 } … … 182 147 * The layer should be invalidated after execution so that it can be re-painted. 183 148 * @return true 184 * @see #invalidateAffectedLayers()185 149 */ 186 150 public boolean executeCommand() { … … 212 176 213 177 /** 214 * Called when a layer has been removed to have the command remove itself from215 * any buffer if it is not longer applicable to the dataset (e.g. it was part of216 * the removed layer)217 *218 * @param oldLayer the old layer that was removed219 * @return true if this command is invalid after that layer is removed.220 * @deprecated to be removed end of 2017.221 */222 @Deprecated223 public boolean invalidBecauselayerRemoved(Layer oldLayer) {224 return layer == oldLayer;225 }226 227 /**228 178 * Lets other commands access the original version 229 179 * of the object. Usually for undoing. … … 233 183 public PrimitiveData getOrig(OsmPrimitive osm) { 234 184 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 to240 * @deprecated to be removed end of 2017. Use {@link #getAffectedDataSet} instead241 */242 @Deprecated243 protected OsmDataLayer getLayer() {244 return layer;245 185 } 246 186 … … 313 253 @Override 314 254 public int hashCode() { 315 return Objects.hash(cloneMap, layer,data);255 return Objects.hash(cloneMap, data); 316 256 } 317 257 … … 322 262 Command command = (Command) obj; 323 263 return Objects.equals(cloneMap, command.cloneMap) && 324 Objects.equals(layer, command.layer) &&325 264 Objects.equals(data, command.data); 326 265 } 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 @Deprecated334 public void invalidateAffectedLayers() {335 OsmDataLayer layer = getLayer();336 if (layer != null) {337 layer.invalidate();338 }339 }340 266 }
Note:
See TracChangeset
for help on using the changeset viewer.