Changeset 13173 in josm for trunk/src/org
- Timestamp:
- 2017-11-28T00:56:29+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 deleted
- 61 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r13023 r13173 9 9 import java.lang.ref.WeakReference; 10 10 import java.net.URL; 11 import java.text.MessageFormat;12 11 import java.util.ArrayList; 13 12 import java.util.Collection; … … 26 25 import java.util.concurrent.Future; 27 26 28 import javax.swing.Action;29 30 import org.openstreetmap.josm.actions.JosmAction;31 27 import org.openstreetmap.josm.data.Bounds; 32 28 import org.openstreetmap.josm.data.Preferences; … … 41 37 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 42 38 import org.openstreetmap.josm.gui.MainApplication; 43 import org.openstreetmap.josm.gui.MainMenu;44 import org.openstreetmap.josm.gui.MainPanel;45 import org.openstreetmap.josm.gui.MapFrame;46 import org.openstreetmap.josm.gui.MapFrameListener;47 import org.openstreetmap.josm.gui.layer.MainLayerManager;48 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;49 39 import org.openstreetmap.josm.io.FileWatcher; 50 40 import org.openstreetmap.josm.io.OnlineResource; … … 59 49 import org.openstreetmap.josm.tools.PlatformHookOsx; 60 50 import org.openstreetmap.josm.tools.PlatformHookWindows; 61 import org.openstreetmap.josm.tools.Shortcut;62 51 import org.openstreetmap.josm.tools.Utils; 63 52 import org.openstreetmap.josm.tools.bugreport.BugReport; … … 82 71 83 72 /** 84 * Replies true if JOSM currently displays a map view. False, if it doesn't, i.e. if85 * it only shows the MOTD panel.86 * <p>87 * You do not need this when accessing the layer manager. The layer manager will be empty if no map view is shown.88 *89 * @return <code>true</code> if JOSM currently displays a map view90 * @deprecated use {@link org.openstreetmap.josm.gui.MainApplication#isDisplayingMapView()}91 */92 @Deprecated93 public static boolean isDisplayingMapView() {94 return MainApplication.isDisplayingMapView();95 }96 97 /**98 73 * Global parent component for all dialogs and message boxes 99 74 */ … … 119 94 120 95 /** 121 * The MapFrame.122 * <p>123 * There should be no need to access this to access any map data. Use {@link MainApplication#getLayerManager} instead.124 *125 * @deprecated Use {@link MainApplication#getMap()} instead126 * @see MainPanel127 */128 @Deprecated129 public static MapFrame map;130 131 /**132 * The toolbar preference control to register new actions.133 * @deprecated Use {@link MainApplication#getToolbar} instead134 */135 @Deprecated136 public static volatile ToolbarPreferences toolbar;137 138 /**139 96 * The commands undo/redo handler. 140 97 */ … … 142 99 143 100 /** 144 * The main menu bar at top of screen.145 * @deprecated Use {@link MainApplication#getMenu} instead146 */147 @Deprecated148 public MainMenu menu;149 150 /**151 * The main panel.152 * @deprecated Use {@link MainApplication#getMainPanel} instead153 * @since 12125154 */155 @Deprecated156 public MainPanel panel;157 158 /**159 101 * The file watcher service. 160 102 */ … … 164 106 165 107 private static final Set<OnlineResource> OFFLINE_RESOURCES = EnumSet.noneOf(OnlineResource.class); 166 167 /**168 * Logging level (5 = trace, 4 = debug, 3 = info, 2 = warn, 1 = error, 0 = none).169 * @since 6248170 * @deprecated Use {@link Logging} class.171 */172 @Deprecated173 public static int logLevel = 3;174 175 /**176 * Replies the first lines of last 5 error and warning messages, used for bug reports177 * @return the first lines of last 5 error and warning messages178 * @since 7420179 * @deprecated Use {@link Logging#getLastErrorAndWarnings}.180 */181 @Deprecated182 public static final Collection<String> getLastErrorAndWarnings() {183 return Logging.getLastErrorAndWarnings();184 }185 186 /**187 * Clears the list of last error and warning messages.188 * @since 8959189 * @deprecated Use {@link Logging#clearLastErrorAndWarnings}.190 */191 @Deprecated192 public static void clearLastErrorAndWarnings() {193 Logging.clearLastErrorAndWarnings();194 }195 196 /**197 * Prints an error message if logging is on.198 * @param msg The message to print.199 * @since 6248200 * @deprecated Use {@link Logging#error(String)}.201 */202 @Deprecated203 public static void error(String msg) {204 Logging.error(msg);205 }206 207 /**208 * Prints a warning message if logging is on.209 * @param msg The message to print.210 * @deprecated Use {@link Logging#warn(String)}.211 */212 @Deprecated213 public static void warn(String msg) {214 Logging.warn(msg);215 }216 217 /**218 * Prints an informational message if logging is on.219 * @param msg The message to print.220 * @deprecated Use {@link Logging#info(String)}.221 */222 @Deprecated223 public static void info(String msg) {224 Logging.info(msg);225 }226 227 /**228 * Prints a debug message if logging is on.229 * @param msg The message to print.230 * @deprecated Use {@link Logging#debug(String)}.231 */232 @Deprecated233 public static void debug(String msg) {234 Logging.debug(msg);235 }236 237 /**238 * Prints a trace message if logging is on.239 * @param msg The message to print.240 * @deprecated Use {@link Logging#trace(String)}.241 */242 @Deprecated243 public static void trace(String msg) {244 Logging.trace(msg);245 }246 247 /**248 * Determines if debug log level is enabled.249 * Useful to avoid costly construction of debug messages when not enabled.250 * @return {@code true} if log level is at least debug, {@code false} otherwise251 * @since 6852252 * @deprecated Use {@link Logging#isDebugEnabled}.253 */254 @Deprecated255 public static boolean isDebugEnabled() {256 return Logging.isDebugEnabled();257 }258 259 /**260 * Determines if trace log level is enabled.261 * Useful to avoid costly construction of trace messages when not enabled.262 * @return {@code true} if log level is at least trace, {@code false} otherwise263 * @since 6852264 * @deprecated Use {@link Logging#isTraceEnabled}.265 */266 @Deprecated267 public static boolean isTraceEnabled() {268 return Logging.isTraceEnabled();269 }270 271 /**272 * Prints a formatted error message if logging is on. Calls {@link MessageFormat#format}273 * function to format text.274 * @param msg The formatted message to print.275 * @param objects The objects to insert into format string.276 * @since 6248277 * @deprecated Use {@link Logging#error(String, Object...)}.278 */279 @Deprecated280 public static void error(String msg, Object... objects) {281 Logging.error(msg, objects);282 }283 284 /**285 * Prints a formatted warning message if logging is on. Calls {@link MessageFormat#format}286 * function to format text.287 * @param msg The formatted message to print.288 * @param objects The objects to insert into format string.289 * @deprecated Use {@link Logging#warn(String, Object...)}.290 */291 @Deprecated292 public static void warn(String msg, Object... objects) {293 Logging.warn(msg, objects);294 }295 296 /**297 * Prints a formatted informational message if logging is on. Calls {@link MessageFormat#format}298 * function to format text.299 * @param msg The formatted message to print.300 * @param objects The objects to insert into format string.301 * @deprecated Use {@link Logging#info(String, Object...)}.302 */303 @Deprecated304 public static void info(String msg, Object... objects) {305 Logging.info(msg, objects);306 }307 308 /**309 * Prints a formatted debug message if logging is on. Calls {@link MessageFormat#format}310 * function to format text.311 * @param msg The formatted message to print.312 * @param objects The objects to insert into format string.313 * @deprecated Use {@link Logging#debug(String, Object...)}.314 */315 @Deprecated316 public static void debug(String msg, Object... objects) {317 Logging.debug(msg, objects);318 }319 320 /**321 * Prints a formatted trace message if logging is on. Calls {@link MessageFormat#format}322 * function to format text.323 * @param msg The formatted message to print.324 * @param objects The objects to insert into format string.325 * @deprecated Use {@link Logging#trace(String, Object...)}.326 */327 @Deprecated328 public static void trace(String msg, Object... objects) {329 Logging.trace(msg, objects);330 }331 332 /**333 * Prints an error message for the given Throwable.334 * @param t The throwable object causing the error335 * @since 6248336 * @deprecated Use {@link Logging#error(Throwable)}.337 */338 @Deprecated339 public static void error(Throwable t) {340 Logging.error(t);341 }342 343 /**344 * Prints a warning message for the given Throwable.345 * @param t The throwable object causing the error346 * @since 6248347 * @deprecated Use {@link Logging#warn(Throwable)}.348 */349 @Deprecated350 public static void warn(Throwable t) {351 Logging.warn(t);352 }353 354 /**355 * Prints a debug message for the given Throwable. Useful for exceptions usually ignored356 * @param t The throwable object causing the error357 * @since 10420358 * @deprecated Use {@link Logging#debug(Throwable)}.359 */360 @Deprecated361 public static void debug(Throwable t) {362 Logging.debug(t);363 }364 365 /**366 * Prints a trace message for the given Throwable. Useful for exceptions usually ignored367 * @param t The throwable object causing the error368 * @since 10420369 * @deprecated Use {@link Logging#trace(Throwable)}.370 */371 @Deprecated372 public static void trace(Throwable t) {373 Logging.trace(t);374 }375 376 /**377 * Prints an error message for the given Throwable.378 * @param t The throwable object causing the error379 * @param stackTrace {@code true}, if the stacktrace should be displayed380 * @since 6642381 * @deprecated Use {@link Logging#log(java.util.logging.Level, Throwable)}382 * or {@link Logging#logWithStackTrace(java.util.logging.Level, Throwable)}.383 */384 @Deprecated385 public static void error(Throwable t, boolean stackTrace) {386 if (stackTrace) {387 Logging.log(Logging.LEVEL_ERROR, t);388 } else {389 Logging.logWithStackTrace(Logging.LEVEL_ERROR, t);390 }391 }392 393 /**394 * Prints an error message for the given Throwable.395 * @param t The throwable object causing the error396 * @param message additional error message397 * @since 10420398 * @deprecated Use {@link Logging#log(java.util.logging.Level, String, Throwable)}.399 */400 @Deprecated401 public static void error(Throwable t, String message) {402 Logging.log(Logging.LEVEL_ERROR, message, t);403 }404 405 /**406 * Prints a warning message for the given Throwable.407 * @param t The throwable object causing the error408 * @param stackTrace {@code true}, if the stacktrace should be displayed409 * @since 6642410 * @deprecated Use {@link Logging#log(java.util.logging.Level, Throwable)}411 * or {@link Logging#logWithStackTrace(java.util.logging.Level, Throwable)}.412 */413 @Deprecated414 public static void warn(Throwable t, boolean stackTrace) {415 if (stackTrace) {416 Logging.log(Logging.LEVEL_WARN, t);417 } else {418 Logging.logWithStackTrace(Logging.LEVEL_WARN, t);419 }420 }421 422 /**423 * Prints a warning message for the given Throwable.424 * @param t The throwable object causing the error425 * @param message additional error message426 * @since 10420427 * @deprecated Use {@link Logging#log(java.util.logging.Level, String, Throwable)}.428 */429 @Deprecated430 public static void warn(Throwable t, String message) {431 Logging.log(Logging.LEVEL_WARN, message, t);432 }433 434 /**435 * Returns a human-readable message of error, also usable for developers.436 * @param t The error437 * @return The human-readable error message438 * @since 6642439 * @deprecated Use {@link Logging#getErrorMessage}.440 */441 @Deprecated442 public static String getErrorMessage(Throwable t) {443 if (t == null) {444 return null;445 } else {446 return Logging.getErrorMessage(t);447 }448 }449 108 450 109 /** … … 611 270 612 271 /** 613 * Returns the main layer manager that is used by the map view.614 * @return The layer manager. The value returned will never change.615 * @since 10279616 * @deprecated use {@link MainApplication#getLayerManager} instead617 */618 @Deprecated619 public static MainLayerManager getLayerManager() {620 return MainApplication.getLayerManager();621 }622 623 /**624 272 * Replies the current selected primitives, from a end-user point of view. 625 273 * It is not always technically the same collection of primitives than {@link DataSet#getSelected()}. … … 652 300 */ 653 301 public abstract boolean containsDataSet(DataSet ds); 654 655 /**656 * Registers a {@code JosmAction} and its shortcut.657 * @param action action defining its own shortcut658 * @deprecated use {@link MainApplication#registerActionShortcut(JosmAction)} instead659 */660 @Deprecated661 public static void registerActionShortcut(JosmAction action) {662 MainApplication.registerActionShortcut(action);663 }664 665 /**666 * Registers an action and its shortcut.667 * @param action action to register668 * @param shortcut shortcut to associate to {@code action}669 * @deprecated use {@link MainApplication#registerActionShortcut(Action, Shortcut)} instead670 */671 @Deprecated672 public static void registerActionShortcut(Action action, Shortcut shortcut) {673 MainApplication.registerActionShortcut(action, shortcut);674 }675 676 /**677 * Unregisters a shortcut.678 * @param shortcut shortcut to unregister679 * @deprecated use {@link MainApplication#unregisterShortcut(Shortcut)} instead680 */681 @Deprecated682 public static void unregisterShortcut(Shortcut shortcut) {683 MainApplication.unregisterShortcut(shortcut);684 }685 686 /**687 * Unregisters a {@code JosmAction} and its shortcut.688 * @param action action to unregister689 * @deprecated use {@link MainApplication#unregisterActionShortcut(JosmAction)} instead690 */691 @Deprecated692 public static void unregisterActionShortcut(JosmAction action) {693 MainApplication.unregisterActionShortcut(action);694 }695 696 /**697 * Unregisters an action and its shortcut.698 * @param action action to unregister699 * @param shortcut shortcut to unregister700 * @deprecated use {@link MainApplication#unregisterActionShortcut(Action, Shortcut)} instead701 */702 @Deprecated703 public static void unregisterActionShortcut(Action action, Shortcut shortcut) {704 MainApplication.unregisterActionShortcut(action, shortcut);705 }706 707 /**708 * Replies the registered action for the given shortcut709 * @param shortcut The shortcut to look for710 * @return the registered action for the given shortcut711 * @deprecated use {@link MainApplication#getRegisteredActionShortcut(Shortcut)} instead712 * @since 5696713 */714 @Deprecated715 public static Action getRegisteredActionShortcut(Shortcut shortcut) {716 return MainApplication.getRegisteredActionShortcut(shortcut);717 }718 302 719 303 /////////////////////////////////////////////////////////////////////////// … … 910 494 911 495 /** 912 * Registers a new {@code MapFrameListener} that will be notified of MapFrame changes.913 * <p>914 * It will fire an initial mapFrameInitialized event when the MapFrame is present.915 * Otherwise will only fire when the MapFrame is created or destroyed.916 * @param listener The MapFrameListener917 * @return {@code true} if the listeners collection changed as a result of the call918 * @see #addMapFrameListener919 * @deprecated use {@link MainApplication#addAndFireMapFrameListener} instead920 * @since 11904921 */922 @Deprecated923 public static boolean addAndFireMapFrameListener(MapFrameListener listener) {924 return MainApplication.addAndFireMapFrameListener(listener);925 }926 927 /**928 * Registers a new {@code MapFrameListener} that will be notified of MapFrame changes929 * @param listener The MapFrameListener930 * @return {@code true} if the listeners collection changed as a result of the call931 * @see #addAndFireMapFrameListener932 * @deprecated use {@link MainApplication#addMapFrameListener} instead933 * @since 5957934 */935 @Deprecated936 public static boolean addMapFrameListener(MapFrameListener listener) {937 return MainApplication.addMapFrameListener(listener);938 }939 940 /**941 * Unregisters the given {@code MapFrameListener} from MapFrame changes942 * @param listener The MapFrameListener943 * @return {@code true} if the listeners collection changed as a result of the call944 * @deprecated use {@link MainApplication#removeMapFrameListener} instead945 * @since 5957946 */947 @Deprecated948 public static boolean removeMapFrameListener(MapFrameListener listener) {949 return MainApplication.removeMapFrameListener(listener);950 }951 952 /**953 496 * Adds a new network error that occur to give a hint about broken Internet connection. 954 497 * Do not use this method for errors known for sure thrown because of a bad proxy configuration. -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r13068 r13173 1010 1010 /** 1011 1011 * This is a method that splits way into smaller parts, using the prepared nodes list as split points. 1012 * Uses {@link SplitWay Action#splitWay} for the heavy lifting.1012 * Uses {@link SplitWayCommand#splitWay} for the heavy lifting. 1013 1013 * @param way way to split 1014 1014 * @param nodes split points -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r12974 r13173 285 285 * Merges the nodes in {@code nodes} at the specified node's location. 286 286 * 287 * @param layer unused288 * @param nodes the collection of nodes. Ignored if null.289 * @param targetLocationNode this node's location will be used for the targetNode.290 * @return The command necessary to run in order to perform action, or {@code null} if there is nothing to do291 * @throws IllegalArgumentException if {@code layer} is null292 * @deprecated use {@link #mergeNodes(Collection, Node)} instead293 */294 @Deprecated295 public static Command mergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetLocationNode) {296 return mergeNodes(nodes, targetLocationNode);297 }298 299 /**300 * Merges the nodes in {@code nodes} at the specified node's location.301 *302 287 * @param nodes the collection of nodes. Ignored if null. 303 288 * @param targetLocationNode this node's location will be used for the targetNode. -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r13158 r13173 25 25 26 26 import org.openstreetmap.josm.Main; 27 import org.openstreetmap.josm.command.Command;28 27 import org.openstreetmap.josm.command.SplitWayCommand; 29 28 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 38 37 import org.openstreetmap.josm.gui.MapFrame; 39 38 import org.openstreetmap.josm.gui.Notification; 40 import org.openstreetmap.josm.gui.layer.OsmDataLayer;41 39 import org.openstreetmap.josm.tools.GBC; 42 40 import org.openstreetmap.josm.tools.Shortcut; … … 49 47 */ 50 48 public class SplitWayAction extends JosmAction { 51 52 /**53 * Represents the result of a {@link SplitWayAction}54 * @see SplitWayAction#splitWay55 * @see SplitWayAction#split56 * @deprecated To be removed end of 2017. Use {@link SplitWayCommand} instead57 */58 @Deprecated59 public static class SplitWayResult {60 private final Command command;61 private final List<? extends PrimitiveId> newSelection;62 private final Way originalWay;63 private final List<Way> newWays;64 65 /**66 * Constructs a new {@code SplitWayResult}.67 * @param command The command to be performed to split the way (which is saved for later retrieval with {@link #getCommand})68 * @param newSelection The new list of selected primitives ids (which is saved for later retrieval with {@link #getNewSelection})69 * @param originalWay The original way being split (which is saved for later retrieval with {@link #getOriginalWay})70 * @param newWays The resulting new ways (which is saved for later retrieval with {@link #getOriginalWay})71 */72 public SplitWayResult(Command command, List<? extends PrimitiveId> newSelection, Way originalWay, List<Way> newWays) {73 this.command = command;74 this.newSelection = newSelection;75 this.originalWay = originalWay;76 this.newWays = newWays;77 }78 79 /**80 * @param command The command to be performed to split the way (which is saved for later retrieval with {@link #getCommand})81 * @since 1282882 */83 protected SplitWayResult(SplitWayCommand command) {84 this.command = command;85 this.newSelection = command.getNewSelection();86 this.originalWay = command.getOriginalWay();87 this.newWays = command.getNewWays();88 }89 90 /**91 * Replies the command to be performed to split the way92 * @return The command to be performed to split the way93 */94 public Command getCommand() {95 return command;96 }97 98 /**99 * Replies the new list of selected primitives ids100 * @return The new list of selected primitives ids101 */102 public List<? extends PrimitiveId> getNewSelection() {103 return newSelection;104 }105 106 /**107 * Replies the original way being split108 * @return The original way being split109 */110 public Way getOriginalWay() {111 return originalWay;112 }113 114 /**115 * Replies the resulting new ways116 * @return The resulting new ways117 */118 public List<Way> getNewWays() {119 return newWays;120 }121 }122 49 123 50 /** … … 206 133 sel.addAll(selectedRelations); 207 134 208 final List<Way> newWays = createNewWaysFromChunks(selectedWay, wayChunks);135 final List<Way> newWays = SplitWayCommand.createNewWaysFromChunks(selectedWay, wayChunks); 209 136 final Way wayToKeep = SplitWayCommand.Strategy.keepLongestChunk().determineWayToKeep(newWays); 210 137 … … 315 242 316 243 /** 317 * Determines which way chunk should reuse the old id and its history318 *319 * @since 8954320 * @since 10599 (functional interface)321 * @deprecated to be removed end of 2017. Use {@link org.openstreetmap.josm.command.SplitWayCommand.Strategy} instead322 */323 @Deprecated324 @FunctionalInterface325 public interface Strategy {326 327 /**328 * Determines which way chunk should reuse the old id and its history.329 *330 * @param wayChunks the way chunks331 * @return the way to keep332 */333 Way determineWayToKeep(Iterable<Way> wayChunks);334 335 /**336 * Returns a strategy which selects the way chunk with the highest node count to keep.337 * @return strategy which selects the way chunk with the highest node count to keep338 */339 static Strategy keepLongestChunk() {340 return SplitWayCommand.Strategy.keepLongestChunk()::determineWayToKeep;341 }342 343 /**344 * Returns a strategy which selects the first way chunk.345 * @return strategy which selects the first way chunk346 */347 static Strategy keepFirstChunk() {348 return SplitWayCommand.Strategy.keepFirstChunk()::determineWayToKeep;349 }350 }351 352 /**353 244 * Determine which ways to split. 354 245 * @param selectedWays List of user selected ways. … … 385 276 } 386 277 387 /**388 * Splits the nodes of {@code wayToSplit} into a list of node sequences389 * which are separated at the nodes in {@code splitPoints}.390 *391 * This method displays warning messages if {@code wayToSplit} and/or392 * {@code splitPoints} aren't consistent.393 *394 * Returns null, if building the split chunks fails.395 *396 * @param wayToSplit the way to split. Must not be null.397 * @param splitPoints the nodes where the way is split. Must not be null.398 * @return the list of chunks399 * @deprecated To be removed end of 2017. Use {@link SplitWayCommand#buildSplitChunks} instead400 */401 @Deprecated402 public static List<List<Node>> buildSplitChunks(Way wayToSplit, List<Node> splitPoints) {403 return SplitWayCommand.buildSplitChunks(wayToSplit, splitPoints);404 }405 406 /**407 * Creates new way objects for the way chunks and transfers the keys from the original way.408 * @param way the original way whose keys are transferred409 * @param wayChunks the way chunks410 * @return the new way objects411 * @deprecated To be removed end of 2017. Use {@link SplitWayCommand#createNewWaysFromChunks} instead412 */413 @Deprecated414 protected static List<Way> createNewWaysFromChunks(Way way, Iterable<List<Node>> wayChunks) {415 return SplitWayCommand.createNewWaysFromChunks(way, wayChunks);416 }417 418 /**419 * Splits the way {@code way} into chunks of {@code wayChunks} and replies420 * the result of this process in an instance of {@link SplitWayResult}.421 *422 * Note that changes are not applied to the data yet. You have to423 * submit the command in {@link SplitWayResult#getCommand()} first,424 * i.e. {@code Main.main.undoredo.add(result.getCommand())}.425 *426 * @param layer the layer which the way belongs to.427 * @param way the way to split. Must not be null.428 * @param wayChunks the list of way chunks into the way is split. Must not be null.429 * @param selection The list of currently selected primitives430 * @return the result from the split operation431 * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#splitWay} instead432 */433 @Deprecated434 public static SplitWayResult splitWay(OsmDataLayer layer, Way way, List<List<Node>> wayChunks,435 Collection<? extends OsmPrimitive> selection) {436 return splitWay(way, wayChunks, selection);437 }438 439 /**440 * Splits the way {@code way} into chunks of {@code wayChunks} and replies441 * the result of this process in an instance of {@link SplitWayResult}.442 *443 * Note that changes are not applied to the data yet. You have to444 * submit the command in {@link SplitWayResult#getCommand()} first,445 * i.e. {@code Main.main.undoredo.add(result.getCommand())}.446 *447 * @param way the way to split. Must not be null.448 * @param wayChunks the list of way chunks into the way is split. Must not be null.449 * @param selection The list of currently selected primitives450 * @return the result from the split operation451 * @since 12718452 * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#splitWay} instead453 */454 @Deprecated455 public static SplitWayResult splitWay(Way way, List<List<Node>> wayChunks,456 Collection<? extends OsmPrimitive> selection) {457 return splitWay(way, wayChunks, selection, Strategy.keepLongestChunk());458 }459 460 /**461 * Splits the way {@code way} into chunks of {@code wayChunks} and replies462 * the result of this process in an instance of {@link SplitWayResult}.463 * The {@link org.openstreetmap.josm.actions.SplitWayAction.Strategy} is used to determine which464 * way chunk should reuse the old id and its history.465 *466 * Note that changes are not applied to the data yet. You have to467 * submit the command in {@link SplitWayResult#getCommand()} first,468 * i.e. {@code Main.main.undoredo.add(result.getCommand())}.469 *470 * @param layer the layer which the way belongs to.471 * @param way the way to split. Must not be null.472 * @param wayChunks the list of way chunks into the way is split. Must not be null.473 * @param selection The list of currently selected primitives474 * @param splitStrategy The strategy used to determine which way chunk should reuse the old id and its history475 * @return the result from the split operation476 * @since 8954477 * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#splitWay} instead478 */479 @Deprecated480 public static SplitWayResult splitWay(OsmDataLayer layer, Way way, List<List<Node>> wayChunks,481 Collection<? extends OsmPrimitive> selection, Strategy splitStrategy) {482 return splitWay(way, wayChunks, selection, splitStrategy);483 }484 485 /**486 * Splits the way {@code way} into chunks of {@code wayChunks} and replies487 * the result of this process in an instance of {@link SplitWayResult}.488 * The {@link org.openstreetmap.josm.actions.SplitWayAction.Strategy} is used to determine which489 * way chunk should reuse the old id and its history.490 *491 * Note that changes are not applied to the data yet. You have to492 * submit the command in {@link SplitWayResult#getCommand()} first,493 * i.e. {@code Main.main.undoredo.add(result.getCommand())}.494 *495 * @param way the way to split. Must not be null.496 * @param wayChunks the list of way chunks into the way is split. Must not be null.497 * @param selection The list of currently selected primitives498 * @param splitStrategy The strategy used to determine which way chunk should reuse the old id and its history499 * @return the result from the split operation500 * @since 12718501 * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#splitWay} instead502 */503 @Deprecated504 public static SplitWayResult splitWay(Way way, List<List<Node>> wayChunks,505 Collection<? extends OsmPrimitive> selection, Strategy splitStrategy) {506 SplitWayCommand cmd = SplitWayCommand.splitWay(way, wayChunks, selection, splitStrategy::determineWayToKeep);507 return cmd != null ? new SplitWayResult(cmd) : null;508 }509 510 278 static void doSplitWay(Way way, Way wayToKeep, List<Way> newWays, List<OsmPrimitive> newSelection) { 511 279 final MapFrame map = MainApplication.getMap(); … … 519 287 } 520 288 521 /**522 * Splits the way {@code way} at the nodes in {@code atNodes} and replies523 * the result of this process in an instance of {@link SplitWayResult}.524 *525 * Note that changes are not applied to the data yet. You have to526 * submit the command in {@link SplitWayResult#getCommand()} first,527 * i.e. {@code Main.main.undoredo.add(result.getCommand())}.528 *529 * Replies null if the way couldn't be split at the given nodes.530 *531 * @param layer the layer which the way belongs to.532 * @param way the way to split. Must not be null.533 * @param atNodes the list of nodes where the way is split. Must not be null.534 * @param selection The list of currently selected primitives535 * @return the result from the split operation536 * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#split} instead537 */538 @Deprecated539 public static SplitWayResult split(OsmDataLayer layer, Way way, List<Node> atNodes, Collection<? extends OsmPrimitive> selection) {540 return split(way, atNodes, selection);541 }542 543 /**544 * Splits the way {@code way} at the nodes in {@code atNodes} and replies545 * the result of this process in an instance of {@link SplitWayResult}.546 *547 * Note that changes are not applied to the data yet. You have to548 * submit the command in {@link SplitWayResult#getCommand()} first,549 * i.e. {@code Main.main.undoredo.add(result.getCommand())}.550 *551 * Replies null if the way couldn't be split at the given nodes.552 *553 * @param way the way to split. Must not be null.554 * @param atNodes the list of nodes where the way is split. Must not be null.555 * @param selection The list of currently selected primitives556 * @return the result from the split operation557 * @since 12718558 * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#split} instead559 */560 @Deprecated561 public static SplitWayResult split(Way way, List<Node> atNodes, Collection<? extends OsmPrimitive> selection) {562 List<List<Node>> chunks = buildSplitChunks(way, atNodes);563 return chunks != null ? splitWay(way, chunks, selection) : null;564 }565 566 289 @Override 567 290 protected void updateEnabledState() { -
trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java
r12881 r13173 12 12 13 13 import org.openstreetmap.josm.actions.JosmAction; 14 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;15 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;16 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 15 import org.openstreetmap.josm.gui.MainApplication; … … 19 17 import org.openstreetmap.josm.gui.layer.Layer; 20 18 import org.openstreetmap.josm.spi.preferences.Config; 19 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent; 20 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; 21 21 import org.openstreetmap.josm.tools.ImageProvider; 22 22 import org.openstreetmap.josm.tools.Shortcut; … … 65 65 66 66 /** 67 * Constructor for mapmodes without a menu68 * @param name the action's text69 * @param iconName icon filename in {@code mapmode} directory70 * @param tooltip a longer description of the action that will be displayed in the tooltip.71 * @param shortcut a ready-created shortcut object or null if you don't want a shortcut.72 * @param mapFrame unused but kept for plugin compatibility. Can be {@code null}73 * @param cursor cursor displayed when map mode is active74 * @deprecated use {@link #MapMode(String, String, String, Shortcut, Cursor)} instead75 */76 @Deprecated77 public MapMode(String name, String iconName, String tooltip, Shortcut shortcut, MapFrame mapFrame, Cursor cursor) {78 this(name, iconName, tooltip, shortcut, cursor);79 }80 81 /**82 * Constructor for mapmodes with a menu (no shortcut will be registered)83 * @param name the action's text84 * @param iconName icon filename in {@code mapmode} directory85 * @param tooltip a longer description of the action that will be displayed in the tooltip.86 * @param mapFrame unused but kept for plugin compatibility. Can be {@code null}87 * @param cursor cursor displayed when map mode is active88 * @deprecated use {@link #MapMode(String, String, String, Cursor)} instead89 */90 @Deprecated91 public MapMode(String name, String iconName, String tooltip, MapFrame mapFrame, Cursor cursor) {92 this(name, iconName, tooltip, cursor);93 }94 95 /**96 67 * Makes this map mode active. 97 68 */ … … 179 150 180 151 /** 181 * Update internal ctrl, alt, shift mask from given modifiers mask.182 * @param modifiers event modifiers mask183 * @deprecated use {@link #updateKeyModifiersEx} instead184 */185 @Deprecated186 protected void updateKeyModifiers(int modifiers) {187 ctrl = (modifiers & ActionEvent.CTRL_MASK) != 0;188 alt = (modifiers & (ActionEvent.ALT_MASK | InputEvent.ALT_GRAPH_MASK)) != 0;189 shift = (modifiers & ActionEvent.SHIFT_MASK) != 0;190 }191 192 /**193 152 * Update internal ctrl, alt, shift mask from given extended modifiers mask. 194 153 * @param modifiers event extended modifiers mask -
trunk/src/org/openstreetmap/josm/command/AddCommand.java
r12726 r13173 16 16 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 17 17 import org.openstreetmap.josm.data.osm.Way; 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;19 18 import org.openstreetmap.josm.tools.ImageProvider; 20 19 … … 32 31 */ 33 32 private final OsmPrimitive osm; 34 35 /**36 * Creates the command and specify the element to add in the context of the current edit layer, if any.37 * @param osm The primitive to add38 * @deprecated to be removed end of 2017. Use {@link #AddCommand(DataSet, OsmPrimitive)} instead39 */40 @Deprecated41 public AddCommand(OsmPrimitive osm) {42 this.osm = Objects.requireNonNull(osm, "osm");43 }44 45 /**46 * Creates the command and specify the element to add in the context of the given data layer.47 * @param layer The data layer. Must not be {@code null}48 * @param osm The primitive to add49 * @deprecated to be removed end of 2017. Use {@link #AddCommand(DataSet, OsmPrimitive)} instead50 */51 @Deprecated52 public AddCommand(OsmDataLayer layer, OsmPrimitive osm) {53 super(layer);54 this.osm = Objects.requireNonNull(osm, "osm");55 }56 33 57 34 /** -
trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
r12726 r13173 19 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 20 import org.openstreetmap.josm.data.osm.PrimitiveData; 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer;22 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 23 22 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 35 34 // only filled on undo 36 35 private List<OsmPrimitive> createdPrimitives; 37 38 /**39 * Constructs a new {@code AddPrimitivesCommand} to add data to the current edit layer.40 * @param data The OSM primitives data to add. Must not be {@code null}41 * @deprecated to be removed end of 2017. Use {@link #AddPrimitivesCommand(List, DataSet)} instead42 */43 @Deprecated44 public AddPrimitivesCommand(List<PrimitiveData> data) {45 this(data, data);46 }47 48 /**49 * Constructs a new {@code AddPrimitivesCommand} to add data to the current edit layer.50 * @param data The OSM primitives to add. Must not be {@code null}51 * @param toSelect The OSM primitives to select at the end. Can be {@code null}52 * @since 595353 * @deprecated to be removed end of 2017. Use {@link #AddPrimitivesCommand(List, List, DataSet)} instead54 */55 @Deprecated56 public AddPrimitivesCommand(List<PrimitiveData> data, List<PrimitiveData> toSelect) {57 init(data, toSelect);58 }59 60 /**61 * Constructs a new {@code AddPrimitivesCommand} to add data to the given layer.62 * @param data The OSM primitives data to add. Must not be {@code null}63 * @param toSelect The OSM primitives to select at the end. Can be {@code null}64 * @param layer The target data layer. Must not be {@code null}65 * @deprecated to be removed end of 2017. Use {@link #AddPrimitivesCommand(List, List, DataSet)} instead66 */67 @Deprecated68 public AddPrimitivesCommand(List<PrimitiveData> data, List<PrimitiveData> toSelect, OsmDataLayer layer) {69 super(layer);70 init(data, toSelect);71 }72 36 73 37 /** -
trunk/src/org/openstreetmap/josm/command/ChangeCommand.java
r12726 r13173 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 16 16 import org.openstreetmap.josm.data.osm.Way; 17 import org.openstreetmap.josm.gui.layer.OsmDataLayer;18 17 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 18 import org.openstreetmap.josm.tools.ImageProvider; … … 36 35 public ChangeCommand(OsmPrimitive osm, OsmPrimitive newOsm) { 37 36 this(osm.getDataSet(), osm, newOsm); 38 }39 40 /**41 * Constructs a new {@code ChangeCommand} in the context of a given data layer.42 * @param layer The data layer43 * @param osm The existing primitive to modify44 * @param newOsm The new primitive45 * @deprecated to be removed end of 2017. Use {@link #ChangeCommand(DataSet, OsmPrimitive, OsmPrimitive)} instead46 */47 @Deprecated48 public ChangeCommand(OsmDataLayer layer, OsmPrimitive osm, OsmPrimitive newOsm) {49 super(layer);50 this.osm = osm;51 this.newOsm = newOsm;52 sanityChecks();53 37 } 54 38 -
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 } -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r12869 r13173 32 32 import org.openstreetmap.josm.data.osm.Way; 33 33 import org.openstreetmap.josm.data.osm.WaySegment; 34 import org.openstreetmap.josm.gui.layer.OsmDataLayer;35 34 import org.openstreetmap.josm.tools.CheckParameterUtil; 36 35 import org.openstreetmap.josm.tools.ImageProvider; … … 144 143 * Constructor for a single data item. Use the collection constructor to delete multiple objects. 145 144 * 146 * @param layer the layer context for deleting this primitive. Must not be null.147 * @param data the primitive to delete. Must not be null.148 * @throws IllegalArgumentException if data is null149 * @throws IllegalArgumentException if layer is null150 * @deprecated to be removed end of 2017. Use {@link #DeleteCommand(DataSet, OsmPrimitive)} instead151 */152 @Deprecated153 public DeleteCommand(OsmDataLayer layer, OsmPrimitive data) {154 this(layer, Collections.singleton(data));155 }156 157 /**158 * Constructor for a single data item. Use the collection constructor to delete multiple objects.159 *160 145 * @param dataset the data set context for deleting this primitive. Must not be null. 161 146 * @param data the primitive to delete. Must not be null. … … 166 151 public DeleteCommand(DataSet dataset, OsmPrimitive data) { 167 152 this(dataset, Collections.singleton(data)); 168 }169 170 /**171 * Constructor for a collection of data to be deleted in the context of a specific layer172 *173 * @param layer the layer context for deleting these primitives. Must not be null.174 * @param data the primitives to delete. Must neither be null nor empty.175 * @throws IllegalArgumentException if layer is null176 * @throws IllegalArgumentException if data is null or empty177 * @deprecated to be removed end of 2017. Use {@link #DeleteCommand(DataSet, Collection)} instead178 */179 @Deprecated180 public DeleteCommand(OsmDataLayer layer, Collection<? extends OsmPrimitive> data) {181 super(layer);182 CheckParameterUtil.ensureParameterNotNull(data, "data");183 this.toDelete = data;184 checkConsistency();185 153 } 186 154 … … 329 297 * If a way is deleted, only the way and no nodes are deleted. 330 298 * 331 * @param layer the {@link OsmDataLayer} in whose context primitives are deleted. Must not be null.332 * @param selection The list of all object to be deleted.333 * @param silent Set to true if the user should not be bugged with additional dialogs334 * @return command A command to perform the deletions, or null of there is nothing to delete.335 * @throws IllegalArgumentException if layer is null336 * @deprecated to be removed end of 2017. Use {@link #deleteWithReferences(Collection, boolean)} instead337 */338 @Deprecated339 public static Command deleteWithReferences(OsmDataLayer layer, Collection<? extends OsmPrimitive> selection, boolean silent) {340 return deleteWithReferences(selection, silent);341 }342 343 /**344 * Delete the primitives and everything they reference.345 *346 * If a node is deleted, the node and all ways and relations the node is part of are deleted as well.347 * If a way is deleted, all relations the way is member of are also deleted.348 * If a way is deleted, only the way and no nodes are deleted.349 *350 299 * @param selection The list of all object to be deleted. 351 300 * @param silent Set to true if the user should not be bugged with additional dialogs … … 373 322 * If a way is deleted, only the way and no nodes are deleted. 374 323 * 375 * @param layer unused376 324 * @param selection The list of all object to be deleted. 377 325 * @return command A command to perform the deletions, or null of there is nothing to delete. 378 326 * @throws IllegalArgumentException if layer is null 379 * @deprecated to be removed end of 2017. Use {@link #deleteWithReferences(Collection)} instead380 */381 @Deprecated382 public static Command deleteWithReferences(OsmDataLayer layer, Collection<? extends OsmPrimitive> selection) {383 return deleteWithReferences(selection);384 }385 386 /**387 * Delete the primitives and everything they reference.388 *389 * If a node is deleted, the node and all ways and relations the node is part of are deleted as well.390 * If a way is deleted, all relations the way is member of are also deleted.391 * If a way is deleted, only the way and no nodes are deleted.392 *393 * @param selection The list of all object to be deleted.394 * @return command A command to perform the deletions, or null of there is nothing to delete.395 * @throws IllegalArgumentException if layer is null396 327 * @since 12718 397 328 */ 398 329 public static Command deleteWithReferences(Collection<? extends OsmPrimitive> selection) { 399 330 return deleteWithReferences(selection, false); 400 }401 402 /**403 * Try to delete all given primitives.404 *405 * If a node is used by a way, it's removed from that way. If a node or a way is used by a406 * relation, inform the user and do not delete.407 *408 * If this would cause ways with less than 2 nodes to be created, delete these ways instead. If409 * they are part of a relation, inform the user and do not delete.410 *411 * @param layer unused412 * @param selection the objects to delete.413 * @return command a command to perform the deletions, or null if there is nothing to delete.414 * @deprecated to be removed end of 2017. Use {@link #delete(Collection)} instead415 */416 @Deprecated417 public static Command delete(OsmDataLayer layer, Collection<? extends OsmPrimitive> selection) {418 return delete(selection);419 331 } 420 332 … … 479 391 * they are part of a relation, inform the user and do not delete. 480 392 * 481 * @param layer unused482 393 * @param selection the objects to delete. 483 394 * @param alsoDeleteNodesInWay <code>true</code> if nodes should be deleted as well 484 395 * @return command a command to perform the deletions, or null if there is nothing to delete. 485 * @deprecated to be removed end of 2017. Use {@link #delete(Collection, boolean)} instead486 */487 @Deprecated488 public static Command delete(OsmDataLayer layer, Collection<? extends OsmPrimitive> selection,489 boolean alsoDeleteNodesInWay) {490 return delete(selection, alsoDeleteNodesInWay);491 }492 493 /**494 * Try to delete all given primitives.495 *496 * If a node is used by a way, it's removed from that way. If a node or a way is used by a497 * relation, inform the user and do not delete.498 *499 * If this would cause ways with less than 2 nodes to be created, delete these ways instead. If500 * they are part of a relation, inform the user and do not delete.501 *502 * @param selection the objects to delete.503 * @param alsoDeleteNodesInWay <code>true</code> if nodes should be deleted as well504 * @return command a command to perform the deletions, or null if there is nothing to delete.505 396 * @since 12718 506 397 */ 507 398 public static Command delete(Collection<? extends OsmPrimitive> selection, boolean alsoDeleteNodesInWay) { 508 399 return delete(selection, alsoDeleteNodesInWay, false /* not silent */); 509 }510 511 /**512 * Try to delete all given primitives.513 *514 * If a node is used by a way, it's removed from that way. If a node or a way is used by a515 * relation, inform the user and do not delete.516 *517 * If this would cause ways with less than 2 nodes to be created, delete these ways instead. If518 * they are part of a relation, inform the user and do not delete.519 *520 * @param layer unused521 * @param selection the objects to delete.522 * @param alsoDeleteNodesInWay <code>true</code> if nodes should be deleted as well523 * @param silent set to true if the user should not be bugged with additional questions524 * @return command a command to perform the deletions, or null if there is nothing to delete.525 * @deprecated to be removed end of 2017. Use {@link #delete(Collection, boolean, boolean)} instead526 */527 @Deprecated528 public static Command delete(OsmDataLayer layer, Collection<? extends OsmPrimitive> selection,529 boolean alsoDeleteNodesInWay, boolean silent) {530 return delete(selection, alsoDeleteNodesInWay, silent);531 400 } 532 401 … … 608 477 /** 609 478 * Create a command that deletes a single way segment. The way may be split by this. 610 * @param layer unused611 * @param ws The way segment that should be deleted612 * @return A matching command to safely delete that segment.613 * @deprecated to be removed end of 2017. Use {@link #deleteWaySegment(WaySegment)} instead614 */615 @Deprecated616 public static Command deleteWaySegment(OsmDataLayer layer, WaySegment ws) {617 return deleteWaySegment(ws);618 }619 620 /**621 * Create a command that deletes a single way segment. The way may be split by this.622 479 * @param ws The way segment that should be deleted 623 480 * @return A matching command to safely delete that segment. -
trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
r12846 r13173 30 30 import org.openstreetmap.josm.data.osm.Way; 31 31 import org.openstreetmap.josm.data.osm.WayData; 32 import org.openstreetmap.josm.gui.layer.OsmDataLayer;33 32 import org.openstreetmap.josm.spi.preferences.Config; 34 33 import org.openstreetmap.josm.tools.ImageProvider; … … 44 43 45 44 protected final ConflictCollection purgedConflicts = new ConflictCollection(); 46 47 /**48 * Constructs a new {@code PurgeCommand} (handles conflicts).49 * This command relies on a number of consistency conditions:50 * - makeIncomplete must be a subset of toPurge.51 * - Each primitive, that is in toPurge but not in makeIncomplete, must have all its referrers in toPurge.52 * - Each element of makeIncomplete must not be new and must have only referrers that are either a relation or included in toPurge.53 * @param layer OSM data layer54 * @param toPurge primitives to purge55 * @param makeIncomplete primitives to make incomplete56 * @deprecated to be removed end of 2017. Use {@link #PurgeCommand(DataSet, Collection, Collection)} instead57 */58 @Deprecated59 public PurgeCommand(OsmDataLayer layer, Collection<OsmPrimitive> toPurge, Collection<OsmPrimitive> makeIncomplete) {60 super(layer);61 init(toPurge, makeIncomplete);62 }63 45 64 46 /** … … 316 298 /** 317 299 * Creates a new {@code PurgeCommand} to purge selected OSM primitives. 318 * @param layer optional osm data layer, can be null319 * @param sel selected OSM primitives320 * @param toPurgeAdditionally optional list that will be filled with primitives to be purged that have not been in the selection321 * @return command to purge selected OSM primitives322 * @since 12688323 * @deprecated to be removed end of 2017. Use {@link #build(Collection, List)} instead324 */325 @Deprecated326 public static PurgeCommand build(OsmDataLayer layer, Collection<OsmPrimitive> sel, List<OsmPrimitive> toPurgeAdditionally) {327 return build(sel, toPurgeAdditionally);328 }329 330 /**331 * Creates a new {@code PurgeCommand} to purge selected OSM primitives.332 300 * @param sel selected OSM primitives 333 301 * @param toPurgeAdditionally optional list that will be filled with primitives to be purged that have not been in the selection -
trunk/src/org/openstreetmap/josm/command/SelectCommand.java
r12726 r13173 24 24 /** the selection before applying the new selection */ 25 25 private Collection<OsmPrimitive> oldSelection; 26 27 /**28 * Constructs a new select command.29 * @param newSelection the primitives to select when executing the command.30 * @deprecated to be removed end of 2017. Use {@link #SelectCommand(DataSet, Collection)} instead31 */32 @Deprecated33 public SelectCommand(Collection<OsmPrimitive> newSelection) {34 if (newSelection == null || newSelection.isEmpty()) {35 this.newSelection = Collections.emptySet();36 } else {37 this.newSelection = new HashSet<>(newSelection);38 }39 }40 26 41 27 /** -
trunk/src/org/openstreetmap/josm/command/SequenceCommand.java
r12726 r13173 13 13 import org.openstreetmap.josm.data.osm.DataSet; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 import org.openstreetmap.josm.gui.layer.Layer;16 15 import org.openstreetmap.josm.tools.ImageProvider; 17 16 import org.openstreetmap.josm.tools.Utils; … … 151 150 } 152 151 153 /**154 * Invalidate all layers that were affected by this command.155 * @see Layer#invalidate()156 * @deprecated to be removed end of 2017.157 */158 @Override159 @Deprecated160 public void invalidateAffectedLayers() {161 super.invalidateAffectedLayers();162 for (Command c : sequence) {163 c.invalidateAffectedLayers();164 }165 }166 167 152 @Override 168 153 public int hashCode() { -
trunk/src/org/openstreetmap/josm/command/SplitWayCommand.java
r13066 r13173 233 233 * Splits the way {@code way} into chunks of {@code wayChunks} and replies 234 234 * the result of this process in an instance of {@link SplitWayCommand}. 235 * The {@link org.openstreetmap.josm.actions.SplitWayAction.Strategy} is used to determine which235 * The {@link SplitWayCommand.Strategy} is used to determine which 236 236 * way chunk should reuse the old id and its history. 237 237 * -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
r12726 r13173 16 16 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 17 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;19 18 import org.openstreetmap.josm.tools.ImageProvider; 20 19 import org.openstreetmap.josm.tools.Logging; … … 27 26 public class ConflictAddCommand extends Command { 28 27 private final Conflict<? extends OsmPrimitive> conflict; 29 30 /**31 * Constructs a new {@code ConflictAddCommand}.32 * @param layer the data layer. Must not be null.33 * @param conflict the conflict to add34 * @deprecated to be removed end of 2017. Use {@link #ConflictAddCommand(DataSet, Conflict)} instead35 */36 @Deprecated37 public ConflictAddCommand(OsmDataLayer layer, Conflict<? extends OsmPrimitive> conflict) {38 super(layer);39 this.conflict = conflict;40 }41 28 42 29 /** -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java
r12726 r13173 11 11 import org.openstreetmap.josm.data.conflict.ConflictCollection; 12 12 import org.openstreetmap.josm.data.osm.DataSet; 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer;14 13 import org.openstreetmap.josm.tools.Logging; 15 14 … … 25 24 /** the list of resolved conflicts */ 26 25 private final ConflictCollection resolvedConflicts = new ConflictCollection(); 27 28 /**29 * Constructs a new {@code ConflictResolveCommand} in the context of the current edit layer, if any.30 * @deprecated to be removed end of 2017. Use {@link #ConflictResolveCommand(DataSet)} instead31 */32 @Deprecated33 public ConflictResolveCommand() {34 this(Main.main.getEditDataSet());35 }36 37 /**38 * Constructs a new {@code ConflictResolveCommand} in the context of a given data layer.39 * @param layer the data layer. Must not be null.40 * @deprecated to be removed end of 2017. Use {@link #ConflictResolveCommand(DataSet)} instead41 */42 @Deprecated43 public ConflictResolveCommand(OsmDataLayer layer) {44 super(layer);45 }46 26 47 27 /** -
trunk/src/org/openstreetmap/josm/data/Bounds.java
r12818 r13173 8 8 import java.text.MessageFormat; 9 9 import java.util.Objects; 10 import java.util.function.Consumer;11 10 12 11 import org.openstreetmap.josm.data.coor.ILatLon; 13 12 import org.openstreetmap.josm.data.coor.LatLon; 14 13 import org.openstreetmap.josm.data.osm.BBox; 15 import org.openstreetmap.josm.data.projection.Projection;16 14 import org.openstreetmap.josm.tools.CheckParameterUtil; 17 15 … … 565 563 } 566 564 567 /**568 * Visit points along the edge of this bounds instance.569 * @param projection The projection that should be used to determine how often the edge should be split along a given corner.570 * @param visitor A function to call for the points on the edge.571 * @since 10806572 * @deprecated use {@link Projection#visitOutline(Bounds, Consumer)}573 */574 @Deprecated575 public void visitEdge(Projection projection, Consumer<LatLon> visitor) {576 double width = getWidth();577 double height = maxLat - minLat;578 //TODO: Use projection to see if there is any need for doing this along each axis.579 int splitX = Math.max((int) width / 10, 10);580 int splitY = Math.max((int) height / 10, 10);581 582 for (int step = 0; step < splitX; step++) {583 visitor.accept(new LatLon(minLat, minLon + width * step / splitX));584 }585 for (int step = 0; step < splitY; step++) {586 visitor.accept(new LatLon(minLat + height * step / splitY, maxLon));587 }588 for (int step = 0; step < splitX; step++) {589 visitor.accept(new LatLon(maxLat, maxLon - width * step / splitX));590 }591 for (int step = 0; step < splitY; step++) {592 visitor.accept(new LatLon(maxLat - height * step / splitY, minLon));593 }594 }595 596 565 @Override 597 566 public int hashCode() { -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r13076 r13173 11 11 import java.io.Reader; 12 12 import java.io.StringWriter; 13 import java.lang.annotation.Retention;14 import java.lang.annotation.RetentionPolicy;15 13 import java.nio.charset.StandardCharsets; 16 14 import java.util.ArrayList; … … 38 36 39 37 import org.openstreetmap.josm.Main; 40 import org.openstreetmap.josm.data.preferences.BooleanProperty;41 38 import org.openstreetmap.josm.data.preferences.ColorInfo; 42 import org.openstreetmap.josm.data.preferences.DoubleProperty;43 import org.openstreetmap.josm.data.preferences.IntegerProperty;44 import org.openstreetmap.josm.data.preferences.LongProperty;45 39 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 46 40 import org.openstreetmap.josm.data.preferences.PreferencesReader; … … 51 45 import org.openstreetmap.josm.spi.preferences.Config; 52 46 import org.openstreetmap.josm.spi.preferences.IBaseDirectories; 53 import org.openstreetmap.josm.spi.preferences.IPreferences;54 import org.openstreetmap.josm.spi.preferences.ListListSetting;55 47 import org.openstreetmap.josm.spi.preferences.ListSetting; 56 import org.openstreetmap.josm.spi.preferences.MapListSetting;57 48 import org.openstreetmap.josm.spi.preferences.Setting; 58 49 import org.openstreetmap.josm.spi.preferences.StringSetting; … … 137 128 protected boolean initSuccessful; 138 129 139 /**140 * Event triggered when a preference entry value changes.141 * @deprecated use {@link org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent}142 */143 @Deprecated144 public interface PreferenceChangeEvent {145 /**146 * Returns the preference key.147 * @return the preference key148 */149 String getKey();150 151 /**152 * Returns the old preference value.153 * @return the old preference value154 */155 Setting<?> getOldValue();156 157 /**158 * Returns the new preference value.159 * @return the new preference value160 */161 Setting<?> getNewValue();162 }163 164 /**165 * Listener to preference change events.166 * @since 10600 (functional interface)167 * @deprecated use {@link org.openstreetmap.josm.spi.preferences.PreferenceChangedListener}168 */169 @FunctionalInterface170 @Deprecated171 public interface PreferenceChangedListener {172 /**173 * Trigerred when a preference entry value changes.174 * @param e the preference change event175 */176 void preferenceChanged(PreferenceChangeEvent e);177 }178 179 /**180 * @deprecated private class is deprecated181 */182 @Deprecated183 private static class DefaultPreferenceChangeEvent implements PreferenceChangeEvent {184 private final String key;185 private final Setting<?> oldValue;186 private final Setting<?> newValue;187 188 DefaultPreferenceChangeEvent(String key, Setting<?> oldValue, Setting<?> newValue) {189 this.key = key;190 this.oldValue = oldValue;191 this.newValue = newValue;192 }193 194 @Override195 public String getKey() {196 return key;197 }198 199 @Override200 public Setting<?> getOldValue() {201 return oldValue;202 }203 204 @Override205 public Setting<?> getNewValue() {206 return newValue;207 }208 }209 210 130 private final ListenerList<org.openstreetmap.josm.spi.preferences.PreferenceChangedListener> listeners = ListenerList.create(); 211 131 212 132 private final HashMap<String, ListenerList<org.openstreetmap.josm.spi.preferences.PreferenceChangedListener>> keyListeners = new HashMap<>(); 213 214 /**215 * @deprecated deprecated private field216 */217 @Deprecated218 private final ListenerList<Preferences.PreferenceChangedListener> listenersDeprecated = ListenerList.create();219 220 /**221 * @deprecated deprecated private field222 */223 @Deprecated224 private final HashMap<String, ListenerList<Preferences.PreferenceChangedListener>> keyListenersDeprecated = new HashMap<>();225 133 226 134 /** … … 266 174 267 175 /** 268 * Adds a new preferences listener.269 * @param listener The listener to add270 * @deprecated use {@link #addPreferenceChangeListener(org.openstreetmap.josm.spi.preferences.PreferenceChangedListener)}271 */272 @Deprecated273 public void addPreferenceChangeListener(Preferences.PreferenceChangedListener listener) {274 if (listener != null) {275 listenersDeprecated.addListener(listener);276 }277 }278 279 /**280 176 * Removes a preferences listener. 281 177 * @param listener The listener to remove … … 285 181 public void removePreferenceChangeListener(org.openstreetmap.josm.spi.preferences.PreferenceChangedListener listener) { 286 182 listeners.removeListener(listener); 287 }288 289 /**290 * Removes a preferences listener.291 * @param listener The listener to remove292 * @deprecated use {@link #removePreferenceChangeListener(org.openstreetmap.josm.spi.preferences.PreferenceChangedListener)}293 */294 @Deprecated295 public void removePreferenceChangeListener(Preferences.PreferenceChangedListener listener) {296 listenersDeprecated.removeListener(listener);297 183 } 298 184 … … 309 195 310 196 /** 311 * Adds a listener that only listens to changes in one preference312 * @param key The preference key to listen to313 * @param listener The listener to add.314 * @since 10824315 * @deprecated use316 * {@link #addKeyPreferenceChangeListener(java.lang.String, org.openstreetmap.josm.spi.preferences.PreferenceChangedListener)}317 */318 @Deprecated319 public void addKeyPreferenceChangeListener(String key, Preferences.PreferenceChangedListener listener) {320 listenersForKeyDeprecated(key).addListener(listener);321 }322 323 /**324 197 * Adds a weak listener that only listens to changes in one preference 325 198 * @param key The preference key to listen to … … 333 206 private ListenerList<org.openstreetmap.josm.spi.preferences.PreferenceChangedListener> listenersForKey(String key) { 334 207 return keyListeners.computeIfAbsent(key, k -> ListenerList.create()); 335 }336 337 /**338 * @param key preference key339 * @return listener list for this key340 * @deprecated deprecated private method341 */342 @Deprecated343 private ListenerList<Preferences.PreferenceChangedListener> listenersForKeyDeprecated(String key) {344 return keyListenersDeprecated.computeIfAbsent(key, k -> ListenerList.create());345 208 } 346 209 … … 358 221 } 359 222 360 /**361 * Removes a listener that only listens to changes in one preference362 * @param key The preference key to listen to363 * @param listener The listener to add.364 * @deprecated use365 * {@link #removeKeyPreferenceChangeListener(java.lang.String, org.openstreetmap.josm.spi.preferences.PreferenceChangedListener)}366 */367 @Deprecated368 public void removeKeyPreferenceChangeListener(String key, Preferences.PreferenceChangedListener listener) {369 Optional.ofNullable(keyListenersDeprecated.get(key)).orElseThrow(370 () -> new IllegalArgumentException("There are no listeners registered for " + key))371 .removeListener(listener);372 }373 374 223 protected void firePreferenceChanged(String key, Setting<?> oldValue, Setting<?> newValue) { 375 224 final org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent evt = … … 381 230 forKey.fireEvent(listener -> listener.preferenceChanged(evt)); 382 231 } 383 firePreferenceChangedDeprecated(key, oldValue, newValue); 384 } 385 386 /** 387 * @param key preference key 388 * @param oldValue old value 389 * @param newValue new value 390 * @deprecated deprecated private method 391 */ 392 @Deprecated 393 private void firePreferenceChangedDeprecated(String key, Setting<?> oldValue, Setting<?> newValue) { 394 final Preferences.PreferenceChangeEvent evtDeprecated = new Preferences.DefaultPreferenceChangeEvent(key, oldValue, newValue); 395 listenersDeprecated.fireEvent(listener -> listener.preferenceChanged(evtDeprecated)); 396 397 ListenerList<Preferences.PreferenceChangedListener> forKeyDeprecated = keyListenersDeprecated.get(key); 398 if (forKeyDeprecated != null) { 399 forKeyDeprecated.fireEvent(listener -> listener.preferenceChanged(evtDeprecated)); 400 } 401 } 402 403 /** 404 * Get the base name of the JOSM directories for preferences, cache and 405 * user data. 232 } 233 234 /** 235 * Get the base name of the JOSM directories for preferences, cache and user data. 406 236 * Default value is "JOSM", unless overridden by system property "josm.dir.name". 407 * @return the base name of the JOSM directories for preferences, cache and 408 * user data 237 * @return the base name of the JOSM directories for preferences, cache and user data 409 238 */ 410 239 public String getJOSMDirectoryBaseName() { … … 639 468 } 640 469 return all; 641 }642 643 /**644 * Gets an boolean that may be specialized645 * @param key The basic key646 * @param specName The sub-key to append to the key647 * @param def The default value648 * @return The boolean value or the default value if it could not be parsed649 * @deprecated use {@link PreferencesUtils#getBoolean(IPreferences, String, String, boolean)}650 */651 @Deprecated652 public synchronized boolean getBoolean(final String key, final String specName, final boolean def) {653 boolean generic = getBoolean(key, def);654 String skey = key+'.'+specName;655 Setting<?> prop = settingsMap.get(skey);656 if (prop instanceof StringSetting)657 return Boolean.parseBoolean(((StringSetting) prop).getValue());658 else659 return generic;660 }661 662 /**663 * Set a boolean value for a certain setting.664 * @param key the unique identifier for the setting665 * @param value The new value666 * @return {@code true}, if something has changed (i.e. value is different than before)667 * @see BooleanProperty668 * @deprecated use {@link IPreferences#putBoolean(String, boolean)}669 */670 @Deprecated671 public boolean put(final String key, final boolean value) {672 return put(key, Boolean.toString(value));673 }674 675 /**676 * Set a boolean value for a certain setting.677 * @param key the unique identifier for the setting678 * @param value The new value679 * @return {@code true}, if something has changed (i.e. value is different than before)680 * @see IntegerProperty#put(Integer)681 * @deprecated use {@link IPreferences#putInt(String, int)}682 */683 @Deprecated684 public boolean putInteger(final String key, final Integer value) {685 return put(key, Integer.toString(value));686 }687 688 /**689 * Set a boolean value for a certain setting.690 * @param key the unique identifier for the setting691 * @param value The new value692 * @return {@code true}, if something has changed (i.e. value is different than before)693 * @see DoubleProperty#put(Double)694 * @deprecated use {@link IPreferences#putDouble(java.lang.String, double)}695 */696 @Deprecated697 public boolean putDouble(final String key, final Double value) {698 return put(key, Double.toString(value));699 }700 701 /**702 * Set a boolean value for a certain setting.703 * @param key the unique identifier for the setting704 * @param value The new value705 * @return {@code true}, if something has changed (i.e. value is different than before)706 * @see LongProperty#put(Long)707 * @deprecated use {@link IPreferences#putLong(java.lang.String, long)}708 */709 @Deprecated710 public boolean putLong(final String key, final Long value) {711 return put(key, Long.toString(value));712 470 } 713 471 … … 1050 808 1051 809 /** 1052 * Gets an integer preference1053 * @param key The preference key1054 * @param def The default value to use1055 * @return The integer1056 * @see IntegerProperty#get()1057 * @deprecated use {@link IPreferences#getInt(String, int)}1058 */1059 @Deprecated1060 public synchronized int getInteger(String key, int def) {1061 String v = get(key, Integer.toString(def));1062 if (v.isEmpty())1063 return def;1064 1065 try {1066 return Integer.parseInt(v);1067 } catch (NumberFormatException e) {1068 // fall out1069 Logging.trace(e);1070 }1071 return def;1072 }1073 1074 /**1075 * Gets an integer that may be specialized1076 * @param key The basic key1077 * @param specName The sub-key to append to the key1078 * @param def The default value1079 * @return The integer value or the default value if it could not be parsed1080 * @deprecated use {@link PreferencesUtils#getInteger(IPreferences, String, String, int)}1081 */1082 @Deprecated1083 public synchronized int getInteger(String key, String specName, int def) {1084 String v = get(key+'.'+specName);1085 if (v.isEmpty())1086 v = get(key, Integer.toString(def));1087 if (v.isEmpty())1088 return def;1089 1090 try {1091 return Integer.parseInt(v);1092 } catch (NumberFormatException e) {1093 // fall out1094 Logging.trace(e);1095 }1096 return def;1097 }1098 1099 /**1100 * Get a list of values for a certain key1101 * @param key the identifier for the setting1102 * @param def the default value.1103 * @return the corresponding value if the property has been set before, {@code def} otherwise1104 * @deprecated use {@link IPreferences#getList(java.lang.String, java.util.List)}1105 */1106 @Deprecated1107 public Collection<String> getCollection(String key, Collection<String> def) {1108 return getSetting(key, ListSetting.create(def), ListSetting.class).getValue();1109 }1110 1111 /**1112 * Get a list of values for a certain key1113 * @param key the identifier for the setting1114 * @return the corresponding value if the property has been set before, an empty collection otherwise.1115 * @deprecated use {@link IPreferences#getList(java.lang.String)}1116 */1117 @Deprecated1118 public Collection<String> getCollection(String key) {1119 Collection<String> val = getList(key, null);1120 return val == null ? Collections.<String>emptyList() : val;1121 }1122 1123 /**1124 * Removes a value from a given String collection1125 * @param key The preference key the collection is stored with1126 * @param value The value that should be removed in the collection1127 * @see #getList(String)1128 * @deprecated use {@link PreferencesUtils#removeFromList(IPreferences, String, String)}1129 */1130 @Deprecated1131 public synchronized void removeFromCollection(String key, String value) {1132 List<String> a = new ArrayList<>(getList(key, Collections.<String>emptyList()));1133 a.remove(value);1134 putList(key, a);1135 }1136 1137 /**1138 810 * Set a value for a certain setting. The changed setting is saved to the preference file immediately. 1139 811 * Due to caching mechanisms on modern operating systems and hardware, this shouldn't be a performance problem. … … 1218 890 } 1219 891 1220 /**1221 * Put a collection.1222 * @param key key1223 * @param value value1224 * @return {@code true}, if something has changed (i.e. value is different than before)1225 * @deprecated use {@link IPreferences#putList(java.lang.String, java.util.List)}1226 */1227 @Deprecated1228 public boolean putCollection(String key, Collection<String> value) {1229 return putSetting(key, value == null ? null : ListSetting.create(value));1230 }1231 1232 /**1233 * Saves at most {@code maxsize} items of collection {@code val}.1234 * @param key key1235 * @param maxsize max number of items to save1236 * @param val value1237 * @return {@code true}, if something has changed (i.e. value is different than before)1238 * @deprecated use {@link PreferencesUtils#putListBounded(IPreferences, String, int, List)}1239 */1240 @Deprecated1241 public boolean putCollectionBounded(String key, int maxsize, Collection<String> val) {1242 List<String> newCollection = new ArrayList<>(Math.min(maxsize, val.size()));1243 for (String i : val) {1244 if (newCollection.size() >= maxsize) {1245 break;1246 }1247 newCollection.add(i);1248 }1249 return putList(key, newCollection);1250 }1251 1252 /**1253 * Used to read a 2-dimensional array of strings from the preference file.1254 * If not a single entry could be found, <code>def</code> is returned.1255 * @param key preference key1256 * @param def default array value1257 * @return array value1258 * @deprecated use {@link #getListOfLists(java.lang.String, java.util.List)}1259 */1260 @Deprecated1261 @SuppressWarnings({ "unchecked", "rawtypes" })1262 public synchronized Collection<Collection<String>> getArray(String key, Collection<Collection<String>> def) {1263 ListListSetting val = getSetting(key, ListListSetting.create(def), ListListSetting.class);1264 return (Collection) val.getValue();1265 }1266 1267 /**1268 * Gets a collection of string collections for the given key1269 * @param key The key1270 * @return The collection of string collections or an empty collection as default1271 * @deprecated use {@link IPreferences#getListOfLists(java.lang.String)}1272 */1273 @Deprecated1274 public Collection<Collection<String>> getArray(String key) {1275 Collection<Collection<String>> res = getArray(key, null);1276 return res == null ? Collections.<Collection<String>>emptyList() : res;1277 }1278 1279 /**1280 * Put an array.1281 * @param key key1282 * @param value value1283 * @return {@code true}, if something has changed (i.e. value is different than before)1284 * @deprecated use {@link IPreferences#putListOfLists(java.lang.String, java.util.List)}1285 */1286 @Deprecated1287 public boolean putArray(String key, Collection<Collection<String>> value) {1288 return putSetting(key, value == null ? null : ListListSetting.create(value));1289 }1290 1291 /**1292 * Gets a collection of key/value maps.1293 * @param key The key to search at1294 * @param def The default value to use1295 * @return The stored value or the default one if it could not be parsed1296 * @deprecated use {@link IPreferences#getListOfMaps(java.lang.String, java.util.List)}1297 */1298 @Deprecated1299 public Collection<Map<String, String>> getListOfStructs(String key, Collection<Map<String, String>> def) {1300 return getSetting(key, new MapListSetting(def == null ? null : new ArrayList<>(def)), MapListSetting.class).getValue();1301 }1302 1303 /**1304 * Stores a list of structs1305 * @param key The key to store the list in1306 * @param value A list of key/value maps1307 * @return <code>true</code> if the value was changed1308 * @see #getListOfMaps(java.lang.String, java.util.List)1309 * @deprecated use {@link IPreferences#putListOfMaps(java.lang.String, java.util.List)}1310 */1311 @Deprecated1312 public boolean putListOfStructs(String key, Collection<Map<String, String>> value) {1313 return putSetting(key, value == null ? null : new MapListSetting(new ArrayList<>(value)));1314 }1315 1316 /**1317 * Annotation used for converting objects to String Maps and vice versa.1318 * Indicates that a certain field should be considered in the conversion process. Otherwise it is ignored.1319 *1320 * @see #serializeStruct(java.lang.Object, java.lang.Class)1321 * @see #deserializeStruct(java.util.Map, java.lang.Class)1322 * @deprecated use {@link StructUtils.StructEntry}1323 */1324 @Deprecated1325 @Retention(RetentionPolicy.RUNTIME) // keep annotation at runtime1326 public @interface pref { }1327 1328 /**1329 * Annotation used for converting objects to String Maps.1330 * Indicates that a certain field should be written to the map, even if the value is the same as the default value.1331 *1332 * @see #serializeStruct(java.lang.Object, java.lang.Class)1333 * @deprecated use {@link StructUtils.WriteExplicitly}1334 */1335 @Deprecated1336 @Retention(RetentionPolicy.RUNTIME) // keep annotation at runtime1337 public @interface writeExplicitly { }1338 1339 /**1340 * Get a list of hashes which are represented by a struct-like class.1341 * Possible properties are given by fields of the class klass that have the @pref annotation.1342 * Default constructor is used to initialize the struct objects, properties then override some of these default values.1343 * @param <T> klass type1344 * @param key main preference key1345 * @param klass The struct class1346 * @return a list of objects of type T or an empty list if nothing was found1347 * @deprecated use {@link StructUtils#getListOfStructs(IPreferences, String, Class)}1348 */1349 @Deprecated1350 public <T> List<T> getListOfStructs(String key, Class<T> klass) {1351 return StructUtils.getListOfStructs(this, key, klass);1352 }1353 1354 /**1355 * same as above, but returns def if nothing was found1356 * @param <T> klass type1357 * @param key main preference key1358 * @param def default value1359 * @param klass The struct class1360 * @return a list of objects of type T or {@code def} if nothing was found1361 * @deprecated use {@link StructUtils#getListOfStructs(IPreferences, String, Collection, Class)}1362 */1363 @Deprecated1364 public <T> List<T> getListOfStructs(String key, Collection<T> def, Class<T> klass) {1365 return StructUtils.getListOfStructs(this, key, def, klass);1366 }1367 1368 /**1369 * Convenience method that saves a MapListSetting which is provided as a collection of objects.1370 *1371 * Each object is converted to a <code>Map<String, String></code> using the fields with {@link pref} annotation.1372 * The field name is the key and the value will be converted to a string.1373 *1374 * Considers only fields that have the @pref annotation.1375 * In addition it does not write fields with null values. (Thus they are cleared)1376 * Default values are given by the field values after default constructor has been called.1377 * Fields equal to the default value are not written unless the field has the @writeExplicitly annotation.1378 * @param <T> the class,1379 * @param key main preference key1380 * @param val the list that is supposed to be saved1381 * @param klass The struct class1382 * @return true if something has changed1383 * @deprecated use {@link StructUtils#putListOfStructs(IPreferences, String, Collection, Class)}1384 */1385 @Deprecated1386 public <T> boolean putListOfStructs(String key, Collection<T> val, Class<T> klass) {1387 return StructUtils.putListOfStructs(this, key, val, klass);1388 }1389 1390 /**1391 * Convert an object to a String Map, by using field names and values as map key and value.1392 *1393 * The field value is converted to a String.1394 *1395 * Only fields with annotation {@link pref} are taken into account.1396 *1397 * Fields will not be written to the map if the value is null or unchanged1398 * (compared to an object created with the no-arg-constructor).1399 * The {@link writeExplicitly} annotation overrides this behavior, i.e. the default value will also be written.1400 *1401 * @param <T> the class of the object <code>struct</code>1402 * @param struct the object to be converted1403 * @param klass the class T1404 * @return the resulting map (same data content as <code>struct</code>)1405 * @deprecated use {@link StructUtils#serializeStruct(java.lang.Object, java.lang.Class)}1406 */1407 @Deprecated1408 public static <T> Map<String, String> serializeStruct(T struct, Class<T> klass) {1409 return StructUtils.serializeStruct(struct, klass);1410 }1411 1412 /**1413 * Converts a String-Map to an object of a certain class, by comparing map keys to field names of the class and assigning1414 * map values to the corresponding fields.1415 *1416 * The map value (a String) is converted to the field type. Supported types are: boolean, Boolean, int, Integer, double,1417 * Double, String, Map<String, String> and Map<String, List<String>>.1418 *1419 * Only fields with annotation {@link pref} are taken into account.1420 * @param <T> the class1421 * @param hash the string map with initial values1422 * @param klass the class T1423 * @return an object of class T, initialized as described above1424 * @deprecated use {@link StructUtils#deserializeStruct(java.util.Map, java.lang.Class)}1425 */1426 @Deprecated1427 public static <T> T deserializeStruct(Map<String, String> hash, Class<T> klass) {1428 return StructUtils.deserializeStruct(hash, klass);1429 }1430 1431 892 @Override 1432 893 public Set<String> getKeySet() { -
trunk/src/org/openstreetmap/josm/data/StructUtils.java
r12851 r13173 148 148 * @return the resulting map (same data content as <code>struct</code>) 149 149 */ 150 @SuppressWarnings("deprecation")151 150 public static <T> Map<String, String> serializeStruct(T struct, Class<T> klass) { 152 151 T structPrototype; … … 159 158 Map<String, String> hash = new LinkedHashMap<>(); 160 159 for (Field f : klass.getDeclaredFields()) { 161 if (f.getAnnotation( Preferences.pref.class) == null && f.getAnnotation(StructEntry.class) == null) {160 if (f.getAnnotation(StructEntry.class) == null) { 162 161 continue; 163 162 } … … 167 166 Object defaultFieldValue = f.get(structPrototype); 168 167 if (fieldValue != null && ( 169 f.getAnnotation(Preferences.writeExplicitly.class) != null ||170 168 f.getAnnotation(WriteExplicitly.class) != null || 171 169 !Objects.equals(fieldValue, defaultFieldValue))) { … … 216 214 continue; 217 215 } 218 if (f.getAnnotation( Preferences.pref.class) == null && f.getAnnotation(StructEntry.class) == null) {216 if (f.getAnnotation(StructEntry.class) == null) { 219 217 continue; 220 218 } -
trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java
r13140 r13173 4 4 import java.io.Serializable; 5 5 import java.util.Objects; 6 7 import org.openstreetmap.josm.data.osm.BBox;8 6 9 7 /** … … 92 90 } 93 91 94 /**95 * Creates bbox around this coordinate. Coordinate defines96 * center of bbox, its edge will be 2*r.97 *98 * @param r size99 * @return BBox around this coordinate100 * @since 6203101 * @deprecated use {@link BBox#BBox(double, double, double)} instead102 */103 @Deprecated104 public BBox toBBox(final double r) {105 return new BBox(x, y, r);106 }107 108 92 @Override 109 93 public int hashCode() { -
trunk/src/org/openstreetmap/josm/data/coor/ILatLon.java
r12729 r13173 2 2 package org.openstreetmap.josm.data.coor; 3 3 4 import org.openstreetmap.josm.Main;5 4 import org.openstreetmap.josm.data.projection.Projecting; 6 5 … … 39 38 40 39 /** 41 * <p>Replies the projected east/north coordinates.</p>42 *43 * <p>Uses the {@link Main#getProjection() global projection} to project the lat/lon-coordinates.</p>44 *45 * @return the east north coordinates or {@code null} if #is46 * @deprecated use {@link #getEastNorth(org.openstreetmap.josm.data.projection.Projecting)}47 */48 @Deprecated49 default EastNorth getEastNorth() {50 return getEastNorth(Main.getProjection());51 }52 53 /**54 40 * Replies the projected east/north coordinates. 55 41 * <p> -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r12873 r13173 9 9 import static java.lang.Math.sqrt; 10 10 import static org.openstreetmap.josm.data.projection.Ellipsoid.WGS84; 11 import static org.openstreetmap.josm.tools.I18n.trc;12 11 import static org.openstreetmap.josm.tools.Utils.toRadians; 13 12 … … 15 14 import java.text.DecimalFormat; 16 15 import java.text.NumberFormat; 17 import java.util.Arrays;18 16 import java.util.Locale; 19 17 import java.util.Objects; … … 21 19 import org.openstreetmap.josm.Main; 22 20 import org.openstreetmap.josm.data.Bounds; 23 import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat;24 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat;25 import org.openstreetmap.josm.data.coor.conversion.LatLonParser;26 import org.openstreetmap.josm.data.coor.conversion.NauticalCoordinateFormat;27 21 import org.openstreetmap.josm.tools.Logging; 28 22 import org.openstreetmap.josm.tools.Utils; … … 87 81 88 82 /** 89 * Character denoting South, as string.90 * @deprecated use {@link LatLonParser#SOUTH}91 */92 @Deprecated93 public static final String SOUTH = trc("compass", "S");94 /**95 * Character denoting North, as string.96 * @deprecated use {@link LatLonParser#NORTH}97 */98 @Deprecated99 public static final String NORTH = trc("compass", "N");100 /**101 * Character denoting West, as string.102 * @deprecated use {@link LatLonParser#WEST}103 */104 @Deprecated105 public static final String WEST = trc("compass", "W");106 /**107 * Character denoting East, as string.108 * @deprecated use {@link LatLonParser#EAST}109 */110 @Deprecated111 public static final String EAST = trc("compass", "E");112 113 /**114 83 * Replies true if lat is in the range [-90,90] 115 84 * … … 185 154 186 155 /** 187 * Replies the coordinate in degrees/minutes/seconds format188 * @param pCoordinate The coordinate to convert189 * @return The coordinate in degrees/minutes/seconds format190 * @deprecated use {@link #degreesMinutesSeconds} instead191 */192 @Deprecated193 public static String dms(double pCoordinate) {194 return degreesMinutesSeconds(pCoordinate);195 }196 197 /**198 * Replies the coordinate in degrees/minutes/seconds format199 * @param pCoordinate The coordinate to convert200 * @return The coordinate in degrees/minutes/seconds format201 * @since 12561202 * @deprecated use {@link DMSCoordinateFormat#degreesMinutesSeconds(double)}203 */204 @Deprecated205 public static String degreesMinutesSeconds(double pCoordinate) {206 return DMSCoordinateFormat.degreesMinutesSeconds(pCoordinate);207 }208 209 /**210 * Replies the coordinate in degrees/minutes format211 * @param pCoordinate The coordinate to convert212 * @return The coordinate in degrees/minutes format213 * @since 12537214 * @deprecated use {@link NauticalCoordinateFormat#degreesMinutes(double)}215 */216 @Deprecated217 public static String degreesMinutes(double pCoordinate) {218 return NauticalCoordinateFormat.degreesMinutes(pCoordinate);219 }220 221 /**222 * Replies the coordinate in degrees/minutes format223 * @param pCoordinate The coordinate to convert224 * @return The coordinate in degrees/minutes format225 * @deprecated use {@link #degreesMinutes(double)} instead226 */227 @Deprecated228 public static String dm(double pCoordinate) {229 return degreesMinutes(pCoordinate);230 }231 232 /**233 156 * Constructs a new object representing the given latitude/longitude. 234 157 * @param lat the latitude, i.e., the north-south position in degrees … … 252 175 } 253 176 254 /**255 * Formats the latitude part according to the given format256 * @param d the coordinate format to use257 * @return the formatted latitude258 * @deprecated use {@link org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat#latToString(ILatLon)}259 */260 @Deprecated261 public String latToString(CoordinateFormat d) {262 return d.getICoordinateFormat().latToString(this);263 }264 265 177 @Override 266 178 public double lon() { 267 179 return x; 268 }269 270 /**271 * Formats the longitude part according to the given format272 * @param d the coordinate format to use273 * @return the formatted longitude274 * @deprecated use {@link org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat#lonToString(ILatLon)}275 */276 @Deprecated277 public String lonToString(CoordinateFormat d) {278 return d.getICoordinateFormat().lonToString(this);279 180 } 280 181 … … 409 310 410 311 /** 411 * Returns this lat/lon pair in human-readable format separated by {@code separator}.412 * @param separator values separator413 * @return String in the format {@code "1.23456[separator]2.34567"}414 * @deprecated method removed without replacement415 */416 @Deprecated417 public String toStringCSV(String separator) {418 return Utils.join(separator, Arrays.asList(419 DecimalDegreesCoordinateFormat.INSTANCE.latToString(this),420 DecimalDegreesCoordinateFormat.INSTANCE.lonToString(this)421 ));422 }423 424 /**425 312 * Interpolate between this and a other latlon 426 313 * @param ll2 The other lat/lon object … … 506 393 Double.compare(that.y, y) == 0; 507 394 } 508 509 /**510 * Parses the given string as lat/lon.511 * @param coord String to parse512 * @return parsed lat/lon513 * @since 11045514 * @deprecated use {@link LatLonParser#parse(java.lang.String)}515 */516 @Deprecated517 public static LatLon parse(String coord) {518 return LatLonParser.parse(coord);519 }520 395 } -
trunk/src/org/openstreetmap/josm/data/oauth/OAuthAccessTokenHolder.java
r12928 r13173 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import org.openstreetmap.josm.data.Preferences;7 6 import org.openstreetmap.josm.io.auth.CredentialsAgent; 8 7 import org.openstreetmap.josm.io.auth.CredentialsAgentException; … … 165 164 166 165 /** 167 * Initializes the content of this holder from the Access Token managed by the168 * credential manager.169 *170 * @param pref the preferences. Must not be null.171 * @param cm the credential manager. Must not be null.172 * @throws IllegalArgumentException if cm is null173 * @deprecated (since 12928) replaced by {@link #init(org.openstreetmap.josm.io.auth.CredentialsAgent)}174 */175 @Deprecated176 public void init(Preferences pref, CredentialsAgent cm) {177 CheckParameterUtil.ensureParameterNotNull(pref, "pref");178 CheckParameterUtil.ensureParameterNotNull(cm, "cm");179 OAuthToken token = null;180 try {181 token = cm.lookupOAuthAccessToken();182 } catch (CredentialsAgentException e) {183 Logging.error(e);184 Logging.warn(tr("Failed to retrieve OAuth Access Token from credential manager"));185 Logging.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));186 }187 saveToPreferences = pref.getBoolean("oauth.access-token.save-to-preferences", true);188 if (token != null) {189 accessTokenKey = token.getKey();190 accessTokenSecret = token.getSecret();191 }192 }193 194 /**195 166 * Saves the content of this holder to the preferences and a credential store managed 196 167 * by a credential manager. … … 216 187 217 188 /** 218 * Saves the content of this holder to the preferences and a credential store managed219 * by a credential manager.220 *221 * @param preferences the preferences. Must not be null.222 * @param cm the credentials manager. Must not be null.223 * @throws IllegalArgumentException if preferences is null224 * @throws IllegalArgumentException if cm is null225 * @deprecated (since 12928) replaced by {@link #save(org.openstreetmap.josm.io.auth.CredentialsAgent)}226 */227 @Deprecated228 public void save(Preferences preferences, CredentialsAgent cm) {229 CheckParameterUtil.ensureParameterNotNull(preferences, "preferences");230 CheckParameterUtil.ensureParameterNotNull(cm, "cm");231 preferences.putBoolean("oauth.access-token.save-to-preferences", saveToPreferences);232 try {233 if (!saveToPreferences) {234 cm.storeOAuthAccessToken(null);235 } else {236 cm.storeOAuthAccessToken(new OAuthToken(accessTokenKey, accessTokenSecret));237 }238 } catch (CredentialsAgentException e) {239 Logging.error(e);240 Logging.warn(tr("Failed to store OAuth Access Token to credentials manager"));241 Logging.warn(tr("Current credential manager is of type ''{0}''", cm.getClass().getName()));242 }243 }244 245 /**246 189 * Clears the content of this holder 247 190 */ -
trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
r12928 r13173 5 5 6 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.data.Preferences;8 7 import org.openstreetmap.josm.io.OsmApi; 9 8 import org.openstreetmap.josm.spi.preferences.Config; … … 96 95 97 96 /** 98 * Replies a set of parameters as defined in the preferences.99 *100 * @param pref the preferences101 * @return the parameters102 * @deprecated (since 12928) replaced by {@link #createFromApiUrl(java.lang.String)}103 */104 @Deprecated105 public static OAuthParameters createFromPreferences(Preferences pref) {106 OAuthParameters parameters = createDefault(pref.get("osm-server.url"));107 return new OAuthParameters(108 pref.get("oauth.settings.consumer-key", parameters.getConsumerKey()),109 pref.get("oauth.settings.consumer-secret", parameters.getConsumerSecret()),110 pref.get("oauth.settings.request-token-url", parameters.getRequestTokenUrl()),111 pref.get("oauth.settings.access-token-url", parameters.getAccessTokenUrl()),112 pref.get("oauth.settings.authorise-url", parameters.getAuthoriseUrl()),113 pref.get("oauth.settings.osm-login-url", parameters.getOsmLoginUrl()),114 pref.get("oauth.settings.osm-logout-url", parameters.getOsmLogoutUrl()));115 }116 117 /**118 97 * Remembers the current values in the preferences. 119 98 */ … … 126 105 Config.getPref().put("oauth.settings.osm-login-url", getOsmLoginUrl()); 127 106 Config.getPref().put("oauth.settings.osm-logout-url", getOsmLogoutUrl()); 128 }129 130 /**131 * Remembers the current values in the preferences <code>pref</code>.132 *133 * @param pref the preferences. Must not be null.134 * @throws IllegalArgumentException if pref is null.135 * @deprecated (since 12928) replaced by {@link #rememberPreferences()}136 */137 @Deprecated138 public void rememberPreferences(Preferences pref) {139 CheckParameterUtil.ensureParameterNotNull(pref, "pref");140 pref.put("oauth.settings.consumer-key", getConsumerKey());141 pref.put("oauth.settings.consumer-secret", getConsumerSecret());142 pref.put("oauth.settings.request-token-url", getRequestTokenUrl());143 pref.put("oauth.settings.access-token-url", getAccessTokenUrl());144 pref.put("oauth.settings.authorise-url", getAuthoriseUrl());145 pref.put("oauth.settings.osm-login-url", getOsmLoginUrl());146 pref.put("oauth.settings.osm-logout-url", getOsmLogoutUrl());147 107 } 148 108 -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r12809 r13173 105 105 106 106 /** 107 * Visitor pattern.108 * @param v visitor109 * @deprecated no longer supported110 */111 @Deprecated112 public void visit(org.openstreetmap.josm.data.osm.visitor.Visitor v) {113 v.visit(this);114 }115 116 /**117 107 * Compares this changeset to another, based on their identifier. 118 108 * @param other other changeset -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r13161 r13173 55 55 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 56 56 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 57 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;58 57 import org.openstreetmap.josm.tools.ListenerList; 59 58 import org.openstreetmap.josm.tools.Logging; … … 208 207 // the listener, projection change listeners are managed as WeakReferences. 209 208 Main.addProjectionChangeListener(this); 210 addSelectionListener((DataSelectionListener) e -> fire DeprecatedSelectionChange(e.getSelection()));209 addSelectionListener((DataSelectionListener) e -> fireSelectionChange(e.getSelection())); 211 210 } 212 211 … … 335 334 336 335 /** 337 * Returns the autocompletion manager, which maintains a list of used tags for autocompletion.338 * @return the autocompletion manager339 * @deprecated to be removed end of 2017. Use {@link AutoCompletionManager#of(DataSet)} instead.340 */341 @Deprecated342 public AutoCompletionManager getAutoCompletionManager() {343 return AutoCompletionManager.of(this);344 }345 346 /**347 336 * The API version that created this data set, if any. 348 337 */ … … 365 354 public void setVersion(String version) { 366 355 this.version = version; 367 }368 369 /**370 * Determines if upload is being discouraged.371 * (i.e. this dataset contains private data which should not be uploaded)372 * @return {@code true} if upload is being discouraged, {@code false} otherwise373 * @see #setUploadDiscouraged374 * @deprecated use {@link #getUploadPolicy()}375 */376 @Deprecated377 public boolean isUploadDiscouraged() {378 return uploadPolicy == UploadPolicy.DISCOURAGED || uploadPolicy == UploadPolicy.BLOCKED;379 }380 381 /**382 * Sets the "upload discouraged" flag.383 * @param uploadDiscouraged {@code true} if this dataset contains private data which should not be uploaded384 * @see #isUploadDiscouraged385 * @deprecated use {@link #setUploadPolicy(UploadPolicy)}386 */387 @Deprecated388 public void setUploadDiscouraged(boolean uploadDiscouraged) {389 if (uploadPolicy != UploadPolicy.BLOCKED) {390 this.uploadPolicy = uploadDiscouraged ? UploadPolicy.DISCOURAGED : UploadPolicy.NORMAL;391 }392 356 } 393 357 … … 676 640 } 677 641 678 /** 679 * Notifies all registered {@link SelectionChangedListener} about the current selection in 680 * this dataset. 681 * @deprecated You should never need to do this from the outside. 682 */ 683 @Deprecated 684 public void fireSelectionChanged() { 685 fireDeprecatedSelectionChange(getAllSelected()); 686 } 687 688 private static void fireDeprecatedSelectionChange(Collection<? extends OsmPrimitive> currentSelection) { 642 private static void fireSelectionChange(Collection<? extends OsmPrimitive> currentSelection) { 689 643 for (SelectionChangedListener l : selListeners) { 690 644 l.selectionChanged(currentSelection); … … 827 781 highlightedWaySegments = waySegments; 828 782 fireHighlightingChanged(); 829 }830 831 /**832 * Sets the current selection to the primitives in <code>selection</code>.833 * Notifies all {@link SelectionChangedListener} if <code>fireSelectionChangeEvent</code> is true.834 *835 * @param selection the selection836 * @param fireSelectionChangeEvent true, if the selection change listeners are to be notified; false, otherwise837 * @deprecated Use {@link #setSelected(Collection)} instead. To be removed end of 2017. Does not seem to be used by plugins.838 */839 @Deprecated840 public void setSelected(Collection<? extends PrimitiveId> selection, boolean fireSelectionChangeEvent) {841 setSelected(selection);842 783 } 843 784 -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r13012 r13173 93 93 * Uses the {@link Main#getProjection() global projection} to project the lat/lon-coordinates. 94 94 * <p> 95 * Method {@link org.openstreetmap.josm.data.coor.ILatLon#getEastNorth()} of96 * implemented interface <code>ILatLon</code> is deprecated, but this method is not.97 95 * @return the east north coordinates or {@code null} if {@link #isLatLonKnown()} 98 96 * is false. 99 97 */ 100 @SuppressWarnings("deprecation")101 @Override102 98 public EastNorth getEastNorth() { 103 99 return getEastNorth(Main.getProjection()); … … 223 219 } 224 220 225 /**226 * @deprecated no longer supported227 */228 @Override229 @Deprecated230 public void accept(org.openstreetmap.josm.data.osm.visitor.Visitor visitor) {231 visitor.visit(this);232 }233 234 221 @Override 235 222 public void accept(OsmPrimitiveVisitor visitor) { -
trunk/src/org/openstreetmap/josm/data/osm/NodeData.java
r12778 r13173 75 75 } 76 76 77 /**78 * @deprecated use {@link #getEastNorth(org.openstreetmap.josm.data.projection.Projecting)}79 */80 @Override81 @Deprecated82 public EastNorth getEastNorth() {83 // No internal caching of projected coordinates needed. In contrast to getEastNorth()84 // on Node, this method is rarely used. Caching would be overkill.85 return Main.getProjection().latlon2eastNorth(getCoor());86 }87 88 77 @Override 89 78 public void setEastNorth(EastNorth eastNorth) { -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r13070 r13173 1024 1024 1025 1025 /** 1026 * <p>Visits {@code org.openstreetmap.josm.data.osm.visitor.Visitor} for all referrers.</p>1027 *1028 * @param visitor the visitor. Ignored, if null.1029 * @deprecated use {@link #visitReferrers(OsmPrimitiveVisitor)}1030 */1031 @Deprecated1032 public void visitReferrers(org.openstreetmap.josm.data.osm.visitor.Visitor visitor) {1033 visitReferrers((OsmPrimitiveVisitor) visitor);1034 }1035 1036 /**1037 1026 * <p>Visits {@code visitor} for all referrers.</p> 1038 1027 * … … 1090 1079 * visitor function. 1091 1080 * @param visitor The visitor from which the visit() function must be called. 1092 * @deprecated will be removed along with {@link org.openstreetmap.josm.data.osm.visitor.Visitor}1093 */1094 @Deprecated1095 public abstract void accept(org.openstreetmap.josm.data.osm.visitor.Visitor visitor);1096 1097 /**1098 * Implementation of the visitor scheme. Subclasses have to call the correct1099 * visitor function.1100 * @param visitor The visitor from which the visit() function must be called.1101 1081 * @since 12809 1102 1082 */ -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r12846 r13173 174 174 public OsmPrimitiveType getMemberType(int idx) { 175 175 return members[idx].getType(); 176 }177 178 /**179 * @deprecated no longer supported180 */181 @Override182 @Deprecated183 public void accept(org.openstreetmap.josm.data.osm.visitor.Visitor visitor) {184 visitor.visit(this);185 176 } 186 177 -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r13033 r13173 205 205 } 206 206 return chunkSet; 207 }208 209 /**210 * @deprecated no longer supported211 */212 @Deprecated213 @Override public void accept(org.openstreetmap.josm.data.osm.visitor.Visitor visitor) {214 visitor.visit(this);215 207 } 216 208 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r13150 r13173 472 472 * be replaced by plain fill, when it covers a certain fraction of the total area 473 473 * @param disabled If this should be drawn with a special disabled style. 474 * @param text Ignored. Use {@link #drawText} instead.475 * @deprecated use {@link #drawArea(Relation r, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled)}476 */477 @Deprecated478 public void drawArea(Relation r, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, TextLabel text) {479 drawArea(r, color, fillImage, extent, extentThreshold, disabled);480 }481 482 /**483 * Draws a multipolygon area.484 * @param r The multipolygon relation485 * @param color The color to fill the area with.486 * @param fillImage The image to fill the area with. Overrides color.487 * @param extent if not null, area will be filled partially; specifies, how488 * far to fill from the boundary towards the center of the area;489 * if null, area will be filled completely490 * @param extentThreshold if not null, determines if the partial filled should491 * be replaced by plain fill, when it covers a certain fraction of the total area492 * @param disabled If this should be drawn with a special disabled style.493 474 * @since 12285 494 475 */ … … 516 497 } 517 498 } 518 }519 520 /**521 * Draws an area defined by a way. They way does not need to be closed, but it should.522 * @param w The way.523 * @param color The color to fill the area with.524 * @param fillImage The image to fill the area with. Overrides color.525 * @param extent if not null, area will be filled partially; specifies, how526 * far to fill from the boundary towards the center of the area;527 * if null, area will be filled completely528 * @param extentThreshold if not null, determines if the partial filled should529 * be replaced by plain fill, when it covers a certain fraction of the total area530 * @param disabled If this should be drawn with a special disabled style.531 * @param text Ignored. Use {@link #drawText} instead.532 * @deprecated use {@link #drawArea(Way w, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled)}533 */534 @Deprecated535 public void drawArea(Way w, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, TextLabel text) {536 drawArea(w, color, fillImage, extent, extentThreshold, disabled);537 499 } 538 500 -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r12868 r13173 210 210 * @param code unique code for this projection - may be null 211 211 * @param pref the string that defines the custom projection 212 * @param cacheDir cache directory name213 * @deprecated unused - remove in 2017-09214 */215 @Deprecated216 public CustomProjection(String name, String code, String pref, String cacheDir) {217 this(name, code, pref);218 }219 220 /**221 * Constructs a new {@code CustomProjection} with given name, code and parameters.222 *223 * @param name describe projection in one or two words224 * @param code unique code for this projection - may be null225 * @param pref the string that defines the custom projection226 212 */ 227 213 public CustomProjection(String name, String code, String pref) { … … 693 679 } 694 680 695 /**696 * {@inheritDoc}697 * @deprecated unused - remove in 2017-09698 */699 @Override700 @Deprecated701 public String getCacheDirectoryName() {702 if (cacheDir != null) {703 return cacheDir;704 } else {705 return "proj-" + Utils.md5Hex(pref == null ? "" : pref).substring(0, 4);706 }707 }708 709 681 @Override 710 682 public Bounds getWorldBoundsLatLon() { -
trunk/src/org/openstreetmap/josm/data/projection/Projection.java
r12818 r13173 52 52 */ 53 53 String toCode(); 54 55 /**56 * Get a filename compatible string (for the cache directory).57 * @return the cache directory name (base name)58 * @deprecated unused - remove in 2017-0759 */60 @Deprecated61 String getCacheDirectoryName();62 54 63 55 /** -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r12786 r13173 18 18 import java.util.regex.Pattern; 19 19 20 import org.openstreetmap.josm.Main;21 import org.openstreetmap.josm.data.coor.EastNorth;22 import org.openstreetmap.josm.data.coor.ILatLon;23 import org.openstreetmap.josm.data.coor.LatLon;24 20 import org.openstreetmap.josm.data.projection.datum.Datum; 25 21 import org.openstreetmap.josm.data.projection.datum.GRS80Datum; … … 181 177 182 178 /** 183 * Convert from lat/lon to easting/northing using the current projection.184 *185 * @param ll the geographical point to convert (in WGS84 lat/lon)186 * @return the corresponding east/north coordinates187 * @since 12725188 * @deprecated use <code>Main.getProjection().latlon2eastNorth(ll)</code>189 */190 @Deprecated191 public static EastNorth project(ILatLon ll) {192 if (ll == null) return null;193 return Main.getProjection().latlon2eastNorth(ll);194 }195 196 /**197 * Convert from lat/lon to easting/northing using the current projection.198 *199 * @param ll the geographical point to convert (in WGS84 lat/lon)200 * @return the corresponding east/north coordinates201 * @deprecated use <code>Main.getProjection().latlon2eastNorth(ll)</code>202 */203 @Deprecated204 public static EastNorth project(LatLon ll) {205 return project((ILatLon) ll);206 }207 208 /**209 * Convert from easting/norting to lat/lon using the current projection.210 *211 * @param en the geographical point to convert (in projected coordinates)212 * @return the corresponding lat/lon (WGS84)213 * @deprecated use <code>Main.getProjection().eastNorth2latlon(en)</code>214 */215 @Deprecated216 public static LatLon inverseProject(EastNorth en) {217 if (en == null) return null;218 return Main.getProjection().eastNorth2latlon(en);219 }220 221 /**222 179 * Plugins can register additional base projections. 223 180 * -
trunk/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionItem.java
r13121 r13173 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.tagging.ac; 3 4 import org.openstreetmap.josm.tools.CheckParameterUtil;5 3 6 4 /** … … 75 73 } 76 74 77 /**78 * sets the value79 * @param value the value; must not be null80 * @throws IllegalArgumentException if value if null81 * @deprecated value is now final, set it when constructing the object82 */83 @Deprecated84 public void setValue(String value) {85 CheckParameterUtil.ensureParameterNotNull(value, "value");86 throw new UnsupportedOperationException("setValue() is no longer supported");87 }88 89 75 @Override 90 76 public String toString() { -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r13025 r13173 476 476 if (mainFrame != null) { 477 477 mainPanel = mainFrame.getPanel(); 478 panel = mainPanel;479 478 mainFrame.initialize(); 480 479 menu = mainFrame.getMenu(); 481 super.menu = menu;482 480 } else { 483 481 // required for running some tests. 484 482 mainPanel = new MainPanel(layerManager); 485 panel = mainPanel;486 483 menu = new MainMenu(); 487 super.menu = menu;488 484 } 489 485 mainPanel.addMapFrameListener((o, n) -> redoUndoListener.commandChanged(0, 0)); … … 1026 1022 setupUIManager(); 1027 1023 toolbar = new ToolbarPreferences(); 1028 Main.toolbar = toolbar;1029 1024 ProjectionPreference.setProjection(); 1030 1025 setupNadGridSources(); … … 1051 1046 mainFrame.setMaximized(true); 1052 1047 } 1053 if (m ain.menu.fullscreenToggleAction != null) {1054 m ain.menu.fullscreenToggleAction.initial();1048 if (menu.fullscreenToggleAction != null) { 1049 menu.fullscreenToggleAction.initial(); 1055 1050 } 1056 1051 -
trunk/src/org/openstreetmap/josm/gui/MainPanel.java
r12675 r13173 8 8 import javax.swing.JPanel; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.actions.mapmode.MapMode; 12 11 import org.openstreetmap.josm.gui.layer.Layer; … … 66 65 } else { 67 66 map = null; 68 Main.map = map;69 67 MainApplication.map = map; 70 68 add(getGettingStarted(), BorderLayout.CENTER); … … 90 88 MapFrame mapFrame = new MapFrame(null); 91 89 // Required by many components. 92 Main.map = mapFrame;93 90 MainApplication.map = mapFrame; 94 91 -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r13154 r13173 35 35 import javax.swing.AbstractButton; 36 36 import javax.swing.JComponent; 37 import javax.swing.JPanel;38 37 import javax.swing.SwingUtilities; 39 38 … … 255 254 * Constructs a new {@code MapView}. 256 255 * @param layerManager The layers to display. 257 * @param contentPane Ignored. Main content pane is used.258 * @param viewportData the initial viewport of the map. Can be null, then259 * the viewport is derived from the layer data.260 * @since 10279261 * @deprecated use {@link #MapView(MainLayerManager, ViewportData)} instead262 */263 @Deprecated264 public MapView(MainLayerManager layerManager, final JPanel contentPane, final ViewportData viewportData) {265 this(layerManager, viewportData);266 }267 268 /**269 * Constructs a new {@code MapView}.270 * @param layerManager The layers to display.271 256 * @param viewportData the initial viewport of the map. Can be null, then 272 257 * the viewport is derived from the layer data. -
trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
r12881 r13173 45 45 import org.openstreetmap.josm.data.PreferencesUtils; 46 46 import org.openstreetmap.josm.data.Version; 47 import org.openstreetmap.josm.spi.preferences.Setting;48 47 import org.openstreetmap.josm.gui.MainApplication; 49 48 import org.openstreetmap.josm.plugins.PluginDownloadTask; … … 51 50 import org.openstreetmap.josm.plugins.ReadLocalPluginInformationTask; 52 51 import org.openstreetmap.josm.spi.preferences.Config; 52 import org.openstreetmap.josm.spi.preferences.Setting; 53 53 import org.openstreetmap.josm.tools.LanguageInfo; 54 54 import org.openstreetmap.josm.tools.Logging; … … 69 69 private CustomConfigurator() { 70 70 // Hide default constructor for utils classes 71 }72 73 /**74 * Log a formatted message.75 * @param fmt format76 * @param vars arguments77 * @see String#format78 * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#log(String, Object...)} instead79 */80 @Deprecated81 public static void log(String fmt, Object... vars) {82 PreferencesUtils.log(fmt, vars);83 }84 85 /**86 * Log a message.87 * @param s message to log88 * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#log(String)} instead89 */90 @Deprecated91 public static void log(String s) {92 PreferencesUtils.log(s);93 }94 95 /**96 * Log an exception.97 * @param e exception to log98 * @param s message prefix99 * @since 10469100 * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#log(Exception, String)} instead101 */102 @Deprecated103 public static void log(Exception e, String s) {104 PreferencesUtils.log(e, s);105 }106 107 /**108 * Returns the log.109 * @return the log110 * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#getLog()} instead111 */112 @Deprecated113 public static String getLog() {114 return PreferencesUtils.getLog();115 }116 117 /**118 * Resets the log.119 * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#resetLog()} instead120 */121 @Deprecated122 public static void resetLog() {123 PreferencesUtils.resetLog();124 71 } 125 72 -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r13130 r13173 502 502 503 503 /** 504 * Check changed status of layer505 *506 * @return True if layer was changed since last paint507 * @deprecated This is not supported by multiple map views.508 * Fire an {@link #invalidate()} to trigger a repaint.509 */510 @Deprecated511 public boolean isChanged() {512 return false;513 }514 515 /**516 504 * allows to check whether a projection is supported or not 517 505 * @param proj projection -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r12881 r13173 23 23 import javax.swing.ImageIcon; 24 24 25 import org.openstreetmap.josm.Main;26 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;27 25 import org.openstreetmap.josm.data.coor.CachedLatLon; 28 26 import org.openstreetmap.josm.data.coor.EastNorth; … … 35 33 import org.openstreetmap.josm.data.preferences.IntegerProperty; 36 34 import org.openstreetmap.josm.gui.MapView; 35 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent; 37 36 import org.openstreetmap.josm.tools.ImageProvider; 38 37 import org.openstreetmap.josm.tools.Logging; … … 336 335 337 336 /** 338 * Returns the marker's projected coordinates.339 * @return The marker's projected coordinates (easting/northing)340 * @deprecated use {@link #getEastNorth(org.openstreetmap.josm.data.projection.Projecting)}341 */342 @Deprecated343 public final EastNorth getEastNorth() {344 return coor.getEastNorth(Main.getProjection());345 }346 347 /**348 337 * Checks whether the marker display area contains the given point. 349 338 * Markers not interested in mouse clicks may always return false. -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
r12846 r13173 48 48 * <p> 49 49 * Public access is discouraged. 50 * @see StyledMapRenderer#drawArea (Way, Color, MapImage, Float, Float, boolean, TextLabel)50 * @see StyledMapRenderer#drawArea 51 51 */ 52 52 public Float extent; … … 56 56 * <p> 57 57 * Public access is discouraged. 58 * @see StyledMapRenderer#drawArea (Way, Color, MapImage, Float, Float, boolean, TextLabel)58 * @see StyledMapRenderer#drawArea 59 59 */ 60 60 public Float extentThreshold; -
trunk/src/org/openstreetmap/josm/gui/oauth/AbstractAuthorizationUI.java
r12928 r13173 4 4 import java.util.Objects; 5 5 6 import org.openstreetmap.josm.data.Preferences;7 6 import org.openstreetmap.josm.data.oauth.OAuthParameters; 8 7 import org.openstreetmap.josm.data.oauth.OAuthToken; … … 139 138 pnlAdvancedProperties.initialize(paramApiUrl); 140 139 } 141 142 /**143 * Initializes the authorisation UI with preference values in <code>pref</code>.144 *145 * @param pref the preferences. Must not be null.146 * @throws IllegalArgumentException if pref is null147 * @deprecated (since 12928) replaced by {@link #initialize(java.lang.String)}148 */149 @Deprecated150 public void initFromPreferences(Preferences pref) {151 CheckParameterUtil.ensureParameterNotNull(pref, "pref");152 pnlAdvancedProperties.initFromPreferences(pref);153 }154 140 } -
trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java
r12928 r13173 16 16 import javax.swing.JOptionPane; 17 17 18 import org.openstreetmap.josm.data.Preferences;19 18 import org.openstreetmap.josm.data.oauth.OAuthParameters; 20 19 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 275 274 276 275 /** 277 * Initializes the panel from the values in the preferences <code>preferences</code>.278 *279 * @param pref the preferences. Must not be null.280 * @throws IllegalArgumentException if pref is null281 * @deprecated (since 12928) replaced by {@link #initialize(java.lang.String)}282 */283 @Deprecated284 public void initFromPreferences(Preferences pref) {285 CheckParameterUtil.ensureParameterNotNull(pref, "pref");286 setApiUrl(pref.get("osm-server.url"));287 boolean useDefault = pref.getBoolean("oauth.settings.use-default", true);288 ilUseDefault.setEnabled(false);289 if (useDefault) {290 resetToDefaultSettings();291 } else {292 setAdvancedParameters(OAuthParameters.createFromPreferences(pref));293 }294 ilUseDefault.setEnabled(true);295 }296 297 /**298 276 * Remembers the current values in the preferences <code>pref</code>. 299 277 */ … … 304 282 } else { 305 283 getAdvancedParameters().rememberPreferences(); 306 }307 }308 309 /**310 * Remembers the current values in the preferences <code>pref</code>.311 *312 * @param pref the preferences. Must not be null.313 * @throws IllegalArgumentException if pref is null.314 * @deprecated (since 12928) replaced by {@link #rememberPreferences()}315 */316 @Deprecated317 public void rememberPreferences(Preferences pref) {318 CheckParameterUtil.ensureParameterNotNull(pref, "pref");319 pref.putBoolean("oauth.settings.use-default", cbUseDefaults.isSelected());320 if (cbUseDefaults.isSelected()) {321 new OAuthParameters(null, null, null, null, null, null, null).rememberPreferences(pref);322 } else {323 getAdvancedParameters().rememberPreferences(pref);324 284 } 325 285 } -
trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java
r12928 r13173 29 29 import javax.swing.text.html.HTMLEditorKit; 30 30 31 import org.openstreetmap.josm.data.Preferences;32 31 import org.openstreetmap.josm.data.oauth.OAuthToken; 33 32 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 174 173 public void initialize(String paramApiUrl) { 175 174 super.initialize(paramApiUrl); 176 CredentialsAgent cm = CredentialsManager.getInstance();177 try {178 PasswordAuthentication pa = cm.lookup(RequestorType.SERVER, OsmApi.getOsmApi().getHost());179 if (pa == null) {180 tfUserName.setText("");181 tfPassword.setText("");182 } else {183 tfUserName.setText(pa.getUserName() == null ? "" : pa.getUserName());184 tfPassword.setText(pa.getPassword() == null ? "" : String.valueOf(pa.getPassword()));185 }186 } catch (CredentialsAgentException e) {187 Logging.error(e);188 tfUserName.setText("");189 tfPassword.setText("");190 }191 }192 193 /**194 * Initializes the panel with values from the preferences195 * @param pref Preferences structure196 * @deprecated (since 12928) replaced by {@link #initialize(java.lang.String)}197 */198 @Deprecated199 @Override200 public void initFromPreferences(Preferences pref) {201 super.initFromPreferences(pref);202 175 CredentialsAgent cm = CredentialsManager.getInstance(); 203 176 try { -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/AbstractProjectionChoice.java
r12293 r13173 51 51 } 52 52 53 /**54 * Get the cache directory name.55 * @return the cache directory name (base name)56 * @deprecated unused - remove in 2017-0957 */58 @Deprecated59 public String getCacheDir() {60 return cacheDir;61 }62 63 53 @Override 64 54 public String toString() { -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OverpassServerPreference.java
r12816 r13173 76 76 return true; 77 77 } 78 79 /**80 * Returns the URL of the currently selected Overpass server.81 * @return the URL of the currently selected Overpass server.82 * @deprecated To be removed end of 2017. Use {@code OverpassDownloadReader.OVERPASS_SERVER.get()} instead83 */84 @Deprecated85 public static String getOverpassServer() {86 return OverpassDownloadReader.OVERPASS_SERVER.get();87 }88 89 /**90 * Returns true if objects should be fetched from an Overpass server instead of the OSM API.91 * @return true if objects should be fetched from an Overpass server instead of the OSM API.92 * @deprecated To be removed end of 2017. Use {@code OverpassDownloadReader.FOR_MULTI_FETCH.get()} instead93 */94 @Deprecated95 public static boolean useForMultiFetch() {96 return OverpassDownloadReader.FOR_MULTI_FETCH.get();97 }98 78 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
r13139 r13173 10 10 import java.util.Collection; 11 11 import java.util.Locale; 12 import java.util.stream.Collectors;13 12 14 13 import javax.swing.ComboBoxEditor; … … 254 253 } else if (item instanceof AutoCompletionItem) { 255 254 cbEditor.setItem(((AutoCompletionItem) item).getValue()); 256 } else if (item instanceof AutoCompletionListItem) {257 cbEditor.setItem(((AutoCompletionListItem) item).getItem().getValue());258 255 } else 259 256 throw new IllegalArgumentException("Unsupported item: "+item); … … 271 268 } else if (item instanceof AutoCompletionItem) { 272 269 super.setSelectedItem(item); 273 } else if (item instanceof AutoCompletionListItem) {274 super.setSelectedItem(((AutoCompletionListItem) item).getItem());275 270 } else if (item instanceof String) { 276 271 String s = (String) item; … … 304 299 this.getEditor().setItem(oldValue); // Do not use setSelectedItem(oldValue); (fix #8013) 305 300 autocompleteEnabled = true; 306 }307 308 /**309 * Sets the items of the combobox to the given {@code AutoCompletionListItem}s.310 * @param elems AutoCompletionListItem items311 * @deprecated to be removed end of 2017. Use {@link #setPossibleAcItems(Collection)} instead312 */313 @Deprecated314 public void setPossibleACItems(Collection<AutoCompletionListItem> elems) {315 setPossibleAcItems(elems.stream().map(AutoCompletionListItem::getItem).collect(Collectors.toList()));316 301 } 317 302 -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java
r13170 r13173 20 20 import javax.swing.text.StyleConstants; 21 21 22 import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem; 22 23 import org.openstreetmap.josm.gui.util.CellEditorSupport; 23 24 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 29 30 * can be used as table cell editor in {@link JTable}s. 30 31 * 31 * Autocompletion is controlled by a list of {@link AutoCompletion ListItem}s32 * Autocompletion is controlled by a list of {@link AutoCompletionItem}s 32 33 * managed in a {@link AutoCompletionList}. 33 34 * -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java
r12859 r13173 5 5 import java.util.Collection; 6 6 import java.util.Collections; 7 import java.util.List;8 7 import java.util.Set; 9 import java.util.stream.Collectors;10 8 11 9 import javax.swing.JTable; … … 51 49 52 50 /** 53 * applies a filter expression to the list of {@link AutoCompletion ListItem}s.51 * applies a filter expression to the list of {@link AutoCompletionItem}s. 54 52 * 55 53 * The matching criterion is a case insensitive substring match. … … 81 79 82 80 /** 83 * adds an {@link AutoCompletionListItem} to the list. Only adds the item if it84 * is not null and if not in the list yet.85 *86 * @param item the item87 * @deprecated To be removed end of 2017. Use {@link #add(AutoCompletionItem)} instead88 */89 @Deprecated90 public void add(AutoCompletionListItem item) {91 if (item == null)92 return;93 add(item.getItem());94 }95 96 /**97 81 * adds an {@link AutoCompletionItem} to the list. Only adds the item if it 98 82 * is not null and if not in the list yet. … … 135 119 136 120 /** 137 * adds a list of {@link AutoCompletionListItem} to this list. Only items which138 * are not null and which do not exist yet in the list are added.139 *140 * @param other a list of AutoCompletionListItem; must not be null141 * @throws IllegalArgumentException if other is null142 * @deprecated to be removed end of 2017. Use {@link #add(Collection)} instead143 */144 @Deprecated145 public void add(List<AutoCompletionListItem> other) {146 CheckParameterUtil.ensureParameterNotNull(other, "other");147 add(other.stream().map(AutoCompletionListItem::getItem).collect(Collectors.toList()));148 }149 150 /**151 121 * adds a list of strings to this list. Only strings which 152 122 * are not null and which do not exist yet in the list are added. … … 154 124 * @param values a list of strings to add 155 125 * @param priority the priority to use 156 * @deprecated to be removed end of 2017. Use {@link #add(Collection, AutoCompletionPriority)} instead157 */158 @Deprecated159 public void add(Collection<String> values, AutoCompletionItemPriority priority) {160 add(values, priority.getPriority());161 }162 163 /**164 * adds a list of strings to this list. Only strings which165 * are not null and which do not exist yet in the list are added.166 *167 * @param values a list of strings to add168 * @param priority the priority to use169 126 * @since 12859 170 127 */ … … 183 140 filter(); 184 141 } 185 }186 187 /**188 * checks whether a specific item is already in the list. Matches for the189 * the value <strong>and</strong> the priority of the item190 *191 * @param item the item to check192 * @return true, if item is in the list; false, otherwise193 * @deprecated to be removed end of 2017. Use {@link #contains(AutoCompletionItem)} instead194 */195 @Deprecated196 public boolean contains(AutoCompletionListItem item) {197 if (item == null)198 return false;199 return contains(item.getItem());200 142 } 201 143 … … 264 206 * 265 207 * @throws IndexOutOfBoundsException if idx is out of bounds 266 * @deprecated to be removed end of 2017. Use {@link #getFilteredItemAt(int)} instead267 */268 @Deprecated269 public AutoCompletionListItem getFilteredItem(int idx) {270 return new AutoCompletionListItem(getFilteredItemAt(idx));271 }272 273 /**274 * replies the idx-th item from the list of filtered items275 * @param idx the index; must be in the range 0 <= idx < {@link #getFilteredSize()}276 * @return the item277 *278 * @throws IndexOutOfBoundsException if idx is out of bounds279 208 * @since 12859 280 209 */ -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r13121 r13173 245 245 /** 246 246 * replies the auto completion values allowed for a specific key. Replies 247 * an empty list if key is null or if key is not in {@link #get Keys()}.247 * an empty list if key is null or if key is not in {@link #getTagKeys()}. 248 248 * 249 249 * @param key OSM key … … 343 343 list.addUserInput(getUserInputValues(key)); 344 344 } 345 }346 347 /**348 * Returns the currently cached tag keys.349 * @return a list of tag keys350 * @deprecated to be removed end of 2017. Use {@link #getTagKeys()} instead351 */352 @Deprecated353 public List<AutoCompletionListItem> getKeys() {354 return getTagKeys().stream().map(AutoCompletionListItem::new).collect(Collectors.toList());355 }356 357 /**358 * Returns the currently cached tag values for a given tag key.359 * @param key the tag key360 * @return a list of tag values361 * @deprecated to be removed end of 2017. Use {@link #getTagValues(String)} instead362 */363 @Deprecated364 public List<AutoCompletionListItem> getValues(String key) {365 return getTagValues(key).stream().map(AutoCompletionListItem::new).collect(Collectors.toList());366 }367 368 /**369 * Returns the currently cached tag values for a given list of tag keys.370 * @param keys the tag keys371 * @return a list of tag values372 * @deprecated to be removed end of 2017. Use {@link #getTagValues(List)} instead373 */374 @Deprecated375 public List<AutoCompletionListItem> getValues(List<String> keys) {376 return getTagValues(keys).stream().map(AutoCompletionListItem::new).collect(Collectors.toList());377 345 } 378 346 -
trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java
r12620 r13173 36 36 37 37 private final List<KeyPressReleaseListener> keyListeners = new CopyOnWriteArrayList<>(); 38 /** @deprecated replaced by {@link #modifierExListeners} */39 @Deprecated40 private final List<ModifierListener> modifierListeners = new CopyOnWriteArrayList<>();41 38 private final ListenerList<ModifierExListener> modifierExListeners = ListenerList.create(); 42 /** @deprecated replaced by {@link #previousModifiersEx} */43 @Deprecated44 private int previousModifiers;45 39 private int previousModifiersEx; 46 40 … … 53 47 public void addKeyListener(KeyPressReleaseListener l) { 54 48 keyListeners.add(l); 55 }56 57 /**58 * Adds an object that wants to receive key modifier changed events.59 * @param l listener to add60 * @deprecated use {@link #addModifierExListener} instead61 */62 @Deprecated63 public void addModifierListener(ModifierListener l) {64 modifierListeners.add(l);65 49 } 66 50 … … 80 64 public void removeKeyListener(KeyPressReleaseListener l) { 81 65 keyListeners.remove(l); 82 }83 84 /**85 * Removes the key modifier listener.86 * @param l listener to remove87 * @deprecated use {@link #removeModifierExListener} instead88 */89 @Deprecated90 public void removeModifierListener(ModifierListener l) {91 modifierListeners.remove(l);92 66 } 93 67 … … 131 105 if (!keyListeners.isEmpty()) { 132 106 Logging.warn(tr("Some of the key listeners forgot to remove themselves: {0}"), keyListeners.toString()); 133 }134 if (!modifierListeners.isEmpty()) {135 Logging.warn(tr("Some of the key modifier listeners forgot to remove themselves: {0}"), modifierListeners.toString());136 107 } 137 108 if (modifierExListeners.hasListeners()) { … … 183 154 KeyEvent ke = (KeyEvent) e; 184 155 185 // check if ctrl, alt, shift modifiers are changed186 int modif = ke.getModifiers();187 if (previousModifiers != modif) {188 previousModifiers = modif;189 for (ModifierListener m: modifierListeners) {190 m.modifiersChanged(modif);191 }192 }193 194 156 // check if ctrl, alt, shift extended modifiers are changed 195 157 int modifEx = ke.getModifiersEx(); -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r12748 r13173 21 21 import java.awt.Window; 22 22 import java.awt.event.ActionListener; 23 import java.awt.event.KeyEvent;24 23 import java.awt.event.MouseAdapter; 25 24 import java.awt.event.MouseEvent; … … 66 65 import org.openstreetmap.josm.tools.LanguageInfo; 67 66 import org.openstreetmap.josm.tools.Logging; 68 import org.openstreetmap.josm.tools.PlatformHook;69 67 import org.openstreetmap.josm.tools.bugreport.BugReport; 70 68 import org.openstreetmap.josm.tools.bugreport.ReportedException; … … 462 460 463 461 /** 464 * Returns extended modifier key used as the appropriate accelerator key for menu shortcuts.465 * It is advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but:466 * <ul>467 * <li>it returns KeyEvent.CTRL_MASK instead of KeyEvent.CTRL_DOWN_MASK. We used the extended468 * modifier for years, and Oracle recommends to use it instead, so it's best to keep it</li>469 * <li>the method throws a HeadlessException ! So we would need to handle it for unit tests anyway</li>470 * </ul>471 * @return extended modifier key used as the appropriate accelerator key for menu shortcuts472 * @since 7539473 * @deprecated to be removed end of 2017. Use {@link PlatformHook#getMenuShortcutKeyMaskEx()} instead474 */475 @Deprecated476 public static int getMenuShortcutKeyMaskEx() {477 return Main.isPlatformOsx() ? KeyEvent.META_DOWN_MASK : KeyEvent.CTRL_DOWN_MASK;478 }479 480 /**481 462 * Sets a global font for all UI, replacing default font of current look and feel. 482 463 * @param name Font name. It is up to the caller to make sure the font exists -
trunk/src/org/openstreetmap/josm/io/FileWatcher.java
r12827 r13173 20 20 import org.openstreetmap.josm.data.preferences.sources.SourceEntry; 21 21 import org.openstreetmap.josm.data.preferences.sources.SourceType; 22 import org.openstreetmap.josm.gui.mappaint.StyleSource;23 22 import org.openstreetmap.josm.tools.CheckParameterUtil; 24 23 import org.openstreetmap.josm.tools.Logging; … … 55 54 thread.start(); 56 55 } 57 }58 59 /**60 * Registers a map paint style for local file changes, allowing dynamic reloading.61 * @param style The style to watch62 * @throws IllegalArgumentException if {@code style} is null or if it does not provide a local file63 * @throws IllegalStateException if the watcher service failed to start64 * @throws IOException if an I/O error occurs65 * @deprecated To be removed end of 2017. Use {@link #registerSource} instead66 */67 @Deprecated68 public void registerStyleSource(StyleSource style) throws IOException {69 registerSource(style);70 }71 72 /**73 * Registers a validator rule for local file changes, allowing dynamic reloading.74 * @param rule The rule to watch75 * @throws IllegalArgumentException if {@code rule} is null or if it does not provide a local file76 * @throws IllegalStateException if the watcher service failed to start77 * @throws IOException if an I/O error occurs78 * @since 727679 * @deprecated To be removed end of 2017. Use {@link #registerSource} instead80 */81 @Deprecated82 public void registerValidatorRule(SourceEntry rule) throws IOException {83 registerSource(rule);84 56 } 85 57 -
trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java
r12816 r13173 31 31 import org.openstreetmap.josm.data.projection.Projection; 32 32 import org.openstreetmap.josm.data.projection.Projections; 33 import org.openstreetmap.josm.gui.layer.OsmDataLayer;34 33 import org.openstreetmap.josm.gui.mappaint.ElemStyles; 35 34 import org.openstreetmap.josm.tools.Logging; … … 46 45 private final Projection projection; 47 46 private static final boolean SKIP_EMPTY_NODES = true; 48 49 /**50 * Constructs a new {@code GeoJSONWriter}.51 * @param layer The OSM data layer to save52 * @since 1085253 * @deprecated To be removed end of 2017. Use {@link #GeoJSONWriter(DataSet)} instead54 */55 @Deprecated56 public GeoJSONWriter(OsmDataLayer layer) {57 this(layer.data);58 }59 47 60 48 /** -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r12802 r13173 29 29 import org.openstreetmap.josm.data.osm.Way; 30 30 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 31 import org.openstreetmap.josm.gui.layer.OsmDataLayer;32 31 import org.openstreetmap.josm.tools.date.DateUtils; 33 32 … … 128 127 result.sort(byIdComparator); 129 128 return result; 130 }131 132 /**133 * Writes the full OSM file for the given layer (header, data sources, osm data, footer).134 * @param layer OSM data layer135 * @deprecated To be removed end of 2017. Use {@link #write(DataSet)} instead136 */137 @Deprecated138 public void writeLayer(OsmDataLayer layer) {139 write(layer.data);140 129 } 141 130 -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r12925 r13173 717 717 718 718 /** 719 * Method to get the (now obsolete) class loader for loading plugin code.720 *721 * @return the class loader722 * @deprecated There is no longer a unified plugin class loader. Use {@link PluginProxy#classLoader}723 * to get the class loader for each plugin. Or <code>PluginClass.class.getClassLoader()</code>724 * to access the class loader from within the plugin.725 */726 @Deprecated727 public static synchronized DynamicURLClassLoader getPluginClassLoader() {728 return getJoinedPluginResourceCL();729 }730 731 /**732 719 * Get class loader to locate resources from plugins. 733 720 * -
trunk/src/org/openstreetmap/josm/tools/CheckParameterUtil.java
r12822 r13173 5 5 import java.util.function.Predicate; 6 6 import java.util.function.Supplier; 7 8 import org.openstreetmap.josm.data.coor.EastNorth;9 import org.openstreetmap.josm.data.coor.LatLon;10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;11 import org.openstreetmap.josm.data.osm.PrimitiveId;12 7 13 8 /** … … 65 60 66 61 /** 67 * Ensures an OSM primitive ID is valid68 * @param id The id to check69 * @param parameterName The parameter name70 * @throws IllegalArgumentException if the primitive ID is not valid (negative or zero)71 * @deprecated use {@link #ensure(Object, String, String, Predicate)}72 */73 @Deprecated74 public static void ensureValidPrimitiveId(PrimitiveId id, String parameterName) {75 ensureParameterNotNull(id, parameterName);76 if (id.getUniqueId() <= 0)77 throw new IllegalArgumentException(78 MessageFormat.format("Expected unique id > 0 for primitive ''{1}'', got {0}", id.getUniqueId(), parameterName));79 }80 81 /**82 * Ensures lat/lon coordinates are valid83 * @param latlon The lat/lon to check84 * @param parameterName The parameter name85 * @throws IllegalArgumentException if the lat/lon are {@code null} or not valid86 * @since 598087 * @deprecated use {@link #ensure(Object, String, Predicate)}88 */89 @Deprecated90 public static void ensureValidCoordinates(LatLon latlon, String parameterName) {91 ensureParameterNotNull(latlon, parameterName);92 if (!latlon.isValid())93 throw new IllegalArgumentException(94 MessageFormat.format("Expected valid lat/lon for parameter ''{0}'', got {1}", parameterName, latlon));95 }96 97 /**98 * Ensures east/north coordinates are valid99 * @param eastnorth The east/north to check100 * @param parameterName The parameter name101 * @throws IllegalArgumentException if the east/north are {@code null} or not valid102 * @since 5980103 * @deprecated use {@link #ensure(Object, String, Predicate)}104 */105 @Deprecated106 public static void ensureValidCoordinates(EastNorth eastnorth, String parameterName) {107 ensureParameterNotNull(eastnorth, parameterName);108 if (!eastnorth.isValid())109 throw new IllegalArgumentException(110 MessageFormat.format("Expected valid east/north for parameter ''{0}'', got {1}", parameterName, eastnorth));111 }112 113 /**114 * Ensures a version number is valid115 * @param version The version to check116 * @param parameterName The parameter name117 * @throws IllegalArgumentException if the version is not valid (negative)118 * @deprecated use {@link #ensure(Object, String, String, Predicate)}119 */120 @Deprecated121 public static void ensureValidVersion(long version, String parameterName) {122 if (version < 0)123 throw new IllegalArgumentException(124 MessageFormat.format("Expected value of type long > 0 for parameter ''{0}'', got {1}", parameterName, version));125 }126 127 /**128 62 * Ensures a parameter is not {@code null} 129 63 * @param value The parameter to check … … 174 108 throw new IllegalArgumentException(messageSupplier.get()); 175 109 } 176 177 /**178 * Ensures that <code>id</code> is non-null primitive id of type {@link OsmPrimitiveType#NODE}179 *180 * @param id the primitive id181 * @param parameterName the name of the parameter to be checked182 * @throws IllegalArgumentException if id is null183 * @throws IllegalArgumentException if id.getType() != NODE184 * @deprecated use {@link #ensure(Object, String, String, Predicate)}185 */186 @Deprecated187 public static void ensureValidNodeId(PrimitiveId id, String parameterName) {188 ensureParameterNotNull(id, parameterName);189 if (!id.getType().equals(OsmPrimitiveType.NODE))190 throw new IllegalArgumentException(191 MessageFormat.format("Parameter ''{0}'' of type node expected, got ''{1}''", parameterName, id.getType().getAPIName()));192 }193 110 } -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r12987 r13173 59 59 import java.util.regex.Pattern; 60 60 import java.util.stream.Stream; 61 import java.util.zip.GZIPInputStream;62 61 import java.util.zip.ZipFile; 63 import java.util.zip.ZipInputStream;64 62 65 63 import javax.xml.XMLConstants; … … 70 68 import javax.xml.parsers.SAXParserFactory; 71 69 72 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;73 import org.openstreetmap.josm.io.Compression;74 70 import org.openstreetmap.josm.spi.preferences.Config; 75 71 import org.w3c.dom.Document; … … 721 717 } 722 718 }; 723 }724 725 /**726 * Returns a Bzip2 input stream wrapping given input stream.727 * @param in The raw input stream728 * @return a Bzip2 input stream wrapping given input stream, or {@code null} if {@code in} is {@code null}729 * @throws IOException if the given input stream does not contain valid BZ2 header730 * @since 7867731 * @deprecated use {@link Compression#getBZip2InputStream(java.io.InputStream)}732 */733 @Deprecated734 public static BZip2CompressorInputStream getBZip2InputStream(InputStream in) throws IOException {735 return Compression.getBZip2InputStream(in);736 }737 738 /**739 * Returns a Gzip input stream wrapping given input stream.740 * @param in The raw input stream741 * @return a Gzip input stream wrapping given input stream, or {@code null} if {@code in} is {@code null}742 * @throws IOException if an I/O error has occurred743 * @since 7119744 * @deprecated use {@link Compression#getGZipInputStream(java.io.InputStream)}745 */746 @Deprecated747 public static GZIPInputStream getGZipInputStream(InputStream in) throws IOException {748 return Compression.getGZipInputStream(in);749 }750 751 /**752 * Returns a Zip input stream wrapping given input stream.753 * @param in The raw input stream754 * @return a Zip input stream wrapping given input stream, or {@code null} if {@code in} is {@code null}755 * @throws IOException if an I/O error has occurred756 * @since 7119757 * @deprecated use {@link Compression#getZipInputStream(java.io.InputStream)}758 */759 @Deprecated760 public static ZipInputStream getZipInputStream(InputStream in) throws IOException {761 return Compression.getZipInputStream(in);762 719 } 763 720 -
trunk/src/org/openstreetmap/josm/tools/template_engine/Condition.java
r13076 r13173 28 28 public Condition() { 29 29 this.entries = new ArrayList<>(); 30 }31 32 /**33 * Returns template entries.34 * @return template entries35 * @deprecated (since 13003) use constructor {@link #Condition(java.util.Collection)} to set the entries36 */37 @Deprecated38 public List<TemplateEntry> getEntries() {39 return entries;40 30 } 41 31
Note:
See TracChangeset
for help on using the changeset viewer.