Ignore:
Timestamp:
2018-07-06T01:32:11+02:00 (3 years ago)
Author:
Don-vip
Message:

remove deprecated API

File:
1 edited

Legend:

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

    r13193 r14005  
    55
    66import java.io.File;
    7 import java.io.FileNotFoundException;
    8 import java.io.IOException;
    9 import java.io.InputStream;
    107import java.net.URL;
    118import java.net.URLClassLoader;
    12 import java.nio.file.Files;
    13 import java.nio.file.StandardCopyOption;
    149import java.security.AccessController;
    1510import java.security.PrivilegedAction;
     
    138133    }
    139134
    140     /**
    141      * @return The directory for the plugin to store all kind of stuff.
    142      * @deprecated (since 13007) to get the same directory as this method, use {@code getPluginDirs().getUserDataDirectory(false)}.
    143      * However, for files that can be characterized as cache or preferences, you are encouraged to use the appropriate
    144      * {@link IBaseDirectories} method from {@link #getPluginDirs()}.
    145      */
    146     @Deprecated
    147     public String getPluginDir() {
    148         return new File(Main.pref.getPluginsDirectory(), info.name).getPath();
    149     }
    150 
    151135    @Override
    152136    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {}
     
    167151     */
    168152    public void addDownloadSelection(List<DownloadSelection> list) {}
    169 
    170     /**
    171      * Copies the resource 'from' to the file in the plugin directory named 'to'.
    172      * @param from source file
    173      * @param to target file
    174      * @throws FileNotFoundException if the file exists but is a directory rather than a regular file,
    175      * does not exist but cannot be created, or cannot be opened for any other reason
    176      * @throws IOException if any other I/O error occurs
    177      * @deprecated without replacement
    178      */
    179     @Deprecated
    180     public void copy(String from, String to) throws IOException {
    181         String pluginDirName = getPluginDir();
    182         File pluginDir = new File(pluginDirName);
    183         if (!pluginDir.exists()) {
    184             Utils.mkDirs(pluginDir);
    185         }
    186         try (InputStream in = getClass().getResourceAsStream(from)) {
    187             if (in == null) {
    188                 throw new IOException("Resource not found: "+from);
    189             }
    190             Files.copy(in, new File(pluginDirName, to).toPath(), StandardCopyOption.REPLACE_EXISTING);
    191         }
    192     }
    193153
    194154    /**
Note: See TracChangeset for help on using the changeset viewer.