Changeset 14145 in josm


Ignore:
Timestamp:
2018-08-12T14:52:47+02:00 (6 years ago)
Author:
Don-vip
Message:

see #15229 - code refactoring - make Preferences.getAllPossiblePreferenceDirs() static

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

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

    r14144 r14145  
    275275     * @return A set of all existing directories where resources could be stored.
    276276     */
    277     public Collection<String> getAllPossiblePreferenceDirs() {
     277    public static Collection<String> getAllPossiblePreferenceDirs() {
    278278        Set<String> locations = new HashSet<>();
    279         addPossibleResourceDir(locations, dirs.getPreferencesDirectory(false).getPath());
    280         addPossibleResourceDir(locations, dirs.getUserDataDirectory(false).getPath());
     279        addPossibleResourceDir(locations, Config.getDirs().getPreferencesDirectory(false).getPath());
     280        addPossibleResourceDir(locations, Config.getDirs().getUserDataDirectory(false).getPath());
    281281        addPossibleResourceDir(locations, getSystemEnv("JOSM_RESOURCES"));
    282282        addPossibleResourceDir(locations, getSystemProperty("josm.resources"));
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r13993 r14145  
    2626import javax.swing.ImageIcon;
    2727
    28 import org.openstreetmap.josm.Main;
     28import org.openstreetmap.josm.data.Preferences;
    2929import org.openstreetmap.josm.data.Version;
    3030import org.openstreetmap.josm.tools.ImageProvider;
     
    416416     */
    417417    public static Collection<String> getPluginLocations() {
    418         Collection<String> locations = Main.pref.getAllPossiblePreferenceDirs();
     418        Collection<String> locations = Preferences.getAllPossiblePreferenceDirs();
    419419        Collection<String> all = new ArrayList<>(locations.size());
    420420        for (String s : locations) {
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r14105 r14145  
    6161import javax.xml.parsers.ParserConfigurationException;
    6262
    63 import org.openstreetmap.josm.Main;
     63import org.openstreetmap.josm.data.Preferences;
    6464import org.openstreetmap.josm.data.osm.DataSet;
    6565import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    12441244
    12451245        // Try all other resource directories
    1246         if (Main.pref != null) {
    1247             for (String location : Main.pref.getAllPossiblePreferenceDirs()) {
    1248                 u = getImageUrl(location + "images", imageName);
    1249                 if (u != null)
    1250                     return u;
    1251                 u = getImageUrl(location, imageName);
    1252                 if (u != null)
    1253                     return u;
    1254             }
     1246        for (String location : Preferences.getAllPossiblePreferenceDirs()) {
     1247            u = getImageUrl(location + "images", imageName);
     1248            if (u != null)
     1249                return u;
     1250            u = getImageUrl(location, imageName);
     1251            if (u != null)
     1252                return u;
    12551253        }
    12561254
Note: See TracChangeset for help on using the changeset viewer.