Changeset 13173 in josm for trunk/src/org


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

see #15310 - remove most of deprecated APIs

Location:
trunk/src/org/openstreetmap/josm
Files:
8 deleted
61 edited

Legend:

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

    r13023 r13173  
    99import java.lang.ref.WeakReference;
    1010import java.net.URL;
    11 import java.text.MessageFormat;
    1211import java.util.ArrayList;
    1312import java.util.Collection;
     
    2625import java.util.concurrent.Future;
    2726
    28 import javax.swing.Action;
    29 
    30 import org.openstreetmap.josm.actions.JosmAction;
    3127import org.openstreetmap.josm.data.Bounds;
    3228import org.openstreetmap.josm.data.Preferences;
     
    4137import org.openstreetmap.josm.data.projection.ProjectionChangeListener;
    4238import 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;
    4939import org.openstreetmap.josm.io.FileWatcher;
    5040import org.openstreetmap.josm.io.OnlineResource;
     
    5949import org.openstreetmap.josm.tools.PlatformHookOsx;
    6050import org.openstreetmap.josm.tools.PlatformHookWindows;
    61 import org.openstreetmap.josm.tools.Shortcut;
    6251import org.openstreetmap.josm.tools.Utils;
    6352import org.openstreetmap.josm.tools.bugreport.BugReport;
     
    8271
    8372    /**
    84      * Replies true if JOSM currently displays a map view. False, if it doesn't, i.e. if
    85      * 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 view
    90      * @deprecated use {@link org.openstreetmap.josm.gui.MainApplication#isDisplayingMapView()}
    91      */
    92     @Deprecated
    93     public static boolean isDisplayingMapView() {
    94         return MainApplication.isDisplayingMapView();
    95     }
    96 
    97     /**
    9873     * Global parent component for all dialogs and message boxes
    9974     */
     
    11994
    12095    /**
    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()} instead
    126      * @see MainPanel
    127      */
    128     @Deprecated
    129     public static MapFrame map;
    130 
    131     /**
    132      * The toolbar preference control to register new actions.
    133      * @deprecated Use {@link MainApplication#getToolbar} instead
    134      */
    135     @Deprecated
    136     public static volatile ToolbarPreferences toolbar;
    137 
    138     /**
    13996     * The commands undo/redo handler.
    14097     */
     
    14299
    143100    /**
    144      * The main menu bar at top of screen.
    145      * @deprecated Use {@link MainApplication#getMenu} instead
    146      */
    147     @Deprecated
    148     public MainMenu menu;
    149 
    150     /**
    151      * The main panel.
    152      * @deprecated Use {@link MainApplication#getMainPanel} instead
    153      * @since 12125
    154      */
    155     @Deprecated
    156     public MainPanel panel;
    157 
    158     /**
    159101     * The file watcher service.
    160102     */
     
    164106
    165107    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 6248
    170      * @deprecated Use {@link Logging} class.
    171      */
    172     @Deprecated
    173     public static int logLevel = 3;
    174 
    175     /**
    176      * Replies the first lines of last 5 error and warning messages, used for bug reports
    177      * @return the first lines of last 5 error and warning messages
    178      * @since 7420
    179      * @deprecated Use {@link Logging#getLastErrorAndWarnings}.
    180      */
    181     @Deprecated
    182     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 8959
    189      * @deprecated Use {@link Logging#clearLastErrorAndWarnings}.
    190      */
    191     @Deprecated
    192     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 6248
    200      * @deprecated Use {@link Logging#error(String)}.
    201      */
    202     @Deprecated
    203     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     @Deprecated
    213     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     @Deprecated
    223     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     @Deprecated
    233     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     @Deprecated
    243     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} otherwise
    251      * @since 6852
    252      * @deprecated Use {@link Logging#isDebugEnabled}.
    253      */
    254     @Deprecated
    255     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} otherwise
    263      * @since 6852
    264      * @deprecated Use {@link Logging#isTraceEnabled}.
    265      */
    266     @Deprecated
    267     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 6248
    277      * @deprecated Use {@link Logging#error(String, Object...)}.
    278      */
    279     @Deprecated
    280     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     @Deprecated
    292     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     @Deprecated
    304     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     @Deprecated
    316     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     @Deprecated
    328     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 error
    335      * @since 6248
    336      * @deprecated Use {@link Logging#error(Throwable)}.
    337      */
    338     @Deprecated
    339     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 error
    346      * @since 6248
    347      * @deprecated Use {@link Logging#warn(Throwable)}.
    348      */
    349     @Deprecated
    350     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 ignored
    356      * @param t The throwable object causing the error
    357      * @since 10420
    358      * @deprecated Use {@link Logging#debug(Throwable)}.
    359      */
    360     @Deprecated
    361     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 ignored
    367      * @param t The throwable object causing the error
    368      * @since 10420
    369      * @deprecated Use {@link Logging#trace(Throwable)}.
    370      */
    371     @Deprecated
    372     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 error
    379      * @param stackTrace {@code true}, if the stacktrace should be displayed
    380      * @since 6642
    381      * @deprecated Use {@link Logging#log(java.util.logging.Level, Throwable)}
    382      *              or {@link Logging#logWithStackTrace(java.util.logging.Level, Throwable)}.
    383      */
    384     @Deprecated
    385     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 error
    396      * @param message additional error message
    397      * @since 10420
    398      * @deprecated Use {@link Logging#log(java.util.logging.Level, String, Throwable)}.
    399      */
    400     @Deprecated
    401     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 error
    408      * @param stackTrace {@code true}, if the stacktrace should be displayed
    409      * @since 6642
    410      * @deprecated Use {@link Logging#log(java.util.logging.Level, Throwable)}
    411      *              or {@link Logging#logWithStackTrace(java.util.logging.Level, Throwable)}.
    412      */
    413     @Deprecated
    414     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 error
    425      * @param message additional error message
    426      * @since 10420
    427      * @deprecated Use {@link Logging#log(java.util.logging.Level, String, Throwable)}.
    428      */
    429     @Deprecated
    430     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 error
    437      * @return The human-readable error message
    438      * @since 6642
    439      * @deprecated Use {@link Logging#getErrorMessage}.
    440      */
    441     @Deprecated
    442     public static String getErrorMessage(Throwable t) {
    443         if (t == null) {
    444             return null;
    445         } else {
    446             return Logging.getErrorMessage(t);
    447         }
    448     }
    449108
    450109    /**
     
    611270
    612271    /**
    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 10279
    616      * @deprecated use {@link MainApplication#getLayerManager} instead
    617      */
    618     @Deprecated
    619     public static MainLayerManager getLayerManager() {
    620         return MainApplication.getLayerManager();
    621     }
    622 
    623     /**
    624272     * Replies the current selected primitives, from a end-user point of view.
    625273     * It is not always technically the same collection of primitives than {@link DataSet#getSelected()}.
     
    652300     */
    653301    public abstract boolean containsDataSet(DataSet ds);
    654 
    655     /**
    656      * Registers a {@code JosmAction} and its shortcut.
    657      * @param action action defining its own shortcut
    658      * @deprecated use {@link MainApplication#registerActionShortcut(JosmAction)} instead
    659      */
    660     @Deprecated
    661     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 register
    668      * @param shortcut shortcut to associate to {@code action}
    669      * @deprecated use {@link MainApplication#registerActionShortcut(Action, Shortcut)} instead
    670      */
    671     @Deprecated
    672     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 unregister
    679      * @deprecated use {@link MainApplication#unregisterShortcut(Shortcut)} instead
    680      */
    681     @Deprecated
    682     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 unregister
    689      * @deprecated use {@link MainApplication#unregisterActionShortcut(JosmAction)} instead
    690      */
    691     @Deprecated
    692     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 unregister
    699      * @param shortcut shortcut to unregister
    700      * @deprecated use {@link MainApplication#unregisterActionShortcut(Action, Shortcut)} instead
    701      */
    702     @Deprecated
    703     public static void unregisterActionShortcut(Action action, Shortcut shortcut) {
    704         MainApplication.unregisterActionShortcut(action, shortcut);
    705     }
    706 
    707     /**
    708      * Replies the registered action for the given shortcut
    709      * @param shortcut The shortcut to look for
    710      * @return the registered action for the given shortcut
    711      * @deprecated use {@link MainApplication#getRegisteredActionShortcut(Shortcut)} instead
    712      * @since 5696
    713      */
    714     @Deprecated
    715     public static Action getRegisteredActionShortcut(Shortcut shortcut) {
    716         return MainApplication.getRegisteredActionShortcut(shortcut);
    717     }
    718302
    719303    ///////////////////////////////////////////////////////////////////////////
     
    910494
    911495    /**
    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 MapFrameListener
    917      * @return {@code true} if the listeners collection changed as a result of the call
    918      * @see #addMapFrameListener
    919      * @deprecated use {@link MainApplication#addAndFireMapFrameListener} instead
    920      * @since 11904
    921      */
    922     @Deprecated
    923     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 changes
    929      * @param listener The MapFrameListener
    930      * @return {@code true} if the listeners collection changed as a result of the call
    931      * @see #addAndFireMapFrameListener
    932      * @deprecated use {@link MainApplication#addMapFrameListener} instead
    933      * @since 5957
    934      */
    935     @Deprecated
    936     public static boolean addMapFrameListener(MapFrameListener listener) {
    937         return MainApplication.addMapFrameListener(listener);
    938     }
    939 
    940     /**
    941      * Unregisters the given {@code MapFrameListener} from MapFrame changes
    942      * @param listener The MapFrameListener
    943      * @return {@code true} if the listeners collection changed as a result of the call
    944      * @deprecated use {@link MainApplication#removeMapFrameListener} instead
    945      * @since 5957
    946      */
    947     @Deprecated
    948     public static boolean removeMapFrameListener(MapFrameListener listener) {
    949         return MainApplication.removeMapFrameListener(listener);
    950     }
    951 
    952     /**
    953496     * Adds a new network error that occur to give a hint about broken Internet connection.
    954497     * 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  
    10101010    /**
    10111011     * This is a method that splits way into smaller parts, using the prepared nodes list as split points.
    1012      * Uses {@link SplitWayAction#splitWay} for the heavy lifting.
     1012     * Uses {@link SplitWayCommand#splitWay} for the heavy lifting.
    10131013     * @param way way to split
    10141014     * @param nodes split points
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r12974 r13173  
    285285     * Merges the nodes in {@code nodes} at the specified node's location.
    286286     *
    287      * @param layer unused
    288      * @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 do
    291      * @throws IllegalArgumentException if {@code layer} is null
    292      * @deprecated use {@link #mergeNodes(Collection, Node)} instead
    293      */
    294     @Deprecated
    295     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      *
    302287     * @param nodes the collection of nodes. Ignored if null.
    303288     * @param targetLocationNode this node's location will be used for the targetNode.
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r13158 r13173  
    2525
    2626import org.openstreetmap.josm.Main;
    27 import org.openstreetmap.josm.command.Command;
    2827import org.openstreetmap.josm.command.SplitWayCommand;
    2928import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
     
    3837import org.openstreetmap.josm.gui.MapFrame;
    3938import org.openstreetmap.josm.gui.Notification;
    40 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    4139import org.openstreetmap.josm.tools.GBC;
    4240import org.openstreetmap.josm.tools.Shortcut;
     
    4947 */
    5048public class SplitWayAction extends JosmAction {
    51 
    52     /**
    53      * Represents the result of a {@link SplitWayAction}
    54      * @see SplitWayAction#splitWay
    55      * @see SplitWayAction#split
    56      * @deprecated To be removed end of 2017. Use {@link SplitWayCommand} instead
    57      */
    58     @Deprecated
    59     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 12828
    82          */
    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 way
    92          * @return The command to be performed to split the way
    93          */
    94         public Command getCommand() {
    95             return command;
    96         }
    97 
    98         /**
    99          * Replies the new list of selected primitives ids
    100          * @return The new list of selected primitives ids
    101          */
    102         public List<? extends PrimitiveId> getNewSelection() {
    103             return newSelection;
    104         }
    105 
    106         /**
    107          * Replies the original way being split
    108          * @return The original way being split
    109          */
    110         public Way getOriginalWay() {
    111             return originalWay;
    112         }
    113 
    114         /**
    115          * Replies the resulting new ways
    116          * @return The resulting new ways
    117          */
    118         public List<Way> getNewWays() {
    119             return newWays;
    120         }
    121     }
    12249
    12350    /**
     
    206133            sel.addAll(selectedRelations);
    207134
    208             final List<Way> newWays = createNewWaysFromChunks(selectedWay, wayChunks);
     135            final List<Way> newWays = SplitWayCommand.createNewWaysFromChunks(selectedWay, wayChunks);
    209136            final Way wayToKeep = SplitWayCommand.Strategy.keepLongestChunk().determineWayToKeep(newWays);
    210137
     
    315242
    316243    /**
    317      * Determines which way chunk should reuse the old id and its history
    318      *
    319      * @since 8954
    320      * @since 10599 (functional interface)
    321      * @deprecated to be removed end of 2017. Use {@link org.openstreetmap.josm.command.SplitWayCommand.Strategy} instead
    322      */
    323     @Deprecated
    324     @FunctionalInterface
    325     public interface Strategy {
    326 
    327         /**
    328          * Determines which way chunk should reuse the old id and its history.
    329          *
    330          * @param wayChunks the way chunks
    331          * @return the way to keep
    332          */
    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 keep
    338          */
    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 chunk
    346          */
    347         static Strategy keepFirstChunk() {
    348             return SplitWayCommand.Strategy.keepFirstChunk()::determineWayToKeep;
    349         }
    350     }
    351 
    352     /**
    353244     * Determine which ways to split.
    354245     * @param selectedWays List of user selected ways.
     
    385276    }
    386277
    387     /**
    388      * Splits the nodes of {@code wayToSplit} into a list of node sequences
    389      * which are separated at the nodes in {@code splitPoints}.
    390      *
    391      * This method displays warning messages if {@code wayToSplit} and/or
    392      * {@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 chunks
    399      * @deprecated To be removed end of 2017. Use {@link SplitWayCommand#buildSplitChunks} instead
    400      */
    401     @Deprecated
    402     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 transferred
    409      * @param wayChunks the way chunks
    410      * @return the new way objects
    411      * @deprecated To be removed end of 2017. Use {@link SplitWayCommand#createNewWaysFromChunks} instead
    412      */
    413     @Deprecated
    414     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 replies
    420      * 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 to
    423      * 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 primitives
    430      * @return the result from the split operation
    431      * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#splitWay} instead
    432      */
    433     @Deprecated
    434     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 replies
    441      * 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 to
    444      * 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 primitives
    450      * @return the result from the split operation
    451      * @since 12718
    452      * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#splitWay} instead
    453      */
    454     @Deprecated
    455     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 replies
    462      * the result of this process in an instance of {@link SplitWayResult}.
    463      * The {@link org.openstreetmap.josm.actions.SplitWayAction.Strategy} is used to determine which
    464      * way chunk should reuse the old id and its history.
    465      *
    466      * Note that changes are not applied to the data yet. You have to
    467      * 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 primitives
    474      * @param splitStrategy The strategy used to determine which way chunk should reuse the old id and its history
    475      * @return the result from the split operation
    476      * @since 8954
    477      * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#splitWay} instead
    478      */
    479     @Deprecated
    480     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 replies
    487      * the result of this process in an instance of {@link SplitWayResult}.
    488      * The {@link org.openstreetmap.josm.actions.SplitWayAction.Strategy} is used to determine which
    489      * way chunk should reuse the old id and its history.
    490      *
    491      * Note that changes are not applied to the data yet. You have to
    492      * 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 primitives
    498      * @param splitStrategy The strategy used to determine which way chunk should reuse the old id and its history
    499      * @return the result from the split operation
    500      * @since 12718
    501      * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#splitWay} instead
    502      */
    503     @Deprecated
    504     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 
    510278    static void doSplitWay(Way way, Way wayToKeep, List<Way> newWays, List<OsmPrimitive> newSelection) {
    511279        final MapFrame map = MainApplication.getMap();
     
    519287    }
    520288
    521     /**
    522      * Splits the way {@code way} at the nodes in {@code atNodes} and replies
    523      * 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 to
    526      * 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 primitives
    535      * @return the result from the split operation
    536      * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#split} instead
    537      */
    538     @Deprecated
    539     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 replies
    545      * 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 to
    548      * 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 primitives
    556      * @return the result from the split operation
    557      * @since 12718
    558      * @deprecated to be removed end of 2017. Use {@link SplitWayCommand#split} instead
    559      */
    560     @Deprecated
    561     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 
    566289    @Override
    567290    protected void updateEnabledState() {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java

    r12881 r13173  
    1212
    1313import org.openstreetmap.josm.actions.JosmAction;
    14 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
    15 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
    1614import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1715import org.openstreetmap.josm.gui.MainApplication;
     
    1917import org.openstreetmap.josm.gui.layer.Layer;
    2018import org.openstreetmap.josm.spi.preferences.Config;
     19import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
     20import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
    2121import org.openstreetmap.josm.tools.ImageProvider;
    2222import org.openstreetmap.josm.tools.Shortcut;
     
    6565
    6666    /**
    67      * Constructor for mapmodes without a menu
    68      * @param name the action's text
    69      * @param iconName icon filename in {@code mapmode} directory
    70      * @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 active
    74      * @deprecated use {@link #MapMode(String, String, String, Shortcut, Cursor)} instead
    75      */
    76     @Deprecated
    77     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 text
    84      * @param iconName icon filename in {@code mapmode} directory
    85      * @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 active
    88      * @deprecated use {@link #MapMode(String, String, String, Cursor)} instead
    89      */
    90     @Deprecated
    91     public MapMode(String name, String iconName, String tooltip, MapFrame mapFrame, Cursor cursor) {
    92         this(name, iconName, tooltip, cursor);
    93     }
    94 
    95     /**
    9667     * Makes this map mode active.
    9768     */
     
    179150
    180151    /**
    181      * Update internal ctrl, alt, shift mask from given modifiers mask.
    182      * @param modifiers event modifiers mask
    183      * @deprecated use {@link #updateKeyModifiersEx} instead
    184      */
    185     @Deprecated
    186     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     /**
    193152     * Update internal ctrl, alt, shift mask from given extended modifiers mask.
    194153     * @param modifiers event extended modifiers mask
  • trunk/src/org/openstreetmap/josm/command/AddCommand.java

    r12726 r13173  
    1616import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1717import org.openstreetmap.josm.data.osm.Way;
    18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1918import org.openstreetmap.josm.tools.ImageProvider;
    2019
     
    3231     */
    3332    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 add
    38      * @deprecated to be removed end of 2017. Use {@link #AddCommand(DataSet, OsmPrimitive)} instead
    39      */
    40     @Deprecated
    41     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 add
    49      * @deprecated to be removed end of 2017. Use {@link #AddCommand(DataSet, OsmPrimitive)} instead
    50      */
    51     @Deprecated
    52     public AddCommand(OsmDataLayer layer, OsmPrimitive osm) {
    53         super(layer);
    54         this.osm = Objects.requireNonNull(osm, "osm");
    55     }
    5633
    5734    /**
  • trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java

    r12726 r13173  
    1919import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2020import org.openstreetmap.josm.data.osm.PrimitiveData;
    21 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2221import org.openstreetmap.josm.tools.CheckParameterUtil;
    2322import org.openstreetmap.josm.tools.JosmRuntimeException;
     
    3534    // only filled on undo
    3635    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)} instead
    42      */
    43     @Deprecated
    44     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 5953
    53      * @deprecated to be removed end of 2017. Use {@link #AddPrimitivesCommand(List, List, DataSet)} instead
    54      */
    55     @Deprecated
    56     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)} instead
    66      */
    67     @Deprecated
    68     public AddPrimitivesCommand(List<PrimitiveData> data, List<PrimitiveData> toSelect, OsmDataLayer layer) {
    69         super(layer);
    70         init(data, toSelect);
    71     }
    7236
    7337    /**
  • trunk/src/org/openstreetmap/josm/command/ChangeCommand.java

    r12726 r13173  
    1515import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1616import org.openstreetmap.josm.data.osm.Way;
    17 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1817import org.openstreetmap.josm.tools.CheckParameterUtil;
    1918import org.openstreetmap.josm.tools.ImageProvider;
     
    3635    public ChangeCommand(OsmPrimitive osm, OsmPrimitive newOsm) {
    3736        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 layer
    43      * @param osm The existing primitive to modify
    44      * @param newOsm The new primitive
    45      * @deprecated to be removed end of 2017. Use {@link #ChangeCommand(DataSet, OsmPrimitive, OsmPrimitive)} instead
    46      */
    47     @Deprecated
    48     public ChangeCommand(OsmDataLayer layer, OsmPrimitive osm, OsmPrimitive newOsm) {
    49         super(layer);
    50         this.osm = osm;
    51         this.newOsm = newOsm;
    52         sanityChecks();
    5337    }
    5438
  • trunk/src/org/openstreetmap/josm/command/Command.java

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

    r12869 r13173  
    3232import org.openstreetmap.josm.data.osm.Way;
    3333import org.openstreetmap.josm.data.osm.WaySegment;
    34 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3534import org.openstreetmap.josm.tools.CheckParameterUtil;
    3635import org.openstreetmap.josm.tools.ImageProvider;
     
    144143     * Constructor for a single data item. Use the collection constructor to delete multiple objects.
    145144     *
    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 null
    149      * @throws IllegalArgumentException if layer is null
    150      * @deprecated to be removed end of 2017. Use {@link #DeleteCommand(DataSet, OsmPrimitive)} instead
    151      */
    152     @Deprecated
    153     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      *
    160145     * @param dataset the data set context for deleting this primitive. Must not be null.
    161146     * @param data the primitive to delete. Must not be null.
     
    166151    public DeleteCommand(DataSet dataset, OsmPrimitive data) {
    167152        this(dataset, Collections.singleton(data));
    168     }
    169 
    170     /**
    171      * Constructor for a collection of data to be deleted in the context of a specific layer
    172      *
    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 null
    176      * @throws IllegalArgumentException if data is null or empty
    177      * @deprecated to be removed end of 2017. Use {@link #DeleteCommand(DataSet, Collection)} instead
    178      */
    179     @Deprecated
    180     public DeleteCommand(OsmDataLayer layer, Collection<? extends OsmPrimitive> data) {
    181         super(layer);
    182         CheckParameterUtil.ensureParameterNotNull(data, "data");
    183         this.toDelete = data;
    184         checkConsistency();
    185153    }
    186154
     
    329297     * If a way is deleted, only the way and no nodes are deleted.
    330298     *
    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 dialogs
    334      * @return command A command to perform the deletions, or null of there is nothing to delete.
    335      * @throws IllegalArgumentException if layer is null
    336      * @deprecated to be removed end of 2017. Use {@link #deleteWithReferences(Collection, boolean)} instead
    337      */
    338     @Deprecated
    339     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      *
    350299     * @param selection The list of all object to be deleted.
    351300     * @param silent  Set to true if the user should not be bugged with additional dialogs
     
    373322     * If a way is deleted, only the way and no nodes are deleted.
    374323     *
    375      * @param layer unused
    376324     * @param selection The list of all object to be deleted.
    377325     * @return command A command to perform the deletions, or null of there is nothing to delete.
    378326     * @throws IllegalArgumentException if layer is null
    379      * @deprecated to be removed end of 2017. Use {@link #deleteWithReferences(Collection)} instead
    380      */
    381     @Deprecated
    382     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 null
    396327     * @since 12718
    397328     */
    398329    public static Command deleteWithReferences(Collection<? extends OsmPrimitive> selection) {
    399330        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 a
    406      * 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. If
    409      * they are part of a relation, inform the user and do not delete.
    410      *
    411      * @param layer unused
    412      * @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)} instead
    415      */
    416     @Deprecated
    417     public static Command delete(OsmDataLayer layer, Collection<? extends OsmPrimitive> selection) {
    418         return delete(selection);
    419331    }
    420332
     
    479391     * they are part of a relation, inform the user and do not delete.
    480392     *
    481      * @param layer unused
    482393     * @param selection the objects to delete.
    483394     * @param alsoDeleteNodesInWay <code>true</code> if nodes should be deleted as well
    484395     * @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)} instead
    486      */
    487     @Deprecated
    488     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 a
    497      * 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. If
    500      * 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 well
    504      * @return command a command to perform the deletions, or null if there is nothing to delete.
    505396     * @since 12718
    506397     */
    507398    public static Command delete(Collection<? extends OsmPrimitive> selection, boolean alsoDeleteNodesInWay) {
    508399        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 a
    515      * 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. If
    518      * they are part of a relation, inform the user and do not delete.
    519      *
    520      * @param layer unused
    521      * @param selection the objects to delete.
    522      * @param alsoDeleteNodesInWay <code>true</code> if nodes should be deleted as well
    523      * @param silent set to true if the user should not be bugged with additional questions
    524      * @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)} instead
    526      */
    527     @Deprecated
    528     public static Command delete(OsmDataLayer layer, Collection<? extends OsmPrimitive> selection,
    529             boolean alsoDeleteNodesInWay, boolean silent) {
    530         return delete(selection, alsoDeleteNodesInWay, silent);
    531400    }
    532401
     
    608477    /**
    609478     * Create a command that deletes a single way segment. The way may be split by this.
    610      * @param layer unused
    611      * @param ws The way segment that should be deleted
    612      * @return A matching command to safely delete that segment.
    613      * @deprecated to be removed end of 2017. Use {@link #deleteWaySegment(WaySegment)} instead
    614      */
    615     @Deprecated
    616     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.
    622479     * @param ws The way segment that should be deleted
    623480     * @return A matching command to safely delete that segment.
  • trunk/src/org/openstreetmap/josm/command/PurgeCommand.java

    r12846 r13173  
    3030import org.openstreetmap.josm.data.osm.Way;
    3131import org.openstreetmap.josm.data.osm.WayData;
    32 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3332import org.openstreetmap.josm.spi.preferences.Config;
    3433import org.openstreetmap.josm.tools.ImageProvider;
     
    4443
    4544    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 layer
    54      * @param toPurge primitives to purge
    55      * @param makeIncomplete primitives to make incomplete
    56      * @deprecated to be removed end of 2017. Use {@link #PurgeCommand(DataSet, Collection, Collection)} instead
    57      */
    58     @Deprecated
    59     public PurgeCommand(OsmDataLayer layer, Collection<OsmPrimitive> toPurge, Collection<OsmPrimitive> makeIncomplete) {
    60         super(layer);
    61         init(toPurge, makeIncomplete);
    62     }
    6345
    6446    /**
     
    316298    /**
    317299     * Creates a new {@code PurgeCommand} to purge selected OSM primitives.
    318      * @param layer optional osm data layer, can be null
    319      * @param sel selected OSM primitives
    320      * @param toPurgeAdditionally optional list that will be filled with primitives to be purged that have not been in the selection
    321      * @return command to purge selected OSM primitives
    322      * @since 12688
    323      * @deprecated to be removed end of 2017. Use {@link #build(Collection, List)} instead
    324      */
    325     @Deprecated
    326     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.
    332300     * @param sel selected OSM primitives
    333301     * @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  
    2424    /** the selection before applying the new selection */
    2525    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)} instead
    31      */
    32     @Deprecated
    33     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     }
    4026
    4127    /**
  • trunk/src/org/openstreetmap/josm/command/SequenceCommand.java

    r12726 r13173  
    1313import org.openstreetmap.josm.data.osm.DataSet;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
    15 import org.openstreetmap.josm.gui.layer.Layer;
    1615import org.openstreetmap.josm.tools.ImageProvider;
    1716import org.openstreetmap.josm.tools.Utils;
     
    151150    }
    152151
    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     @Override
    159     @Deprecated
    160     public void invalidateAffectedLayers() {
    161         super.invalidateAffectedLayers();
    162         for (Command c : sequence) {
    163             c.invalidateAffectedLayers();
    164         }
    165     }
    166 
    167152    @Override
    168153    public int hashCode() {
  • trunk/src/org/openstreetmap/josm/command/SplitWayCommand.java

    r13066 r13173  
    233233     * Splits the way {@code way} into chunks of {@code wayChunks} and replies
    234234     * the result of this process in an instance of {@link SplitWayCommand}.
    235      * The {@link org.openstreetmap.josm.actions.SplitWayAction.Strategy} is used to determine which
     235     * The {@link SplitWayCommand.Strategy} is used to determine which
    236236     * way chunk should reuse the old id and its history.
    237237     *
  • trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java

    r12726 r13173  
    1616import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    1717import org.openstreetmap.josm.data.osm.OsmPrimitive;
    18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1918import org.openstreetmap.josm.tools.ImageProvider;
    2019import org.openstreetmap.josm.tools.Logging;
     
    2726public class ConflictAddCommand extends Command {
    2827    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 add
    34      * @deprecated to be removed end of 2017. Use {@link #ConflictAddCommand(DataSet, Conflict)} instead
    35      */
    36     @Deprecated
    37     public ConflictAddCommand(OsmDataLayer layer, Conflict<? extends OsmPrimitive> conflict) {
    38         super(layer);
    39         this.conflict = conflict;
    40     }
    4128
    4229    /**
  • trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java

    r12726 r13173  
    1111import org.openstreetmap.josm.data.conflict.ConflictCollection;
    1212import org.openstreetmap.josm.data.osm.DataSet;
    13 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1413import org.openstreetmap.josm.tools.Logging;
    1514
     
    2524    /** the list of resolved conflicts */
    2625    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)} instead
    31      */
    32     @Deprecated
    33     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)} instead
    41      */
    42     @Deprecated
    43     public ConflictResolveCommand(OsmDataLayer layer) {
    44         super(layer);
    45     }
    4626
    4727    /**
  • trunk/src/org/openstreetmap/josm/data/Bounds.java

    r12818 r13173  
    88import java.text.MessageFormat;
    99import java.util.Objects;
    10 import java.util.function.Consumer;
    1110
    1211import org.openstreetmap.josm.data.coor.ILatLon;
    1312import org.openstreetmap.josm.data.coor.LatLon;
    1413import org.openstreetmap.josm.data.osm.BBox;
    15 import org.openstreetmap.josm.data.projection.Projection;
    1614import org.openstreetmap.josm.tools.CheckParameterUtil;
    1715
     
    565563    }
    566564
    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 10806
    572      * @deprecated use {@link Projection#visitOutline(Bounds, Consumer)}
    573      */
    574     @Deprecated
    575     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 
    596565    @Override
    597566    public int hashCode() {
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r13076 r13173  
    1111import java.io.Reader;
    1212import java.io.StringWriter;
    13 import java.lang.annotation.Retention;
    14 import java.lang.annotation.RetentionPolicy;
    1513import java.nio.charset.StandardCharsets;
    1614import java.util.ArrayList;
     
    3836
    3937import org.openstreetmap.josm.Main;
    40 import org.openstreetmap.josm.data.preferences.BooleanProperty;
    4138import 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;
    4539import org.openstreetmap.josm.data.preferences.NamedColorProperty;
    4640import org.openstreetmap.josm.data.preferences.PreferencesReader;
     
    5145import org.openstreetmap.josm.spi.preferences.Config;
    5246import org.openstreetmap.josm.spi.preferences.IBaseDirectories;
    53 import org.openstreetmap.josm.spi.preferences.IPreferences;
    54 import org.openstreetmap.josm.spi.preferences.ListListSetting;
    5547import org.openstreetmap.josm.spi.preferences.ListSetting;
    56 import org.openstreetmap.josm.spi.preferences.MapListSetting;
    5748import org.openstreetmap.josm.spi.preferences.Setting;
    5849import org.openstreetmap.josm.spi.preferences.StringSetting;
     
    137128    protected boolean initSuccessful;
    138129
    139     /**
    140      * Event triggered when a preference entry value changes.
    141      * @deprecated use {@link org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent}
    142      */
    143     @Deprecated
    144     public interface PreferenceChangeEvent {
    145         /**
    146          * Returns the preference key.
    147          * @return the preference key
    148          */
    149         String getKey();
    150 
    151         /**
    152          * Returns the old preference value.
    153          * @return the old preference value
    154          */
    155         Setting<?> getOldValue();
    156 
    157         /**
    158          * Returns the new preference value.
    159          * @return the new preference value
    160          */
    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     @FunctionalInterface
    170     @Deprecated
    171     public interface PreferenceChangedListener {
    172         /**
    173          * Trigerred when a preference entry value changes.
    174          * @param e the preference change event
    175          */
    176         void preferenceChanged(PreferenceChangeEvent e);
    177     }
    178 
    179     /**
    180      * @deprecated private class is deprecated
    181      */
    182     @Deprecated
    183     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         @Override
    195         public String getKey() {
    196             return key;
    197         }
    198 
    199         @Override
    200         public Setting<?> getOldValue() {
    201             return oldValue;
    202         }
    203 
    204         @Override
    205         public Setting<?> getNewValue() {
    206             return newValue;
    207         }
    208     }
    209 
    210130    private final ListenerList<org.openstreetmap.josm.spi.preferences.PreferenceChangedListener> listeners = ListenerList.create();
    211131
    212132    private final HashMap<String, ListenerList<org.openstreetmap.josm.spi.preferences.PreferenceChangedListener>> keyListeners = new HashMap<>();
    213 
    214     /**
    215      * @deprecated deprecated private field
    216      */
    217     @Deprecated
    218     private final ListenerList<Preferences.PreferenceChangedListener> listenersDeprecated = ListenerList.create();
    219 
    220     /**
    221      * @deprecated deprecated private field
    222      */
    223     @Deprecated
    224     private final HashMap<String, ListenerList<Preferences.PreferenceChangedListener>> keyListenersDeprecated = new HashMap<>();
    225133
    226134    /**
     
    266174
    267175    /**
    268      * Adds a new preferences listener.
    269      * @param listener The listener to add
    270      * @deprecated use {@link #addPreferenceChangeListener(org.openstreetmap.josm.spi.preferences.PreferenceChangedListener)}
    271      */
    272     @Deprecated
    273     public void addPreferenceChangeListener(Preferences.PreferenceChangedListener listener) {
    274         if (listener != null) {
    275             listenersDeprecated.addListener(listener);
    276         }
    277     }
    278 
    279     /**
    280176     * Removes a preferences listener.
    281177     * @param listener The listener to remove
     
    285181    public void removePreferenceChangeListener(org.openstreetmap.josm.spi.preferences.PreferenceChangedListener listener) {
    286182        listeners.removeListener(listener);
    287     }
    288 
    289     /**
    290      * Removes a preferences listener.
    291      * @param listener The listener to remove
    292      * @deprecated use {@link #removePreferenceChangeListener(org.openstreetmap.josm.spi.preferences.PreferenceChangedListener)}
    293      */
    294     @Deprecated
    295     public void removePreferenceChangeListener(Preferences.PreferenceChangedListener listener) {
    296         listenersDeprecated.removeListener(listener);
    297183    }
    298184
     
    309195
    310196    /**
    311      * Adds a listener that only listens to changes in one preference
    312      * @param key The preference key to listen to
    313      * @param listener The listener to add.
    314      * @since 10824
    315      * @deprecated use
    316      * {@link #addKeyPreferenceChangeListener(java.lang.String, org.openstreetmap.josm.spi.preferences.PreferenceChangedListener)}
    317      */
    318     @Deprecated
    319     public void addKeyPreferenceChangeListener(String key, Preferences.PreferenceChangedListener listener) {
    320         listenersForKeyDeprecated(key).addListener(listener);
    321     }
    322 
    323     /**
    324197     * Adds a weak listener that only listens to changes in one preference
    325198     * @param key The preference key to listen to
     
    333206    private ListenerList<org.openstreetmap.josm.spi.preferences.PreferenceChangedListener> listenersForKey(String key) {
    334207        return keyListeners.computeIfAbsent(key, k -> ListenerList.create());
    335     }
    336 
    337     /**
    338      * @param key preference key
    339      * @return listener list for this key
    340      * @deprecated deprecated private method
    341      */
    342     @Deprecated
    343     private ListenerList<Preferences.PreferenceChangedListener> listenersForKeyDeprecated(String key) {
    344         return keyListenersDeprecated.computeIfAbsent(key, k -> ListenerList.create());
    345208    }
    346209
     
    358221    }
    359222
    360     /**
    361      * Removes a listener that only listens to changes in one preference
    362      * @param key The preference key to listen to
    363      * @param listener The listener to add.
    364      * @deprecated use
    365      * {@link #removeKeyPreferenceChangeListener(java.lang.String, org.openstreetmap.josm.spi.preferences.PreferenceChangedListener)}
    366      */
    367     @Deprecated
    368     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 
    374223    protected void firePreferenceChanged(String key, Setting<?> oldValue, Setting<?> newValue) {
    375224        final org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent evt =
     
    381230            forKey.fireEvent(listener -> listener.preferenceChanged(evt));
    382231        }
    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.
    406236     * 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
    409238     */
    410239    public String getJOSMDirectoryBaseName() {
     
    639468        }
    640469        return all;
    641     }
    642 
    643     /**
    644      * Gets an boolean that may be specialized
    645      * @param key The basic key
    646      * @param specName The sub-key to append to the key
    647      * @param def The default value
    648      * @return The boolean value or the default value if it could not be parsed
    649      * @deprecated use {@link PreferencesUtils#getBoolean(IPreferences, String, String, boolean)}
    650      */
    651     @Deprecated
    652     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         else
    659             return generic;
    660     }
    661 
    662     /**
    663      * Set a boolean value for a certain setting.
    664      * @param key the unique identifier for the setting
    665      * @param value The new value
    666      * @return {@code true}, if something has changed (i.e. value is different than before)
    667      * @see BooleanProperty
    668      * @deprecated use {@link IPreferences#putBoolean(String, boolean)}
    669      */
    670     @Deprecated
    671     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 setting
    678      * @param value The new value
    679      * @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     @Deprecated
    684     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 setting
    691      * @param value The new value
    692      * @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     @Deprecated
    697     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 setting
    704      * @param value The new value
    705      * @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     @Deprecated
    710     public boolean putLong(final String key, final Long value) {
    711         return put(key, Long.toString(value));
    712470    }
    713471
     
    1050808
    1051809    /**
    1052      * Gets an integer preference
    1053      * @param key The preference key
    1054      * @param def The default value to use
    1055      * @return The integer
    1056      * @see IntegerProperty#get()
    1057      * @deprecated use {@link IPreferences#getInt(String, int)}
    1058      */
    1059     @Deprecated
    1060     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 out
    1069             Logging.trace(e);
    1070         }
    1071         return def;
    1072     }
    1073 
    1074     /**
    1075      * Gets an integer that may be specialized
    1076      * @param key The basic key
    1077      * @param specName The sub-key to append to the key
    1078      * @param def The default value
    1079      * @return The integer value or the default value if it could not be parsed
    1080      * @deprecated use {@link PreferencesUtils#getInteger(IPreferences, String, String, int)}
    1081      */
    1082     @Deprecated
    1083     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 out
    1094             Logging.trace(e);
    1095         }
    1096         return def;
    1097     }
    1098 
    1099     /**
    1100      * Get a list of values for a certain key
    1101      * @param key the identifier for the setting
    1102      * @param def the default value.
    1103      * @return the corresponding value if the property has been set before, {@code def} otherwise
    1104      * @deprecated use {@link IPreferences#getList(java.lang.String, java.util.List)}
    1105      */
    1106     @Deprecated
    1107     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 key
    1113      * @param key the identifier for the setting
    1114      * @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     @Deprecated
    1118     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 collection
    1125      * @param key The preference key the collection is stored with
    1126      * @param value The value that should be removed in the collection
    1127      * @see #getList(String)
    1128      * @deprecated use {@link PreferencesUtils#removeFromList(IPreferences, String, String)}
    1129      */
    1130     @Deprecated
    1131     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     /**
    1138810     * Set a value for a certain setting. The changed setting is saved to the preference file immediately.
    1139811     * Due to caching mechanisms on modern operating systems and hardware, this shouldn't be a performance problem.
     
    1218890    }
    1219891
    1220     /**
    1221      * Put a collection.
    1222      * @param key key
    1223      * @param value value
    1224      * @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     @Deprecated
    1228     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 key
    1235      * @param maxsize max number of items to save
    1236      * @param val value
    1237      * @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     @Deprecated
    1241     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 key
    1256      * @param def default array value
    1257      * @return array value
    1258      * @deprecated use {@link #getListOfLists(java.lang.String, java.util.List)}
    1259      */
    1260     @Deprecated
    1261     @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 key
    1269      * @param key The key
    1270      * @return The collection of string collections or an empty collection as default
    1271      * @deprecated use {@link IPreferences#getListOfLists(java.lang.String)}
    1272      */
    1273     @Deprecated
    1274     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 key
    1282      * @param value value
    1283      * @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     @Deprecated
    1287     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 at
    1294      * @param def The default value to use
    1295      * @return The stored value or the default one if it could not be parsed
    1296      * @deprecated use {@link IPreferences#getListOfMaps(java.lang.String, java.util.List)}
    1297      */
    1298     @Deprecated
    1299     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 structs
    1305      * @param key The key to store the list in
    1306      * @param value A list of key/value maps
    1307      * @return <code>true</code> if the value was changed
    1308      * @see #getListOfMaps(java.lang.String, java.util.List)
    1309      * @deprecated use {@link IPreferences#putListOfMaps(java.lang.String, java.util.List)}
    1310      */
    1311     @Deprecated
    1312     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     @Deprecated
    1325     @Retention(RetentionPolicy.RUNTIME) // keep annotation at runtime
    1326     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     @Deprecated
    1336     @Retention(RetentionPolicy.RUNTIME) // keep annotation at runtime
    1337     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 type
    1344      * @param key main preference key
    1345      * @param klass The struct class
    1346      * @return a list of objects of type T or an empty list if nothing was found
    1347      * @deprecated use {@link StructUtils#getListOfStructs(IPreferences, String, Class)}
    1348      */
    1349     @Deprecated
    1350     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 found
    1356      * @param <T> klass type
    1357      * @param key main preference key
    1358      * @param def default value
    1359      * @param klass The struct class
    1360      * @return a list of objects of type T or {@code def} if nothing was found
    1361      * @deprecated use {@link StructUtils#getListOfStructs(IPreferences, String, Collection, Class)}
    1362      */
    1363     @Deprecated
    1364     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&lt;String, String&gt;</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 key
    1380      * @param val the list that is supposed to be saved
    1381      * @param klass The struct class
    1382      * @return true if something has changed
    1383      * @deprecated use {@link StructUtils#putListOfStructs(IPreferences, String, Collection, Class)}
    1384      */
    1385     @Deprecated
    1386     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 unchanged
    1398      * (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 converted
    1403      * @param klass the class T
    1404      * @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     @Deprecated
    1408     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 assigning
    1414      * 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&lt;String, String&gt; and Map&lt;String, List&lt;String&gt;&gt;.
    1418      *
    1419      * Only fields with annotation {@link pref} are taken into account.
    1420      * @param <T> the class
    1421      * @param hash the string map with initial values
    1422      * @param klass the class T
    1423      * @return an object of class T, initialized as described above
    1424      * @deprecated use {@link StructUtils#deserializeStruct(java.util.Map, java.lang.Class)}
    1425      */
    1426     @Deprecated
    1427     public static <T> T deserializeStruct(Map<String, String> hash, Class<T> klass) {
    1428         return StructUtils.deserializeStruct(hash, klass);
    1429     }
    1430 
    1431892    @Override
    1432893    public Set<String> getKeySet() {
  • trunk/src/org/openstreetmap/josm/data/StructUtils.java

    r12851 r13173  
    148148     * @return the resulting map (same data content as <code>struct</code>)
    149149     */
    150     @SuppressWarnings("deprecation")
    151150    public static <T> Map<String, String> serializeStruct(T struct, Class<T> klass) {
    152151        T structPrototype;
     
    159158        Map<String, String> hash = new LinkedHashMap<>();
    160159        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) {
    162161                continue;
    163162            }
     
    167166                Object defaultFieldValue = f.get(structPrototype);
    168167                if (fieldValue != null && (
    169                         f.getAnnotation(Preferences.writeExplicitly.class) != null ||
    170168                        f.getAnnotation(WriteExplicitly.class) != null ||
    171169                        !Objects.equals(fieldValue, defaultFieldValue))) {
     
    216214                continue;
    217215            }
    218             if (f.getAnnotation(Preferences.pref.class) == null && f.getAnnotation(StructEntry.class) == null) {
     216            if (f.getAnnotation(StructEntry.class) == null) {
    219217                continue;
    220218            }
  • trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java

    r13140 r13173  
    44import java.io.Serializable;
    55import java.util.Objects;
    6 
    7 import org.openstreetmap.josm.data.osm.BBox;
    86
    97/**
     
    9290    }
    9391
    94     /**
    95      * Creates bbox around this coordinate. Coordinate defines
    96      * center of bbox, its edge will be 2*r.
    97      *
    98      * @param r size
    99      * @return BBox around this coordinate
    100      * @since 6203
    101      * @deprecated use {@link BBox#BBox(double, double, double)} instead
    102      */
    103     @Deprecated
    104     public BBox toBBox(final double r) {
    105         return new BBox(x, y, r);
    106     }
    107 
    10892    @Override
    10993    public int hashCode() {
  • trunk/src/org/openstreetmap/josm/data/coor/ILatLon.java

    r12729 r13173  
    22package org.openstreetmap.josm.data.coor;
    33
    4 import org.openstreetmap.josm.Main;
    54import org.openstreetmap.josm.data.projection.Projecting;
    65
     
    3938
    4039    /**
    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 #is
    46      * @deprecated use {@link #getEastNorth(org.openstreetmap.josm.data.projection.Projecting)}
    47      */
    48     @Deprecated
    49     default EastNorth getEastNorth() {
    50         return getEastNorth(Main.getProjection());
    51     }
    52 
    53     /**
    5440     * Replies the projected east/north coordinates.
    5541     * <p>
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r12873 r13173  
    99import static java.lang.Math.sqrt;
    1010import static org.openstreetmap.josm.data.projection.Ellipsoid.WGS84;
    11 import static org.openstreetmap.josm.tools.I18n.trc;
    1211import static org.openstreetmap.josm.tools.Utils.toRadians;
    1312
     
    1514import java.text.DecimalFormat;
    1615import java.text.NumberFormat;
    17 import java.util.Arrays;
    1816import java.util.Locale;
    1917import java.util.Objects;
     
    2119import org.openstreetmap.josm.Main;
    2220import 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;
    2721import org.openstreetmap.josm.tools.Logging;
    2822import org.openstreetmap.josm.tools.Utils;
     
    8781
    8882    /**
    89      * Character denoting South, as string.
    90      * @deprecated use {@link LatLonParser#SOUTH}
    91      */
    92     @Deprecated
    93     public static final String SOUTH = trc("compass", "S");
    94     /**
    95      * Character denoting North, as string.
    96      * @deprecated use {@link LatLonParser#NORTH}
    97      */
    98     @Deprecated
    99     public static final String NORTH = trc("compass", "N");
    100     /**
    101      * Character denoting West, as string.
    102      * @deprecated use {@link LatLonParser#WEST}
    103      */
    104     @Deprecated
    105     public static final String WEST = trc("compass", "W");
    106     /**
    107      * Character denoting East, as string.
    108      * @deprecated use {@link LatLonParser#EAST}
    109      */
    110     @Deprecated
    111     public static final String EAST = trc("compass", "E");
    112 
    113     /**
    11483     * Replies true if lat is in the range [-90,90]
    11584     *
     
    185154
    186155    /**
    187      * Replies the coordinate in degrees/minutes/seconds format
    188      * @param pCoordinate The coordinate to convert
    189      * @return The coordinate in degrees/minutes/seconds format
    190      * @deprecated use {@link #degreesMinutesSeconds} instead
    191      */
    192     @Deprecated
    193     public static String dms(double pCoordinate) {
    194         return degreesMinutesSeconds(pCoordinate);
    195     }
    196 
    197     /**
    198      * Replies the coordinate in degrees/minutes/seconds format
    199      * @param pCoordinate The coordinate to convert
    200      * @return The coordinate in degrees/minutes/seconds format
    201      * @since 12561
    202      * @deprecated use {@link DMSCoordinateFormat#degreesMinutesSeconds(double)}
    203      */
    204     @Deprecated
    205     public static String degreesMinutesSeconds(double pCoordinate) {
    206         return DMSCoordinateFormat.degreesMinutesSeconds(pCoordinate);
    207     }
    208 
    209     /**
    210      * Replies the coordinate in degrees/minutes format
    211      * @param pCoordinate The coordinate to convert
    212      * @return The coordinate in degrees/minutes format
    213      * @since 12537
    214      * @deprecated use {@link NauticalCoordinateFormat#degreesMinutes(double)}
    215      */
    216     @Deprecated
    217     public static String degreesMinutes(double pCoordinate) {
    218         return NauticalCoordinateFormat.degreesMinutes(pCoordinate);
    219     }
    220 
    221     /**
    222      * Replies the coordinate in degrees/minutes format
    223      * @param pCoordinate The coordinate to convert
    224      * @return The coordinate in degrees/minutes format
    225      * @deprecated use {@link #degreesMinutes(double)} instead
    226      */
    227     @Deprecated
    228     public static String dm(double pCoordinate) {
    229         return degreesMinutes(pCoordinate);
    230     }
    231 
    232     /**
    233156     * Constructs a new object representing the given latitude/longitude.
    234157     * @param lat the latitude, i.e., the north-south position in degrees
     
    252175    }
    253176
    254     /**
    255      * Formats the latitude part according to the given format
    256      * @param d the coordinate format to use
    257      * @return the formatted latitude
    258      * @deprecated use {@link org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat#latToString(ILatLon)}
    259      */
    260     @Deprecated
    261     public String latToString(CoordinateFormat d) {
    262         return d.getICoordinateFormat().latToString(this);
    263     }
    264 
    265177    @Override
    266178    public double lon() {
    267179        return x;
    268     }
    269 
    270     /**
    271      * Formats the longitude part according to the given format
    272      * @param d the coordinate format to use
    273      * @return the formatted longitude
    274      * @deprecated use {@link org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat#lonToString(ILatLon)}
    275      */
    276     @Deprecated
    277     public String lonToString(CoordinateFormat d) {
    278         return d.getICoordinateFormat().lonToString(this);
    279180    }
    280181
     
    409310
    410311    /**
    411      * Returns this lat/lon pair in human-readable format separated by {@code separator}.
    412      * @param separator values separator
    413      * @return String in the format {@code "1.23456[separator]2.34567"}
    414      * @deprecated method removed without replacement
    415      */
    416     @Deprecated
    417     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     /**
    425312     * Interpolate between this and a other latlon
    426313     * @param ll2 The other lat/lon object
     
    506393               Double.compare(that.y, y) == 0;
    507394    }
    508 
    509     /**
    510      * Parses the given string as lat/lon.
    511      * @param coord String to parse
    512      * @return parsed lat/lon
    513      * @since 11045
    514      * @deprecated use {@link LatLonParser#parse(java.lang.String)}
    515      */
    516     @Deprecated
    517     public static LatLon parse(String coord) {
    518         return LatLonParser.parse(coord);
    519     }
    520395}
  • trunk/src/org/openstreetmap/josm/data/oauth/OAuthAccessTokenHolder.java

    r12928 r13173  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import org.openstreetmap.josm.data.Preferences;
    76import org.openstreetmap.josm.io.auth.CredentialsAgent;
    87import org.openstreetmap.josm.io.auth.CredentialsAgentException;
     
    165164
    166165    /**
    167      * Initializes the content of this holder from the Access Token managed by the
    168      * 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 null
    173      * @deprecated (since 12928) replaced by {@link #init(org.openstreetmap.josm.io.auth.CredentialsAgent)}
    174      */
    175     @Deprecated
    176     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     /**
    195166     * Saves the content of this holder to the preferences and a credential store managed
    196167     * by a credential manager.
     
    216187
    217188    /**
    218      * Saves the content of this holder to the preferences and a credential store managed
    219      * 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 null
    224      * @throws IllegalArgumentException if cm is null
    225      * @deprecated (since 12928) replaced by {@link #save(org.openstreetmap.josm.io.auth.CredentialsAgent)}
    226      */
    227     @Deprecated
    228     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     /**
    246189     * Clears the content of this holder
    247190     */
  • trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java

    r12928 r13173  
    55
    66import org.openstreetmap.josm.Main;
    7 import org.openstreetmap.josm.data.Preferences;
    87import org.openstreetmap.josm.io.OsmApi;
    98import org.openstreetmap.josm.spi.preferences.Config;
     
    9695
    9796    /**
    98      * Replies a set of parameters as defined in the preferences.
    99      *
    100      * @param pref the preferences
    101      * @return the parameters
    102      * @deprecated (since 12928) replaced by {@link #createFromApiUrl(java.lang.String)}
    103      */
    104     @Deprecated
    105     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     /**
    11897     * Remembers the current values in the preferences.
    11998     */
     
    126105        Config.getPref().put("oauth.settings.osm-login-url", getOsmLoginUrl());
    127106        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     @Deprecated
    138     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());
    147107    }
    148108
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r12809 r13173  
    105105
    106106    /**
    107      * Visitor pattern.
    108      * @param v visitor
    109      * @deprecated no longer supported
    110      */
    111     @Deprecated
    112     public void visit(org.openstreetmap.josm.data.osm.visitor.Visitor v) {
    113         v.visit(this);
    114     }
    115 
    116     /**
    117107     * Compares this changeset to another, based on their identifier.
    118108     * @param other other changeset
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r13161 r13173  
    5555import org.openstreetmap.josm.data.projection.ProjectionChangeListener;
    5656import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    57 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
    5857import org.openstreetmap.josm.tools.ListenerList;
    5958import org.openstreetmap.josm.tools.Logging;
     
    208207        // the listener, projection change listeners are managed as WeakReferences.
    209208        Main.addProjectionChangeListener(this);
    210         addSelectionListener((DataSelectionListener) e -> fireDeprecatedSelectionChange(e.getSelection()));
     209        addSelectionListener((DataSelectionListener) e -> fireSelectionChange(e.getSelection()));
    211210    }
    212211
     
    335334
    336335    /**
    337      * Returns the autocompletion manager, which maintains a list of used tags for autocompletion.
    338      * @return the autocompletion manager
    339      * @deprecated to be removed end of 2017. Use {@link AutoCompletionManager#of(DataSet)} instead.
    340      */
    341     @Deprecated
    342     public AutoCompletionManager getAutoCompletionManager() {
    343         return AutoCompletionManager.of(this);
    344     }
    345 
    346     /**
    347336     * The API version that created this data set, if any.
    348337     */
     
    365354    public void setVersion(String version) {
    366355        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} otherwise
    373      * @see #setUploadDiscouraged
    374      * @deprecated use {@link #getUploadPolicy()}
    375      */
    376     @Deprecated
    377     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 uploaded
    384      * @see #isUploadDiscouraged
    385      * @deprecated use {@link #setUploadPolicy(UploadPolicy)}
    386      */
    387     @Deprecated
    388     public void setUploadDiscouraged(boolean uploadDiscouraged) {
    389         if (uploadPolicy != UploadPolicy.BLOCKED) {
    390             this.uploadPolicy = uploadDiscouraged ? UploadPolicy.DISCOURAGED : UploadPolicy.NORMAL;
    391         }
    392356    }
    393357
     
    676640    }
    677641
    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) {
    689643        for (SelectionChangedListener l : selListeners) {
    690644            l.selectionChanged(currentSelection);
     
    827781        highlightedWaySegments = waySegments;
    828782        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 selection
    836      * @param fireSelectionChangeEvent true, if the selection change listeners are to be notified; false, otherwise
    837      * @deprecated Use {@link #setSelected(Collection)} instead. To be removed end of 2017. Does not seem to be used by plugins.
    838      */
    839     @Deprecated
    840     public void setSelected(Collection<? extends PrimitiveId> selection, boolean fireSelectionChangeEvent) {
    841         setSelected(selection);
    842783    }
    843784
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r13012 r13173  
    9393     * Uses the {@link Main#getProjection() global projection} to project the lat/lon-coordinates.
    9494     * <p>
    95      * Method {@link org.openstreetmap.josm.data.coor.ILatLon#getEastNorth()} of
    96      * implemented interface <code>ILatLon</code> is deprecated, but this method is not.
    9795     * @return the east north coordinates or {@code null} if {@link #isLatLonKnown()}
    9896     * is false.
    9997     */
    100     @SuppressWarnings("deprecation")
    101     @Override
    10298    public EastNorth getEastNorth() {
    10399        return getEastNorth(Main.getProjection());
     
    223219    }
    224220
    225     /**
    226      * @deprecated no longer supported
    227      */
    228     @Override
    229     @Deprecated
    230     public void accept(org.openstreetmap.josm.data.osm.visitor.Visitor visitor) {
    231         visitor.visit(this);
    232     }
    233 
    234221    @Override
    235222    public void accept(OsmPrimitiveVisitor visitor) {
  • trunk/src/org/openstreetmap/josm/data/osm/NodeData.java

    r12778 r13173  
    7575    }
    7676
    77     /**
    78      * @deprecated use {@link #getEastNorth(org.openstreetmap.josm.data.projection.Projecting)}
    79      */
    80     @Override
    81     @Deprecated
    82     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 
    8877    @Override
    8978    public void setEastNorth(EastNorth eastNorth) {
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r13070 r13173  
    10241024
    10251025    /**
    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     @Deprecated
    1032     public void visitReferrers(org.openstreetmap.josm.data.osm.visitor.Visitor visitor) {
    1033         visitReferrers((OsmPrimitiveVisitor) visitor);
    1034     }
    1035 
    1036     /**
    10371026     * <p>Visits {@code visitor} for all referrers.</p>
    10381027     *
     
    10901079     * visitor function.
    10911080     * @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     @Deprecated
    1095     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 correct
    1099      * visitor function.
    1100      * @param visitor The visitor from which the visit() function must be called.
    11011081     * @since 12809
    11021082     */
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r12846 r13173  
    174174    public OsmPrimitiveType getMemberType(int idx) {
    175175        return members[idx].getType();
    176     }
    177 
    178     /**
    179      * @deprecated no longer supported
    180      */
    181     @Override
    182     @Deprecated
    183     public void accept(org.openstreetmap.josm.data.osm.visitor.Visitor visitor) {
    184         visitor.visit(this);
    185176    }
    186177
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r13033 r13173  
    205205        }
    206206        return chunkSet;
    207     }
    208 
    209     /**
    210      * @deprecated no longer supported
    211      */
    212     @Deprecated
    213     @Override public void accept(org.openstreetmap.josm.data.osm.visitor.Visitor visitor) {
    214         visitor.visit(this);
    215207    }
    216208
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r13150 r13173  
    472472     * be replaced by plain fill, when it covers a certain fraction of the total area
    473473     * @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     @Deprecated
    478     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 relation
    485      * @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, how
    488      * far to fill from the boundary towards the center of the area;
    489      * if null, area will be filled completely
    490      * @param extentThreshold if not null, determines if the partial filled should
    491      * be replaced by plain fill, when it covers a certain fraction of the total area
    492      * @param disabled If this should be drawn with a special disabled style.
    493474     * @since 12285
    494475     */
     
    516497            }
    517498        }
    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, how
    526      * far to fill from the boundary towards the center of the area;
    527      * if null, area will be filled completely
    528      * @param extentThreshold if not null, determines if the partial filled should
    529      * be replaced by plain fill, when it covers a certain fraction of the total area
    530      * @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     @Deprecated
    535     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);
    537499    }
    538500
  • trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java

    r12868 r13173  
    210210     * @param code unique code for this projection - may be null
    211211     * @param pref the string that defines the custom projection
    212      * @param cacheDir cache directory name
    213      * @deprecated unused - remove in 2017-09
    214      */
    215     @Deprecated
    216     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 words
    224      * @param code unique code for this projection - may be null
    225      * @param pref the string that defines the custom projection
    226212     */
    227213    public CustomProjection(String name, String code, String pref) {
     
    693679    }
    694680
    695     /**
    696      * {@inheritDoc}
    697      * @deprecated unused - remove in 2017-09
    698      */
    699     @Override
    700     @Deprecated
    701     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 
    709681    @Override
    710682    public Bounds getWorldBoundsLatLon() {
  • trunk/src/org/openstreetmap/josm/data/projection/Projection.java

    r12818 r13173  
    5252     */
    5353    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-07
    59      */
    60     @Deprecated
    61     String getCacheDirectoryName();
    6254
    6355    /**
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r12786 r13173  
    1818import java.util.regex.Pattern;
    1919
    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;
    2420import org.openstreetmap.josm.data.projection.datum.Datum;
    2521import org.openstreetmap.josm.data.projection.datum.GRS80Datum;
     
    181177
    182178    /**
    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 coordinates
    187      * @since 12725
    188      * @deprecated use <code>Main.getProjection().latlon2eastNorth(ll)</code>
    189      */
    190     @Deprecated
    191     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 coordinates
    201      * @deprecated use <code>Main.getProjection().latlon2eastNorth(ll)</code>
    202      */
    203     @Deprecated
    204     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     @Deprecated
    216     public static LatLon inverseProject(EastNorth en) {
    217         if (en == null) return null;
    218         return Main.getProjection().eastNorth2latlon(en);
    219     }
    220 
    221     /**
    222179     * Plugins can register additional base projections.
    223180     *
  • trunk/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionItem.java

    r13121 r13173  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.tagging.ac;
    3 
    4 import org.openstreetmap.josm.tools.CheckParameterUtil;
    53
    64/**
     
    7573    }
    7674
    77     /**
    78      * sets the value
    79      * @param value the value; must not be null
    80      * @throws IllegalArgumentException if value if null
    81      * @deprecated value is now final, set it when constructing the object
    82      */
    83     @Deprecated
    84     public void setValue(String value) {
    85         CheckParameterUtil.ensureParameterNotNull(value, "value");
    86         throw new UnsupportedOperationException("setValue() is no longer supported");
    87     }
    88 
    8975    @Override
    9076    public String toString() {
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r13025 r13173  
    476476        if (mainFrame != null) {
    477477            mainPanel = mainFrame.getPanel();
    478             panel = mainPanel;
    479478            mainFrame.initialize();
    480479            menu = mainFrame.getMenu();
    481             super.menu = menu;
    482480        } else {
    483481            // required for running some tests.
    484482            mainPanel = new MainPanel(layerManager);
    485             panel = mainPanel;
    486483            menu = new MainMenu();
    487             super.menu = menu;
    488484        }
    489485        mainPanel.addMapFrameListener((o, n) -> redoUndoListener.commandChanged(0, 0));
     
    10261022        setupUIManager();
    10271023        toolbar = new ToolbarPreferences();
    1028         Main.toolbar = toolbar;
    10291024        ProjectionPreference.setProjection();
    10301025        setupNadGridSources();
     
    10511046            mainFrame.setMaximized(true);
    10521047        }
    1053         if (main.menu.fullscreenToggleAction != null) {
    1054             main.menu.fullscreenToggleAction.initial();
     1048        if (menu.fullscreenToggleAction != null) {
     1049            menu.fullscreenToggleAction.initial();
    10551050        }
    10561051
  • trunk/src/org/openstreetmap/josm/gui/MainPanel.java

    r12675 r13173  
    88import javax.swing.JPanel;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.actions.mapmode.MapMode;
    1211import org.openstreetmap.josm.gui.layer.Layer;
     
    6665        } else {
    6766            map = null;
    68             Main.map = map;
    6967            MainApplication.map = map;
    7068            add(getGettingStarted(), BorderLayout.CENTER);
     
    9088        MapFrame mapFrame = new MapFrame(null);
    9189        // Required by many components.
    92         Main.map = mapFrame;
    9390        MainApplication.map = mapFrame;
    9491
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r13154 r13173  
    3535import javax.swing.AbstractButton;
    3636import javax.swing.JComponent;
    37 import javax.swing.JPanel;
    3837import javax.swing.SwingUtilities;
    3938
     
    255254     * Constructs a new {@code MapView}.
    256255     * @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, then
    259      * the viewport is derived from the layer data.
    260      * @since 10279
    261      * @deprecated use {@link #MapView(MainLayerManager, ViewportData)} instead
    262      */
    263     @Deprecated
    264     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.
    271256     * @param viewportData the initial viewport of the map. Can be null, then
    272257     * the viewport is derived from the layer data.
  • trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java

    r12881 r13173  
    4545import org.openstreetmap.josm.data.PreferencesUtils;
    4646import org.openstreetmap.josm.data.Version;
    47 import org.openstreetmap.josm.spi.preferences.Setting;
    4847import org.openstreetmap.josm.gui.MainApplication;
    4948import org.openstreetmap.josm.plugins.PluginDownloadTask;
     
    5150import org.openstreetmap.josm.plugins.ReadLocalPluginInformationTask;
    5251import org.openstreetmap.josm.spi.preferences.Config;
     52import org.openstreetmap.josm.spi.preferences.Setting;
    5353import org.openstreetmap.josm.tools.LanguageInfo;
    5454import org.openstreetmap.josm.tools.Logging;
     
    6969    private CustomConfigurator() {
    7070        // Hide default constructor for utils classes
    71     }
    72 
    73     /**
    74      * Log a formatted message.
    75      * @param fmt format
    76      * @param vars arguments
    77      * @see String#format
    78      * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#log(String, Object...)} instead
    79      */
    80     @Deprecated
    81     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 log
    88      * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#log(String)} instead
    89      */
    90     @Deprecated
    91     public static void log(String s) {
    92         PreferencesUtils.log(s);
    93     }
    94 
    95     /**
    96      * Log an exception.
    97      * @param e exception to log
    98      * @param s message prefix
    99      * @since 10469
    100      * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#log(Exception, String)} instead
    101      */
    102     @Deprecated
    103     public static void log(Exception e, String s) {
    104         PreferencesUtils.log(e, s);
    105     }
    106 
    107     /**
    108      * Returns the log.
    109      * @return the log
    110      * @deprecated to be removed end of 2017. Use {@link PreferencesUtils#getLog()} instead
    111      */
    112     @Deprecated
    113     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()} instead
    120      */
    121     @Deprecated
    122     public static void resetLog() {
    123         PreferencesUtils.resetLog();
    12471    }
    12572
  • trunk/src/org/openstreetmap/josm/gui/layer/Layer.java

    r13130 r13173  
    502502
    503503    /**
    504      * Check changed status of layer
    505      *
    506      * @return True if layer was changed since last paint
    507      * @deprecated This is not supported by multiple map views.
    508      * Fire an {@link #invalidate()} to trigger a repaint.
    509      */
    510     @Deprecated
    511     public boolean isChanged() {
    512         return false;
    513     }
    514 
    515     /**
    516504     * allows to check whether a projection is supported or not
    517505     * @param proj projection
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

    r12881 r13173  
    2323import javax.swing.ImageIcon;
    2424
    25 import org.openstreetmap.josm.Main;
    26 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
    2725import org.openstreetmap.josm.data.coor.CachedLatLon;
    2826import org.openstreetmap.josm.data.coor.EastNorth;
     
    3533import org.openstreetmap.josm.data.preferences.IntegerProperty;
    3634import org.openstreetmap.josm.gui.MapView;
     35import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
    3736import org.openstreetmap.josm.tools.ImageProvider;
    3837import org.openstreetmap.josm.tools.Logging;
     
    336335
    337336    /**
    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     @Deprecated
    343     public final EastNorth getEastNorth() {
    344         return coor.getEastNorth(Main.getProjection());
    345     }
    346 
    347     /**
    348337     * Checks whether the marker display area contains the given point.
    349338     * Markers not interested in mouse clicks may always return false.
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java

    r12846 r13173  
    4848     * <p>
    4949     * Public access is discouraged.
    50      * @see StyledMapRenderer#drawArea(Way, Color, MapImage, Float, Float, boolean, TextLabel)
     50     * @see StyledMapRenderer#drawArea
    5151     */
    5252    public Float extent;
     
    5656     * <p>
    5757     * Public access is discouraged.
    58      * @see StyledMapRenderer#drawArea(Way, Color, MapImage, Float, Float, boolean, TextLabel)
     58     * @see StyledMapRenderer#drawArea
    5959     */
    6060    public Float extentThreshold;
  • trunk/src/org/openstreetmap/josm/gui/oauth/AbstractAuthorizationUI.java

    r12928 r13173  
    44import java.util.Objects;
    55
    6 import org.openstreetmap.josm.data.Preferences;
    76import org.openstreetmap.josm.data.oauth.OAuthParameters;
    87import org.openstreetmap.josm.data.oauth.OAuthToken;
     
    139138        pnlAdvancedProperties.initialize(paramApiUrl);
    140139    }
    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 null
    147      * @deprecated (since 12928) replaced by {@link #initialize(java.lang.String)}
    148      */
    149     @Deprecated
    150     public void initFromPreferences(Preferences pref) {
    151         CheckParameterUtil.ensureParameterNotNull(pref, "pref");
    152         pnlAdvancedProperties.initFromPreferences(pref);
    153     }
    154140}
  • trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java

    r12928 r13173  
    1616import javax.swing.JOptionPane;
    1717
    18 import org.openstreetmap.josm.data.Preferences;
    1918import org.openstreetmap.josm.data.oauth.OAuthParameters;
    2019import org.openstreetmap.josm.gui.HelpAwareOptionPane;
     
    275274
    276275    /**
    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 null
    281      * @deprecated (since 12928) replaced by {@link #initialize(java.lang.String)}
    282      */
    283     @Deprecated
    284     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     /**
    298276     * Remembers the current values in the preferences <code>pref</code>.
    299277     */
     
    304282        } else {
    305283            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     @Deprecated
    317     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);
    324284        }
    325285    }
  • trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java

    r12928 r13173  
    2929import javax.swing.text.html.HTMLEditorKit;
    3030
    31 import org.openstreetmap.josm.data.Preferences;
    3231import org.openstreetmap.josm.data.oauth.OAuthToken;
    3332import org.openstreetmap.josm.gui.HelpAwareOptionPane;
     
    174173    public void initialize(String paramApiUrl) {
    175174        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 preferences
    195      * @param pref Preferences structure
    196      * @deprecated (since 12928) replaced by {@link #initialize(java.lang.String)}
    197      */
    198     @Deprecated
    199     @Override
    200     public void initFromPreferences(Preferences pref) {
    201         super.initFromPreferences(pref);
    202175        CredentialsAgent cm = CredentialsManager.getInstance();
    203176        try {
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/AbstractProjectionChoice.java

    r12293 r13173  
    5151    }
    5252
    53     /**
    54     * Get the cache directory name.
    55     * @return the cache directory name (base name)
    56     * @deprecated unused - remove in 2017-09
    57     */
    58     @Deprecated
    59     public String getCacheDir() {
    60         return cacheDir;
    61     }
    62 
    6353    @Override
    6454    public String toString() {
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/OverpassServerPreference.java

    r12816 r13173  
    7676        return true;
    7777    }
    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()} instead
    83      */
    84     @Deprecated
    85     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()} instead
    93      */
    94     @Deprecated
    95     public static boolean useForMultiFetch() {
    96         return OverpassDownloadReader.FOR_MULTI_FETCH.get();
    97     }
    9878}
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java

    r13139 r13173  
    1010import java.util.Collection;
    1111import java.util.Locale;
    12 import java.util.stream.Collectors;
    1312
    1413import javax.swing.ComboBoxEditor;
     
    254253        } else if (item instanceof AutoCompletionItem) {
    255254            cbEditor.setItem(((AutoCompletionItem) item).getValue());
    256         } else if (item instanceof AutoCompletionListItem) {
    257             cbEditor.setItem(((AutoCompletionListItem) item).getItem().getValue());
    258255        } else
    259256            throw new IllegalArgumentException("Unsupported item: "+item);
     
    271268        } else if (item instanceof AutoCompletionItem) {
    272269            super.setSelectedItem(item);
    273         } else if (item instanceof AutoCompletionListItem) {
    274             super.setSelectedItem(((AutoCompletionListItem) item).getItem());
    275270        } else if (item instanceof String) {
    276271            String s = (String) item;
     
    304299        this.getEditor().setItem(oldValue); // Do not use setSelectedItem(oldValue); (fix #8013)
    305300        autocompleteEnabled = true;
    306     }
    307 
    308     /**
    309      * Sets the items of the combobox to the given {@code AutoCompletionListItem}s.
    310      * @param elems AutoCompletionListItem items
    311      * @deprecated to be removed end of 2017. Use {@link #setPossibleAcItems(Collection)} instead
    312      */
    313     @Deprecated
    314     public void setPossibleACItems(Collection<AutoCompletionListItem> elems) {
    315         setPossibleAcItems(elems.stream().map(AutoCompletionListItem::getItem).collect(Collectors.toList()));
    316301    }
    317302
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java

    r13170 r13173  
    2020import javax.swing.text.StyleConstants;
    2121
     22import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem;
    2223import org.openstreetmap.josm.gui.util.CellEditorSupport;
    2324import org.openstreetmap.josm.gui.widgets.JosmTextField;
     
    2930 * can be used as table cell editor in {@link JTable}s.
    3031 *
    31  * Autocompletion is controlled by a list of {@link AutoCompletionListItem}s
     32 * Autocompletion is controlled by a list of {@link AutoCompletionItem}s
    3233 * managed in a {@link AutoCompletionList}.
    3334 *
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java

    r12859 r13173  
    55import java.util.Collection;
    66import java.util.Collections;
    7 import java.util.List;
    87import java.util.Set;
    9 import java.util.stream.Collectors;
    108
    119import javax.swing.JTable;
     
    5149
    5250    /**
    53      * applies a filter expression to the list of {@link AutoCompletionListItem}s.
     51     * applies a filter expression to the list of {@link AutoCompletionItem}s.
    5452     *
    5553     * The matching criterion is a case insensitive substring match.
     
    8179
    8280    /**
    83      * adds an {@link AutoCompletionListItem} to the list. Only adds the item if it
    84      * is not null and if not in the list yet.
    85      *
    86      * @param item the item
    87      * @deprecated To be removed end of 2017. Use {@link #add(AutoCompletionItem)} instead
    88      */
    89     @Deprecated
    90     public void add(AutoCompletionListItem item) {
    91         if (item == null)
    92             return;
    93         add(item.getItem());
    94     }
    95 
    96     /**
    9781     * adds an {@link AutoCompletionItem} to the list. Only adds the item if it
    9882     * is not null and if not in the list yet.
     
    135119
    136120    /**
    137      * adds a list of {@link AutoCompletionListItem} to this list. Only items which
    138      * 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 null
    141      * @throws IllegalArgumentException if other is null
    142      * @deprecated to be removed end of 2017. Use {@link #add(Collection)} instead
    143      */
    144     @Deprecated
    145     public void add(List<AutoCompletionListItem> other) {
    146         CheckParameterUtil.ensureParameterNotNull(other, "other");
    147         add(other.stream().map(AutoCompletionListItem::getItem).collect(Collectors.toList()));
    148     }
    149 
    150     /**
    151121     * adds a list of strings to this list. Only strings which
    152122     * are not null and which do not exist yet in the list are added.
     
    154124     * @param values a list of strings to add
    155125     * @param priority the priority to use
    156      * @deprecated to be removed end of 2017. Use {@link #add(Collection, AutoCompletionPriority)} instead
    157      */
    158     @Deprecated
    159     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 which
    165      * are not null and which do not exist yet in the list are added.
    166      *
    167      * @param values a list of strings to add
    168      * @param priority the priority to use
    169126     * @since 12859
    170127     */
     
    183140            filter();
    184141        }
    185     }
    186 
    187     /**
    188      * checks whether a specific item is already in the list. Matches for the
    189      * the value <strong>and</strong> the priority of the item
    190      *
    191      * @param item the item to check
    192      * @return true, if item is in the list; false, otherwise
    193      * @deprecated to be removed end of 2017. Use {@link #contains(AutoCompletionItem)} instead
    194      */
    195     @Deprecated
    196     public boolean contains(AutoCompletionListItem item) {
    197         if (item == null)
    198             return false;
    199         return contains(item.getItem());
    200142    }
    201143
     
    264206     *
    265207     * @throws IndexOutOfBoundsException if idx is out of bounds
    266      * @deprecated to be removed end of 2017. Use {@link #getFilteredItemAt(int)} instead
    267      */
    268     @Deprecated
    269     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 items
    275      * @param idx the index; must be in the range 0 &lt;= idx &lt; {@link #getFilteredSize()}
    276      * @return the item
    277      *
    278      * @throws IndexOutOfBoundsException if idx is out of bounds
    279208     * @since 12859
    280209     */
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java

    r13121 r13173  
    245245    /**
    246246     * 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 #getKeys()}.
     247     * an empty list if key is null or if key is not in {@link #getTagKeys()}.
    248248     *
    249249     * @param key OSM key
     
    343343            list.addUserInput(getUserInputValues(key));
    344344        }
    345     }
    346 
    347     /**
    348      * Returns the currently cached tag keys.
    349      * @return a list of tag keys
    350      * @deprecated to be removed end of 2017. Use {@link #getTagKeys()} instead
    351      */
    352     @Deprecated
    353     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 key
    360      * @return a list of tag values
    361      * @deprecated to be removed end of 2017. Use {@link #getTagValues(String)} instead
    362      */
    363     @Deprecated
    364     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 keys
    371      * @return a list of tag values
    372      * @deprecated to be removed end of 2017. Use {@link #getTagValues(List)} instead
    373      */
    374     @Deprecated
    375     public List<AutoCompletionListItem> getValues(List<String> keys) {
    376         return getTagValues(keys).stream().map(AutoCompletionListItem::new).collect(Collectors.toList());
    377345    }
    378346
  • trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java

    r12620 r13173  
    3636
    3737    private final List<KeyPressReleaseListener> keyListeners = new CopyOnWriteArrayList<>();
    38     /** @deprecated replaced by {@link #modifierExListeners} */
    39     @Deprecated
    40     private final List<ModifierListener> modifierListeners = new CopyOnWriteArrayList<>();
    4138    private final ListenerList<ModifierExListener> modifierExListeners = ListenerList.create();
    42     /** @deprecated replaced by {@link #previousModifiersEx} */
    43     @Deprecated
    44     private int previousModifiers;
    4539    private int previousModifiersEx;
    4640
     
    5347    public void addKeyListener(KeyPressReleaseListener l) {
    5448        keyListeners.add(l);
    55     }
    56 
    57     /**
    58      * Adds an object that wants to receive key modifier changed events.
    59      * @param l listener to add
    60      * @deprecated use {@link #addModifierExListener} instead
    61      */
    62     @Deprecated
    63     public void addModifierListener(ModifierListener l) {
    64         modifierListeners.add(l);
    6549    }
    6650
     
    8064    public void removeKeyListener(KeyPressReleaseListener l) {
    8165        keyListeners.remove(l);
    82     }
    83 
    84     /**
    85      * Removes the key modifier listener.
    86      * @param l listener to remove
    87      * @deprecated use {@link #removeModifierExListener} instead
    88      */
    89     @Deprecated
    90     public void removeModifierListener(ModifierListener l) {
    91         modifierListeners.remove(l);
    9266    }
    9367
     
    131105        if (!keyListeners.isEmpty()) {
    132106            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());
    136107        }
    137108        if (modifierExListeners.hasListeners()) {
     
    183154        KeyEvent ke = (KeyEvent) e;
    184155
    185         // check if ctrl, alt, shift modifiers are changed
    186         int modif = ke.getModifiers();
    187         if (previousModifiers != modif) {
    188             previousModifiers = modif;
    189             for (ModifierListener m: modifierListeners) {
    190                 m.modifiersChanged(modif);
    191             }
    192         }
    193 
    194156        // check if ctrl, alt, shift extended modifiers are changed
    195157        int modifEx = ke.getModifiersEx();
  • trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java

    r12748 r13173  
    2121import java.awt.Window;
    2222import java.awt.event.ActionListener;
    23 import java.awt.event.KeyEvent;
    2423import java.awt.event.MouseAdapter;
    2524import java.awt.event.MouseEvent;
     
    6665import org.openstreetmap.josm.tools.LanguageInfo;
    6766import org.openstreetmap.josm.tools.Logging;
    68 import org.openstreetmap.josm.tools.PlatformHook;
    6967import org.openstreetmap.josm.tools.bugreport.BugReport;
    7068import org.openstreetmap.josm.tools.bugreport.ReportedException;
     
    462460
    463461    /**
    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 extended
    468      *    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 shortcuts
    472      * @since 7539
    473      * @deprecated to be removed end of 2017. Use {@link PlatformHook#getMenuShortcutKeyMaskEx()} instead
    474      */
    475     @Deprecated
    476     public static int getMenuShortcutKeyMaskEx() {
    477         return Main.isPlatformOsx() ? KeyEvent.META_DOWN_MASK : KeyEvent.CTRL_DOWN_MASK;
    478     }
    479 
    480     /**
    481462     * Sets a global font for all UI, replacing default font of current look and feel.
    482463     * @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  
    2020import org.openstreetmap.josm.data.preferences.sources.SourceEntry;
    2121import org.openstreetmap.josm.data.preferences.sources.SourceType;
    22 import org.openstreetmap.josm.gui.mappaint.StyleSource;
    2322import org.openstreetmap.josm.tools.CheckParameterUtil;
    2423import org.openstreetmap.josm.tools.Logging;
     
    5554            thread.start();
    5655        }
    57     }
    58 
    59     /**
    60      * Registers a map paint style for local file changes, allowing dynamic reloading.
    61      * @param style The style to watch
    62      * @throws IllegalArgumentException if {@code style} is null or if it does not provide a local file
    63      * @throws IllegalStateException if the watcher service failed to start
    64      * @throws IOException if an I/O error occurs
    65      * @deprecated To be removed end of 2017. Use {@link #registerSource} instead
    66      */
    67     @Deprecated
    68     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 watch
    75      * @throws IllegalArgumentException if {@code rule} is null or if it does not provide a local file
    76      * @throws IllegalStateException if the watcher service failed to start
    77      * @throws IOException if an I/O error occurs
    78      * @since 7276
    79      * @deprecated To be removed end of 2017. Use {@link #registerSource} instead
    80      */
    81     @Deprecated
    82     public void registerValidatorRule(SourceEntry rule) throws IOException {
    83         registerSource(rule);
    8456    }
    8557
  • trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java

    r12816 r13173  
    3131import org.openstreetmap.josm.data.projection.Projection;
    3232import org.openstreetmap.josm.data.projection.Projections;
    33 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3433import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    3534import org.openstreetmap.josm.tools.Logging;
     
    4645    private final Projection projection;
    4746    private static final boolean SKIP_EMPTY_NODES = true;
    48 
    49     /**
    50      * Constructs a new {@code GeoJSONWriter}.
    51      * @param layer The OSM data layer to save
    52      * @since 10852
    53      * @deprecated To be removed end of 2017. Use {@link #GeoJSONWriter(DataSet)} instead
    54      */
    55     @Deprecated
    56     public GeoJSONWriter(OsmDataLayer layer) {
    57         this(layer.data);
    58     }
    5947
    6048    /**
  • trunk/src/org/openstreetmap/josm/io/OsmWriter.java

    r12802 r13173  
    2929import org.openstreetmap.josm.data.osm.Way;
    3030import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
    31 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3231import org.openstreetmap.josm.tools.date.DateUtils;
    3332
     
    128127        result.sort(byIdComparator);
    129128        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 layer
    135      * @deprecated To be removed end of 2017. Use {@link #write(DataSet)} instead
    136      */
    137     @Deprecated
    138     public void writeLayer(OsmDataLayer layer) {
    139         write(layer.data);
    140129    }
    141130
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r12925 r13173  
    717717
    718718    /**
    719      * Method to get the (now obsolete) class loader for loading plugin code.
    720      *
    721      * @return the class loader
    722      * @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     @Deprecated
    727     public static synchronized DynamicURLClassLoader getPluginClassLoader() {
    728         return getJoinedPluginResourceCL();
    729     }
    730 
    731     /**
    732719     * Get class loader to locate resources from plugins.
    733720     *
  • trunk/src/org/openstreetmap/josm/tools/CheckParameterUtil.java

    r12822 r13173  
    55import java.util.function.Predicate;
    66import 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;
    127
    138/**
     
    6560
    6661    /**
    67      * Ensures an OSM primitive ID is valid
    68      * @param id The id to check
    69      * @param parameterName The parameter name
    70      * @throws IllegalArgumentException if the primitive ID is not valid (negative or zero)
    71      * @deprecated use {@link #ensure(Object, String, String, Predicate)}
    72      */
    73     @Deprecated
    74     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 valid
    83      * @param latlon The lat/lon to check
    84      * @param parameterName The parameter name
    85      * @throws IllegalArgumentException if the lat/lon are {@code null} or not valid
    86      * @since 5980
    87      * @deprecated use {@link #ensure(Object, String, Predicate)}
    88      */
    89     @Deprecated
    90     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 valid
    99      * @param eastnorth The east/north to check
    100      * @param parameterName The parameter name
    101      * @throws IllegalArgumentException if the east/north are {@code null} or not valid
    102      * @since 5980
    103      * @deprecated use {@link #ensure(Object, String, Predicate)}
    104      */
    105     @Deprecated
    106     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 valid
    115      * @param version The version to check
    116      * @param parameterName The parameter name
    117      * @throws IllegalArgumentException if the version is not valid (negative)
    118      * @deprecated use {@link #ensure(Object, String, String, Predicate)}
    119      */
    120     @Deprecated
    121     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     /**
    12862     * Ensures a parameter is not {@code null}
    12963     * @param value The parameter to check
     
    174108            throw new IllegalArgumentException(messageSupplier.get());
    175109    }
    176 
    177     /**
    178      * Ensures that <code>id</code> is non-null primitive id of type {@link OsmPrimitiveType#NODE}
    179      *
    180      * @param id the primitive  id
    181      * @param parameterName the name of the parameter to be checked
    182      * @throws IllegalArgumentException if id is null
    183      * @throws IllegalArgumentException if id.getType() != NODE
    184      * @deprecated use {@link #ensure(Object, String, String, Predicate)}
    185      */
    186     @Deprecated
    187     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     }
    193110}
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r12987 r13173  
    5959import java.util.regex.Pattern;
    6060import java.util.stream.Stream;
    61 import java.util.zip.GZIPInputStream;
    6261import java.util.zip.ZipFile;
    63 import java.util.zip.ZipInputStream;
    6462
    6563import javax.xml.XMLConstants;
     
    7068import javax.xml.parsers.SAXParserFactory;
    7169
    72 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
    73 import org.openstreetmap.josm.io.Compression;
    7470import org.openstreetmap.josm.spi.preferences.Config;
    7571import org.w3c.dom.Document;
     
    721717            }
    722718        };
    723     }
    724 
    725     /**
    726      * Returns a Bzip2 input stream wrapping given input stream.
    727      * @param in The raw input stream
    728      * @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 header
    730      * @since 7867
    731      * @deprecated use {@link Compression#getBZip2InputStream(java.io.InputStream)}
    732      */
    733     @Deprecated
    734     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 stream
    741      * @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 occurred
    743      * @since 7119
    744      * @deprecated use {@link Compression#getGZipInputStream(java.io.InputStream)}
    745      */
    746     @Deprecated
    747     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 stream
    754      * @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 occurred
    756      * @since 7119
    757      * @deprecated use {@link Compression#getZipInputStream(java.io.InputStream)}
    758      */
    759     @Deprecated
    760     public static ZipInputStream getZipInputStream(InputStream in) throws IOException {
    761         return Compression.getZipInputStream(in);
    762719    }
    763720
  • trunk/src/org/openstreetmap/josm/tools/template_engine/Condition.java

    r13076 r13173  
    2828    public Condition() {
    2929        this.entries = new ArrayList<>();
    30     }
    31 
    32     /**
    33      * Returns template entries.
    34      * @return template entries
    35      * @deprecated (since 13003) use constructor {@link #Condition(java.util.Collection)} to set the entries
    36      */
    37     @Deprecated
    38     public List<TemplateEntry> getEntries() {
    39         return entries;
    4030    }
    4131
Note: See TracChangeset for help on using the changeset viewer.