Changeset 6471 in josm for trunk/src


Ignore:
Timestamp:
2013-12-11T00:51:08+01:00 (10 years ago)
Author:
Don-vip
Message:

Sonar - remove warnings related to the static preferences initialization in instance methods

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

Legend:

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

    r6453 r6471  
    1818import java.net.URI;
    1919import java.net.URISyntaxException;
     20import java.net.URL;
    2021import java.text.MessageFormat;
    2122import java.util.ArrayList;
     
    5455import org.openstreetmap.josm.data.Bounds;
    5556import org.openstreetmap.josm.data.Preferences;
     57import org.openstreetmap.josm.data.ServerSidePreferences;
    5658import org.openstreetmap.josm.data.UndoRedoHandler;
    5759import org.openstreetmap.josm.data.coor.CoordinateFormat;
     
    335337
    336338    /**
     339     * Initializes {@code Main.pref} in applet context.
     340     * @param serverURL The server URL hosting the user preferences.
     341     * @since 6471
     342     */
     343    public static void initAppletPreferences(URL serverURL) {
     344        Main.pref = new ServerSidePreferences(serverURL);
     345    }
     346
     347    /**
     348     * Initializes {@code Main.pref} in normal application context.
     349     * @since 6471
     350     */
     351    public static void initApplicationPreferences() {
     352        Main.pref = new Preferences();
     353    }
     354
     355    /**
    337356     * Set or clear (if passed <code>null</code>) the map.
    338357     * @param map The map to set {@link Main#map} to. Can be null.
  • trunk/src/org/openstreetmap/josm/gui/MainApplet.java

    r6380 r6471  
    101101        Main.platform.preStartupHook();
    102102
    103         Main.pref = new ServerSidePreferences(getCodeBase());
     103        Main.initAppletPreferences(getCodeBase());
    104104
    105105        String lang = getParameter("language");
     
    166166        Main.applet = true;
    167167        MainApplet applet = new MainApplet();
    168         Main.pref = new ServerSidePreferences(applet.getCodeBase());
     168        Main.initAppletPreferences(applet.getCodeBase());
    169169        applet.setStub(new AppletStub() {
    170170            @Override
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r6453 r6471  
    273273        }
    274274
    275         Main.pref = new Preferences();
     275        initApplicationPreferences();
    276276
    277277        Policy.setPolicy(new Policy() {
Note: See TracChangeset for help on using the changeset viewer.