Changeset 14138 in josm


Ignore:
Timestamp:
2018-08-12T02:21:19+02:00 (6 weeks ago)
Author:
Don-vip
Message:

see #15229 - deprecate Main.platform and related methods - new class PlatformManager

Location:
trunk
Files:
1 added
126 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/I18nSimilarStrings.java

    r14134 r14138  
    33import java.util.List;
    44
    5 import org.openstreetmap.josm.Main;
    65import org.openstreetmap.josm.data.Preferences;
    76import org.openstreetmap.josm.data.preferences.JosmBaseDirectories;
     
    2625    public static void main(String[] args) {
    2726        I18n.init();
    28         Main.determinePlatformHook();
    2927        Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance());
    3028        Config.setUrlsProvider(JosmUrls.getInstance());
  • trunk/src/org/openstreetmap/josm/Main.java

    r14134 r14138  
    4141import org.openstreetmap.josm.tools.JosmRuntimeException;
    4242import org.openstreetmap.josm.tools.Logging;
    43 import org.openstreetmap.josm.tools.Platform;
    4443import org.openstreetmap.josm.tools.PlatformHook;
    45 import org.openstreetmap.josm.tools.PlatformHookOsx;
    46 import org.openstreetmap.josm.tools.PlatformHookWindows;
     44import org.openstreetmap.josm.tools.PlatformManager;
    4745import org.openstreetmap.josm.tools.Utils;
    4846import org.openstreetmap.josm.tools.bugreport.BugReport;
     
    8886     * So if you need to hook into those early ones, split your class and send the one with the early hooks
    8987     * to the JOSM team for inclusion.
    90      */
    91     public static volatile PlatformHook platform;
     88     * @deprecated Use {@link PlatformManager#getPlatform}
     89     */
     90    @Deprecated
     91    public static final PlatformHook platform = PlatformManager.getPlatform();
    9292
    9393    /**
     
    291291     * Identifies the current operating system family and initializes the platform hook accordingly.
    292292     * @since 1849
    293      */
     293     * @deprecated Not needed anymore
     294     */
     295    @Deprecated
    294296    public static void determinePlatformHook() {
    295         platform = Platform.determinePlatform().accept(PlatformHook.CONSTRUCT_FROM_PLATFORM);
     297        // Do nothing
    296298    }
    297299
     
    461463     * @return {@code true} if we are currently running on OSX
    462464     * @since 6957
    463      */
     465     * @deprecated Use {@link PlatformManager#isPlatformOsx}
     466     */
     467    @Deprecated
    464468    public static boolean isPlatformOsx() {
    465         return Main.platform instanceof PlatformHookOsx;
     469        return PlatformManager.isPlatformOsx();
    466470    }
    467471
     
    470474     * @return {@code true} if we are currently running on Windows
    471475     * @since 7335
    472      */
     476     * @deprecated Use {@link PlatformManager#isPlatformWindows}
     477     */
     478    @Deprecated
    473479    public static boolean isPlatformWindows() {
    474         return Main.platform instanceof PlatformHookWindows;
     480        return PlatformManager.isPlatformWindows();
    475481    }
    476482
  • trunk/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java

    r12846 r14138  
    2323import org.openstreetmap.josm.gui.util.GuiHelper;
    2424import org.openstreetmap.josm.spi.preferences.Config;
     25import org.openstreetmap.josm.tools.PlatformManager;
    2526import org.openstreetmap.josm.tools.Shortcut;
    2627
     
    9899        // screen by default (it's a simulated mode, but should be ok)
    99100        String exclusive = Config.getPref().get("draw.fullscreen.exclusive-mode", "auto");
    100         if (("true".equals(exclusive) || ("auto".equals(exclusive) && !Main.isPlatformWindows())) && gd != null) {
     101        if (("true".equals(exclusive) || ("auto".equals(exclusive) && !PlatformManager.isPlatformWindows())) && gd != null) {
    101102            gd.setFullScreenWindow(selected ? frame : null);
    102103        }
  • trunk/src/org/openstreetmap/josm/actions/JosmAction.java

    r14012 r14138  
    3838import org.openstreetmap.josm.tools.ImageResource;
    3939import org.openstreetmap.josm.tools.Logging;
     40import org.openstreetmap.josm.tools.PlatformManager;
    4041import org.openstreetmap.josm.tools.Shortcut;
    4142
     
    287288    public final void setTooltip(String tooltip) {
    288289        if (tooltip != null) {
    289             putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
     290            putValue(SHORT_DESCRIPTION, PlatformManager.getPlatform().makeTooltip(tooltip, sc));
    290291        }
    291292    }
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r13727 r14138  
    4545import org.openstreetmap.josm.tools.Logging;
    4646import org.openstreetmap.josm.tools.MultiMap;
     47import org.openstreetmap.josm.tools.PlatformManager;
    4748import org.openstreetmap.josm.tools.Shortcut;
    4849import org.openstreetmap.josm.tools.Utils;
     
    135136            for (final File file : files) {
    136137                if (file.exists()) {
    137                     this.files.add(Main.platform.resolveFileLink(file));
     138                    this.files.add(PlatformManager.getPlatform().resolveFileLink(file));
    138139                } else if (file.getParentFile() != null) {
    139140                    // try to guess an extension using the specified fileFilter
  • trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java

    r13130 r14138  
    2020import org.openstreetmap.josm.spi.preferences.Config;
    2121import org.openstreetmap.josm.tools.ImageProvider;
     22import org.openstreetmap.josm.tools.PlatformManager;
    2223
    2324/**
     
    9697                if (!SaveActionBase.confirmOverwrite(newFile))
    9798                    return;
    98                 if (Main.platform.rename(file, newFile)) {
     99                if (PlatformManager.getPlatform().rename(file, newFile)) {
    99100                    layer.setAssociatedFile(newFile);
    100101                    if (!layer.isRenamed()) {
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r13843 r14138  
    1616import java.util.List;
    1717
    18 import org.openstreetmap.josm.Main;
    1918import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
    2019import org.openstreetmap.josm.gui.MainApplication;
     
    2423import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    2524import org.openstreetmap.josm.tools.Logging;
     25import org.openstreetmap.josm.tools.PlatformManager;
    2626import org.openstreetmap.josm.tools.Shortcut;
    2727
     
    9292        final List<String> cmd;
    9393        // special handling for OSX .app package
    94         if (Main.isPlatformOsx() && getSystemProperty("java.library.path").contains("/JOSM.app/Contents/MacOS")) {
     94        if (PlatformManager.isPlatformOsx() && getSystemProperty("java.library.path").contains("/JOSM.app/Contents/MacOS")) {
    9595            cmd = getAppleCommands();
    9696        } else {
     
    177177    private static String getJavaRuntime() throws IOException {
    178178        final String java = getSystemProperty("java.home") + File.separator + "bin" + File.separator +
    179                 (Main.isPlatformWindows() ? "java.exe" : "java");
     179                (PlatformManager.isPlatformWindows() ? "java.exe" : "java");
    180180        if (!new File(java).isFile()) {
    181181            throw new IOException("Unable to find suitable java runtime at "+java);
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r14119 r14138  
    4343import org.openstreetmap.josm.tools.Logging;
    4444import org.openstreetmap.josm.tools.PlatformHookUnixoid;
     45import org.openstreetmap.josm.tools.PlatformManager;
    4546import org.openstreetmap.josm.tools.Shortcut;
    4647import org.openstreetmap.josm.tools.Utils;
     
    8990        text.append(Version.getInstance().getReleaseAttributes())
    9091            .append("\nIdentification: ").append(Version.getInstance().getAgentString());
    91         String buildNumber = Main.platform.getOSBuildNumber();
     92        String buildNumber = PlatformManager.getPlatform().getOSBuildNumber();
    9293        if (!buildNumber.isEmpty()) {
    9394            text.append("\nOS Build number: ").append(buildNumber);
     
    119120            .append((int) maxScreenSize.getHeight()).append('\n');
    120121
    121         if (Main.platform instanceof PlatformHookUnixoid) {
     122        if (PlatformManager.isPlatformUnixoid()) {
     123            PlatformHookUnixoid platform = (PlatformHookUnixoid) PlatformManager.getPlatform();
    122124            // Add Java package details
    123             String packageDetails = ((PlatformHookUnixoid) Main.platform).getJavaPackageDetails();
     125            String packageDetails = platform.getJavaPackageDetails();
    124126            if (packageDetails != null) {
    125127                text.append("Java package: ")
     
    129131            // Add WebStart package details if run from JNLP
    130132            if (isRunningJavaWebStart()) {
    131                 String webStartDetails = ((PlatformHookUnixoid) Main.platform).getWebStartPackageDetails();
     133                String webStartDetails = platform.getWebStartPackageDetails();
    132134                if (webStartDetails != null) {
    133135                    text.append("WebStart package: ")
     
    137139            }
    138140            // Add Gnome Atk wrapper details if found
    139             String atkWrapperDetails = ((PlatformHookUnixoid) Main.platform).getAtkWrapperPackageDetails();
     141            String atkWrapperDetails = platform.getAtkWrapperPackageDetails();
    140142            if (atkWrapperDetails != null) {
    141143                text.append("Java ATK Wrapper package: ")
     
    230232    private static String paramCleanup(String param) {
    231233        final String envJavaHome = getSystemEnv("JAVA_HOME");
    232         final String envJavaHomeAlt = Main.isPlatformWindows() ? "%JAVA_HOME%" : "${JAVA_HOME}";
     234        final String envJavaHomeAlt = PlatformManager.isPlatformWindows() ? "%JAVA_HOME%" : "${JAVA_HOME}";
    233235        final String propJavaHome = getSystemProperty("java.home");
    234236        final String propJavaHomeAlt = "<java.home>";
     
    240242        final String userCacheDirAlt = "<josm.cache>";
    241243        final String userHomeDir = getSystemProperty("user.home");
    242         final String userHomeDirAlt = Main.isPlatformWindows() ? "%UserProfile%" : "${HOME}";
     244        final String userHomeDirAlt = PlatformManager.isPlatformWindows() ? "%UserProfile%" : "${HOME}";
    243245        final String userName = getSystemProperty("user.name");
    244246        final String userNameAlt = "<user.name>";
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r14134 r14138  
    5858import org.openstreetmap.josm.tools.Logging;
    5959import org.openstreetmap.josm.tools.Pair;
     60import org.openstreetmap.josm.tools.PlatformManager;
    6061import org.openstreetmap.josm.tools.Shortcut;
    6162import org.openstreetmap.josm.tools.Utils;
     
    343344                c = "lasso";
    344345            } else {
    345                 c = "rect" + (shift ? "_add" : (ctrl && !Main.isPlatformOsx() ? "_rm" : ""));
     346                c = "rect" + (shift ? "_add" : (ctrl && !PlatformManager.isPlatformOsx() ? "_rm" : ""));
    346347            }
    347348            break;
     
    446447        case SELECT:
    447448        default:
    448             if (!(ctrl && Main.isPlatformOsx())) {
     449            if (!(ctrl && PlatformManager.isPlatformOsx())) {
    449450                // start working with rectangle or lasso
    450451                selectionManager.register(mv, lassoMode);
     
    462463    public void mouseMoved(MouseEvent e) {
    463464        // Mac OSX simulates with ctrl + mouse 1 the second mouse button hence no dragging events get fired.
    464         if (Main.isPlatformOsx() && (mode == Mode.ROTATE || mode == Mode.SCALE)) {
     465        if (PlatformManager.isPlatformOsx() && (mode == Mode.ROTATE || mode == Mode.SCALE)) {
    465466            mouseDragged(e);
    466467            return;
     
    490491        if (mode == Mode.SELECT) {
    491492            // Unregisters selectionManager if ctrl has been pressed after mouse click on Mac OS X in order to move the map
    492             if (ctrl && Main.isPlatformOsx()) {
     493            if (ctrl && PlatformManager.isPlatformOsx()) {
    493494                selectionManager.unregister(mv);
    494495                // Make sure correct cursor is displayed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r14122 r14138  
    5252import org.openstreetmap.josm.tools.ListenerList;
    5353import org.openstreetmap.josm.tools.Logging;
     54import org.openstreetmap.josm.tools.PlatformManager;
    5455import org.openstreetmap.josm.tools.Utils;
    5556import org.xml.sax.SAXException;
     
    280281        addPossibleResourceDir(locations, getSystemEnv("JOSM_RESOURCES"));
    281282        addPossibleResourceDir(locations, getSystemProperty("josm.resources"));
    282         if (Main.isPlatformWindows()) {
     283        if (PlatformManager.isPlatformWindows()) {
    283284            String appdata = getSystemEnv("APPDATA");
    284285            if (appdata != null && getSystemEnv("ALLUSERSPROFILE") != null
     
    521522            } else if (reset) {
    522523                File backupFile = new File(prefDir, "preferences.xml.bak");
    523                 Main.platform.rename(preferenceFile, backupFile);
     524                PlatformManager.getPlatform().rename(preferenceFile, backupFile);
    524525                Logging.warn(tr("Replacing existing preference file ''{0}'' with default preference file.", preferenceFile.getAbsoluteFile()));
    525526                resetToDefault();
     
    555556                );
    556557            }
    557             Main.platform.rename(preferenceFile, backupFile);
     558            PlatformManager.getPlatform().rename(preferenceFile, backupFile);
    558559            try {
    559560                resetToDefault();
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r13647 r14138  
    1010import java.util.Properties;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.tools.LanguageInfo;
    1413import org.openstreetmap.josm.tools.Logging;
     14import org.openstreetmap.josm.tools.PlatformManager;
    1515import org.openstreetmap.josm.tools.Utils;
    1616
     
    187187        }
    188188        String result = "JOSM/1.5 ("+ s+' '+LanguageInfo.getJOSMLocaleCode()+')';
    189         if (includeOsDetails && Main.platform != null) {
    190             result += ' ' + Main.platform.getOSDescription();
     189        if (includeOsDetails) {
     190            result += ' ' + PlatformManager.getPlatform().getOSDescription();
    191191        }
    192192        return result;
  • trunk/src/org/openstreetmap/josm/data/preferences/JosmBaseDirectories.java

    r14052 r14138  
    1414import org.openstreetmap.josm.spi.preferences.IBaseDirectories;
    1515import org.openstreetmap.josm.tools.Logging;
     16import org.openstreetmap.josm.tools.PlatformManager;
    1617
    1718/**
     
    6364                    preferencesDir = new File(path).getAbsoluteFile();
    6465                } else {
    65                     preferencesDir = Main.platform.getDefaultPrefDirectory();
     66                    preferencesDir = PlatformManager.getPlatform().getDefaultPrefDirectory();
    6667                }
    6768            }
     
    9697                    userdataDir = new File(path).getAbsoluteFile();
    9798                } else {
    98                     userdataDir = Main.platform.getDefaultUserDataDirectory();
     99                    userdataDir = PlatformManager.getPlatform().getDefaultUserDataDirectory();
    99100                }
    100101            }
     
    133134                        cacheDir = new File(path).getAbsoluteFile();
    134135                    } else {
    135                         cacheDir = Main.platform.getDefaultCacheDirectory();
     136                        cacheDir = PlatformManager.getPlatform().getDefaultCacheDirectory();
    136137                    }
    137138                }
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r14135 r14138  
    178178import org.openstreetmap.josm.tools.PlatformHook.NativeOsCallback;
    179179import org.openstreetmap.josm.tools.PlatformHookWindows;
     180import org.openstreetmap.josm.tools.PlatformManager;
    180181import org.openstreetmap.josm.tools.RightAndLefthandTraffic;
    181182import org.openstreetmap.josm.tools.Shortcut;
     
    386387            StringBuilder content = new StringBuilder(tr("You are running version {0} of Java.",
    387388                    "<b>"+getSystemProperty("java.version")+"</b>")).append("<br><br>");
    388             if ("Sun Microsystems Inc.".equals(getSystemProperty("java.vendor")) && !platform.isOpenJDK()) {
     389            if ("Sun Microsystems Inc.".equals(getSystemProperty("java.vendor")) && !PlatformManager.getPlatform().isOpenJDK()) {
    389390                content.append("<b>").append(tr("This version is no longer supported by {0} since {1} and is not recommended for use.",
    390391                        "Oracle", eolDate)).append("</b><br><br>");
     
    400401            if (ed.showDialog().getValue() == 2) {
    401402                try {
    402                     platform.openUrl(url);
     403                    PlatformManager.getPlatform().openUrl(url);
    403404                } catch (IOException e) {
    404405                    Logging.warn(e);
     
    412413        return Arrays.asList(
    413414            new InitializationTask(tr("Starting file watcher"), FileWatcher.getDefaultInstance()::start),
    414             new InitializationTask(tr("Executing platform startup hook"), () -> platform.startupHook(MainApplication::askUpdateJava)),
     415            new InitializationTask(tr("Executing platform startup hook"),
     416                    () -> PlatformManager.getPlatform().startupHook(MainApplication::askUpdateJava)),
    415417            new InitializationTask(tr("Building main menu"), this::initializeMainWindow),
    416418            new InitializationTask(tr("Updating user interface"), () -> {
     
    831833                align("\t-Djosm.dir.name=JOSM") + tr("Change the JOSM directory name") + "\n\n" +
    832834                align("\t-Djosm.pref=" + tr("/PATH/TO/JOSM/PREF    ")) + tr("Set the preferences directory") + "\n" +
    833                 align("\t") + tr("Default: {0}", platform.getDefaultPrefDirectory()) + "\n\n" +
     835                align("\t") + tr("Default: {0}", PlatformManager.getPlatform().getDefaultPrefDirectory()) + "\n\n" +
    834836                align("\t-Djosm.userdata=" + tr("/PATH/TO/JOSM/USERDATA")) + tr("Set the user data directory") + "\n" +
    835                 align("\t") + tr("Default: {0}", platform.getDefaultUserDataDirectory()) + "\n\n" +
     837                align("\t") + tr("Default: {0}", PlatformManager.getPlatform().getDefaultUserDataDirectory()) + "\n\n" +
    836838                align("\t-Djosm.cache=" + tr("/PATH/TO/JOSM/CACHE   ")) + tr("Set the cache directory") + "\n" +
    837                 align("\t") + tr("Default: {0}", platform.getDefaultCacheDirectory()) + "\n\n" +
     839                align("\t") + tr("Default: {0}", PlatformManager.getPlatform().getDefaultCacheDirectory()) + "\n\n" +
    838840                align("\t-Djosm.home=" + tr("/PATH/TO/JOSM/HOMEDIR ")) +
    839841                tr("Set the preferences+data+cache directory (cache directory will be josm.home/cache)")+"\n\n"+
     
    927929
    928930        // initialize the platform hook, and
    929         Main.determinePlatformHook();
    930         Main.platform.setNativeOsCallback(new DefaultNativeOsCallback());
     931        PlatformManager.getPlatform().setNativeOsCallback(new DefaultNativeOsCallback());
    931932        // call the really early hook before we do anything else
    932         Main.platform.preStartupHook();
     933        PlatformManager.getPlatform().preStartupHook();
    933934
    934935        Config.setPreferencesInstance(Main.pref);
     
    978979        processOffline(args);
    979980
    980         Main.platform.afterPrefStartupHook();
     981        PlatformManager.getPlatform().afterPrefStartupHook();
    981982
    982983        applyWorkarounds();
     
    11111112        SwingUtilities.invokeLater(new GuiFinalizationWorker(args, proxySelector));
    11121113
    1113         if (Main.isPlatformWindows()) {
     1114        if (PlatformManager.isPlatformWindows()) {
    11141115            try {
    11151116                // Check for insecure certificates to remove.
     
    11871188        // To remove during Java 9 migration
    11881189        if (getSystemProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows 10") &&
    1189                 platform.getDefaultStyle().equals(LafPreference.LAF.get())) {
     1190                PlatformManager.getPlatform().getDefaultStyle().equals(LafPreference.LAF.get())) {
    11901191            try {
    11911192                String build = PlatformHookWindows.getCurrentBuild();
     
    12291230
    12301231    static void setupUIManager() {
    1231         String defaultlaf = platform.getDefaultStyle();
     1232        String defaultlaf = PlatformManager.getPlatform().getDefaultStyle();
    12321233        String laf = LafPreference.LAF.get();
    12331234        try {
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r14134 r14138  
    2525import javax.swing.event.MenuListener;
    2626
    27 import org.openstreetmap.josm.Main;
    2827import org.openstreetmap.josm.actions.AboutAction;
    2928import org.openstreetmap.josm.actions.AddNodeAction;
     
    125124import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSearchPrimitiveDialog;
    126125import org.openstreetmap.josm.spi.preferences.Config;
     126import org.openstreetmap.josm.tools.PlatformManager;
    127127import org.openstreetmap.josm.tools.Shortcut;
    128128
     
    734734        viewportFollowToggleAction.addButtonModel(vft.getModel());
    735735
    736         if (Main.platform.canFullscreen()) {
     736        if (PlatformManager.getPlatform().canFullscreen()) {
    737737            // -- fullscreen toggle action
    738738            fullscreenToggleAction = new FullscreenToggleAction();
  • trunk/src/org/openstreetmap/josm/gui/MapMover.java

    r13987 r14138  
    1717
    1818import org.openstreetmap.gui.jmapviewer.JMapViewer;
    19 import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.actions.mapmode.SelectAction;
    2120import org.openstreetmap.josm.data.coor.EastNorth;
     
    2827import org.openstreetmap.josm.tools.Destroyable;
    2928import org.openstreetmap.josm.tools.Pair;
     29import org.openstreetmap.josm.tools.PlatformManager;
    3030import org.openstreetmap.josm.tools.Shortcut;
    3131
     
    145145
    146146        // see #10592 - Disable these alternate shortcuts on OS X because of conflict with system shortcut
    147         if (!Main.isPlatformOsx()) {
     147        if (!PlatformManager.isPlatformOsx()) {
    148148            registerActionShortcut(new ZoomerAction(",", "MapMover.Zoomer.in"),
    149149                    Shortcut.registerShortcut("view:zoominalternate", tr("Map: {0}", tr("Zoom In")), KeyEvent.VK_COMMA, Shortcut.CTRL));
     
    175175        int offMask = MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON2_DOWN_MASK;
    176176        boolean allowMovement = (e.getModifiersEx() & (MouseEvent.BUTTON3_DOWN_MASK | offMask)) == MouseEvent.BUTTON3_DOWN_MASK;
    177         if (Main.isPlatformOsx()) {
     177        if (PlatformManager.isPlatformOsx()) {
    178178            MapFrame map = MainApplication.getMap();
    179179            int macMouseMask = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
     
    207207        int macMouseMask = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
    208208        if ((e.getButton() == MouseEvent.BUTTON3 && (e.getModifiersEx() & offMask) == 0) ||
    209                 (Main.isPlatformOsx() && e.getModifiersEx() == macMouseMask)) {
     209                (PlatformManager.isPlatformOsx() && e.getModifiersEx() == macMouseMask)) {
    210210            startMovement(e);
    211211        }
     
    217217    @Override
    218218    public void mouseReleased(MouseEvent e) {
    219         if (e.getButton() == MouseEvent.BUTTON3 || (Main.isPlatformOsx() && e.getButton() == MouseEvent.BUTTON1)) {
     219        if (e.getButton() == MouseEvent.BUTTON3 || (PlatformManager.isPlatformOsx() && e.getButton() == MouseEvent.BUTTON1)) {
    220220            endMovement();
    221221        }
     
    267267        // Mac OSX simulates with  ctrl + mouse 1  the second mouse button hence no dragging events get fired.
    268268        // Is only the selected mouse button pressed?
    269         if (Main.isPlatformOsx()) {
     269        if (PlatformManager.isPlatformOsx()) {
    270270            if (e.getModifiersEx() == MouseEvent.CTRL_DOWN_MASK) {
    271271                doMoveForDrag(e);
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapControler.java

    r12537 r14138  
    1818import javax.swing.KeyStroke;
    1919
    20 import org.openstreetmap.josm.Main;
     20import org.openstreetmap.josm.tools.PlatformManager;
    2121
    2222/**
     
    122122    @Override
    123123    public void mousePressed(MouseEvent e) {
    124         if (e.getButton() == MouseEvent.BUTTON1 && !(Main.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) {
     124        if (e.getButton() == MouseEvent.BUTTON1 && !(PlatformManager.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) {
    125125            iStartSelectionPoint = e.getPoint();
    126126            iEndSelectionPoint = e.getPoint();
     
    131131    public void mouseDragged(MouseEvent e) {
    132132        if (iStartSelectionPoint != null && (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK
    133                 && !(Main.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) {
     133                && !(PlatformManager.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) {
    134134            iEndSelectionPoint = e.getPoint();
    135135            iSlippyMapChooser.setSelection(iStartSelectionPoint, iEndSelectionPoint);
  • trunk/src/org/openstreetmap/josm/gui/bugreport/JosmUpdatePanel.java

    r14119 r14138  
    1212import javax.swing.SwingUtilities;
    1313
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.data.Version;
    1615import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
     
    2120import org.openstreetmap.josm.tools.ImageProvider;
    2221import org.openstreetmap.josm.tools.Logging;
     22import org.openstreetmap.josm.tools.PlatformManager;
    2323
    2424/**
     
    100100    private static void openJosmUpdateSite() {
    101101        try {
    102             Main.platform.openUrl(Config.getUrls().getJOSMWebsite());
     102            PlatformManager.getPlatform().openUrl(Config.getUrls().getJOSMWebsite());
    103103        } catch (IOException ex) {
    104104            Logging.log(Logging.LEVEL_WARN, "Unable to access JOSM website:", ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java

    r14102 r14138  
    2525import javax.swing.table.TableModel;
    2626
    27 import org.openstreetmap.josm.Main;
    2827import org.openstreetmap.josm.actions.mapmode.MapMode;
    2928import org.openstreetmap.josm.actions.search.SearchAction;
     
    5049import org.openstreetmap.josm.tools.ImageProvider;
    5150import org.openstreetmap.josm.tools.InputMapUtils;
     51import org.openstreetmap.josm.tools.PlatformManager;
    5252import org.openstreetmap.josm.tools.Shortcut;
    5353
     
    103103
    104104    private static final String[] COLUMN_TOOLTIPS = {
    105             Main.platform.makeTooltip(tr("Enable filter"), ENABLE_FILTER_SHORTCUT),
    106             Main.platform.makeTooltip(tr("Hiding filter"), HIDING_FILTER_SHORTCUT),
     105            PlatformManager.getPlatform().makeTooltip(tr("Enable filter"), ENABLE_FILTER_SHORTCUT),
     106            PlatformManager.getPlatform().makeTooltip(tr("Hiding filter"), HIDING_FILTER_SHORTCUT),
    107107            null,
    108108            tr("Inverse filter"),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r14009 r14138  
    4242import javax.swing.table.TableModel;
    4343
    44 import org.openstreetmap.josm.Main;
    4544import org.openstreetmap.josm.actions.MergeLayerAction;
    4645import org.openstreetmap.josm.data.coor.EastNorth;
     
    8382import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    8483import org.openstreetmap.josm.tools.InputMapUtils;
     84import org.openstreetmap.josm.tools.PlatformManager;
    8585import org.openstreetmap.josm.tools.Shortcut;
    8686
     
    229229        // Disable some default JTable shortcuts to use JOSM ones (see #5678, #10458)
    230230        for (KeyStroke ks : new KeyStroke[] {
    231                 KeyStroke.getKeyStroke(KeyEvent.VK_C, Main.platform.getMenuShortcutKeyMaskEx()),
    232                 KeyStroke.getKeyStroke(KeyEvent.VK_V, Main.platform.getMenuShortcutKeyMaskEx()),
     231                KeyStroke.getKeyStroke(KeyEvent.VK_C, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()),
     232                KeyStroke.getKeyStroke(KeyEvent.VK_V, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()),
    233233                KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.SHIFT_DOWN_MASK),
    234234                KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_DOWN_MASK),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r13957 r14138  
    3333import javax.swing.event.PopupMenuListener;
    3434
    35 import org.openstreetmap.josm.Main;
    3635import org.openstreetmap.josm.actions.ExpertToggleAction;
    3736import org.openstreetmap.josm.actions.IPrimitiveAction;
     
    8887import org.openstreetmap.josm.tools.ImageProvider;
    8988import org.openstreetmap.josm.tools.InputMapUtils;
     89import org.openstreetmap.josm.tools.PlatformManager;
    9090import org.openstreetmap.josm.tools.Shortcut;
    9191import org.openstreetmap.josm.tools.SubclassFilteredCollection;
     
    202202        // Do not hide copy action because of default JList override (fix #9815)
    203203        displaylist.getActionMap().put("copy", MainApplication.getMenu().copy);
    204         displaylist.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, Main.platform.getMenuShortcutKeyMaskEx()), "copy");
     204        displaylist.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), "copy");
    205205
    206206        updateActionsRelationLists();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r14134 r14138  
    9494import org.openstreetmap.josm.tools.GBC;
    9595import org.openstreetmap.josm.tools.Logging;
     96import org.openstreetmap.josm.tools.PlatformManager;
    9697import org.openstreetmap.josm.tools.Shortcut;
    9798import org.openstreetmap.josm.tools.Utils;
     
    817818        @Override
    818819        public void setContentPane(Container contentPane) {
    819             final int commandDownMask = Main.platform.getMenuShortcutKeyMaskEx();
     820            final int commandDownMask = PlatformManager.getPlatform().getMenuShortcutKeyMaskEx();
    820821            List<String> lines = new ArrayList<>();
    821822            Shortcut.findShortcut(KeyEvent.VK_1, commandDownMask).ifPresent(sc ->
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DownloadIncompleteMembersAction.java

    r14030 r14138  
    88import java.awt.event.KeyEvent;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.gui.MainApplication;
    1211import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationMemberTask;
    1312import org.openstreetmap.josm.tools.ImageProvider;
     13import org.openstreetmap.josm.tools.PlatformManager;
    1414import org.openstreetmap.josm.tools.Shortcut;
    1515
     
    3131            KeyEvent.VK_HOME, Shortcut.ALT);
    3232        sc.setAccelerator(this);
    33         putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tr("Download all incomplete members"), sc));
     33        putValue(SHORT_DESCRIPTION, PlatformManager.getPlatform().makeTooltip(tr("Download all incomplete members"), sc));
    3434        new ImageProvider("dialogs/relation", "downloadincomplete").getResource().attachImageIcon(this, true);
    3535        putValue(NAME, tr("Download members"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/MoveDownAction.java

    r14030 r14138  
    77import java.awt.event.KeyEvent;
    88
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.tools.ImageProvider;
     10import org.openstreetmap.josm.tools.PlatformManager;
    1111import org.openstreetmap.josm.tools.Shortcut;
    1212
     
    2828        Shortcut sc = Shortcut.registerShortcut("relationeditor:movedown", tr("Relation Editor: Move Down"), KeyEvent.VK_DOWN, Shortcut.ALT);
    2929        sc.setAccelerator(this);
    30         putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tr("Move the currently selected members down"), sc));
     30        putValue(SHORT_DESCRIPTION, PlatformManager.getPlatform().makeTooltip(tr("Move the currently selected members down"), sc));
    3131        setEnabled(false);
    3232    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/MoveUpAction.java

    r14030 r14138  
    77import java.awt.event.KeyEvent;
    88
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.tools.ImageProvider;
     10import org.openstreetmap.josm.tools.PlatformManager;
    1111import org.openstreetmap.josm.tools.Shortcut;
    1212
     
    2828        Shortcut sc = Shortcut.registerShortcut("relationeditor:moveup", tr("Relation Editor: Move Up"), KeyEvent.VK_UP, Shortcut.ALT);
    2929        sc.setAccelerator(this);
    30         putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tr("Move the currently selected members up"), sc));
     30        putValue(SHORT_DESCRIPTION, PlatformManager.getPlatform().makeTooltip(tr("Move the currently selected members up"), sc));
    3131        setEnabled(false);
    3232    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java

    r14134 r14138  
    1919import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    2020import org.openstreetmap.josm.tools.ImageProvider;
     21import org.openstreetmap.josm.tools.PlatformManager;
    2122import org.openstreetmap.josm.tools.Shortcut;
    2223
     
    3738        Shortcut sc = Shortcut.registerShortcut("relationeditor:refresh", tr("Relation Editor: Refresh"), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE);
    3839        // CHECKSTYLE.ON: LineLength
    39         putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tr("Refresh relation from data layer"), sc));
     40        putValue(SHORT_DESCRIPTION, PlatformManager.getPlatform().makeTooltip(tr("Refresh relation from data layer"), sc));
    4041        new ImageProvider("dialogs/refresh").getResource().attachImageIcon(this, true);
    4142        putValue(NAME, tr("Refresh"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RemoveAction.java

    r14030 r14138  
    77import java.awt.event.KeyEvent;
    88
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.tools.ImageProvider;
     10import org.openstreetmap.josm.tools.PlatformManager;
    1111import org.openstreetmap.josm.tools.Shortcut;
    1212
     
    2929        Shortcut sc = Shortcut.registerShortcut("relationeditor:remove", tr("Relation Editor: Remove"), KeyEvent.VK_DELETE, Shortcut.ALT);
    3030        sc.setAccelerator(this);
    31         putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tr("Remove the currently selected members from this relation"), sc));
     31        putValue(SHORT_DESCRIPTION, PlatformManager.getPlatform().makeTooltip(
     32                tr("Remove the currently selected members from this relation"), sc));
    3233        setEnabled(false);
    3334    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SortAction.java

    r14030 r14138  
    77import java.awt.event.KeyEvent;
    88
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.tools.ImageProvider;
     10import org.openstreetmap.josm.tools.PlatformManager;
    1111import org.openstreetmap.josm.tools.Shortcut;
    1212
     
    2828        Shortcut sc = Shortcut.registerShortcut("relationeditor:sort", tr("Relation Editor: Sort"), KeyEvent.VK_END, Shortcut.ALT);
    2929        sc.setAccelerator(this);
    30         putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tr("Sort the relation members"), sc));
     30        putValue(SHORT_DESCRIPTION, PlatformManager.getPlatform().makeTooltip(tr("Sort the relation members"), sc));
    3131        updateEnabledState();
    3232    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r13843 r14138  
    7777import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    7878import org.openstreetmap.josm.tools.Logging;
     79import org.openstreetmap.josm.tools.PlatformManager;
    7980import org.openstreetmap.josm.tools.Shortcut;
    8081
     
    12601261                    tt = tt.substring(6, tt.length()-6);
    12611262                }
    1262                 tt = Main.platform.makeTooltip(tt, sc);
     1263                tt = PlatformManager.getPlatform().makeTooltip(tt, sc);
    12631264            }
    12641265        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java

    r13142 r14138  
    2424import javax.swing.UIManager.LookAndFeelInfo;
    2525
    26 import org.openstreetmap.josm.Main;
    2726import org.openstreetmap.josm.actions.ExpertToggleAction;
    2827import org.openstreetmap.josm.data.preferences.StringProperty;
     
    4241import org.openstreetmap.josm.tools.GBC;
    4342import org.openstreetmap.josm.tools.Logging;
     43import org.openstreetmap.josm.tools.PlatformManager;
    4444import org.openstreetmap.josm.tools.date.DateUtils;
    4545
     
    5353     * @since 11713
    5454     */
    55     public static final StringProperty LAF = new StringProperty("laf", Main.platform.getDefaultStyle());
     55    public static final StringProperty LAF = new StringProperty("laf", PlatformManager.getPlatform().getDefaultStyle());
    5656
    5757    static final class LafListCellRenderer implements ListCellRenderer<LookAndFeelInfo> {
     
    9797
    9898        // let's try to load additional LookAndFeels and put them into the list
    99         if (Main.isPlatformOsx()) {
     99        if (PlatformManager.isPlatformOsx()) {
    100100            try {
    101101                Class<?> cquaqua = Class.forName("ch.randelshofer.quaqua.QuaquaLookAndFeel");
  • trunk/src/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreference.java

    r13431 r14138  
    2727import javax.swing.JSeparator;
    2828
    29 import org.openstreetmap.josm.Main;
    3029import org.openstreetmap.josm.gui.help.HelpUtil;
    3130import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
     
    4342import org.openstreetmap.josm.tools.Logging;
    4443import org.openstreetmap.josm.tools.PlatformHookWindows;
     44import org.openstreetmap.josm.tools.PlatformManager;
    4545
    4646/**
     
    114114
    115115        // Certificate installation only available on Windows for now, see #10033
    116         if (Main.isPlatformWindows()) {
     116        if (PlatformManager.isPlatformWindows()) {
    117117            installCertificate = new JButton(tr("Install..."));
    118118            uninstallCertificate = new JButton(tr("Uninstall..."));
  • trunk/src/org/openstreetmap/josm/gui/widgets/FileChooserManager.java

    r12846 r14138  
    1616import org.openstreetmap.josm.data.preferences.BooleanProperty;
    1717import org.openstreetmap.josm.spi.preferences.Config;
     18import org.openstreetmap.josm.tools.PlatformManager;
    1819
    1920/**
     
    3334    public static final BooleanProperty PROP_USE_NATIVE_FILE_DIALOG = new BooleanProperty("use.native.file.dialog",
    3435            // Native dialogs do not support file filters, so do not set them as default, except for OS X where they never worked
    35             Main.isPlatformOsx());
     36            PlatformManager.isPlatformOsx());
    3637
    3738    private final boolean open;
  • trunk/src/org/openstreetmap/josm/gui/widgets/NativeFileChooser.java

    r13206 r14138  
    1414
    1515import org.openstreetmap.josm.Main;
     16import org.openstreetmap.josm.tools.PlatformManager;
    1617import org.openstreetmap.josm.tools.Utils;
    1718
     
    138139    @Override
    139140    public int showOpenDialog(Component parent) {
    140         boolean appleProperty = Main.isPlatformOsx() && selectionMode == JFileChooser.DIRECTORIES_ONLY;
     141        boolean appleProperty = PlatformManager.isPlatformOsx() && selectionMode == JFileChooser.DIRECTORIES_ONLY;
    141142        if (appleProperty) {
    142143            Utils.updateSystemProperty("apple.awt.fileDialogForDirectories", "true");
     
    176177            // http://stackoverflow.com/questions/1224714/how-can-i-make-a-java-filedialog-accept-directories-as-its-filetype-in-os-x/1224744#1224744
    177178            // CHECKSTYLE.ON: LineLength
    178             return Main.isPlatformOsx();
     179            return PlatformManager.isPlatformOsx();
    179180        case JFileChooser.FILES_ONLY:
    180181        default:
  • trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java

    r13974 r14138  
    2424import javax.swing.undo.UndoManager;
    2525
    26 import org.openstreetmap.josm.Main;
    2726import org.openstreetmap.josm.spi.preferences.Config;
    2827import org.openstreetmap.josm.tools.ImageProvider;
    2928import org.openstreetmap.josm.tools.Logging;
     29import org.openstreetmap.josm.tools.PlatformManager;
    3030
    3131/**
     
    9595                if (!GraphicsEnvironment.isHeadless()) {
    9696                    component.getInputMap().put(
    97                             KeyStroke.getKeyStroke(KeyEvent.VK_Z, Main.platform.getMenuShortcutKeyMaskEx()), undoAction);
     97                            KeyStroke.getKeyStroke(KeyEvent.VK_Z, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), undoAction);
    9898                    component.getInputMap().put(
    99                             KeyStroke.getKeyStroke(KeyEvent.VK_Y, Main.platform.getMenuShortcutKeyMaskEx()), redoAction);
     99                            KeyStroke.getKeyStroke(KeyEvent.VK_Y, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), redoAction);
    100100                }
    101101            }
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r14119 r14138  
    3434import org.openstreetmap.josm.tools.Logging;
    3535import org.openstreetmap.josm.tools.Pair;
     36import org.openstreetmap.josm.tools.PlatformManager;
    3637import org.openstreetmap.josm.tools.Utils;
    3738
     
    521522            activeConnection = null;
    522523            localFile = new File(destDir, localPath);
    523             if (Main.platform.rename(destDirFile, localFile)) {
     524            if (PlatformManager.getPlatform().rename(destDirFile, localFile)) {
    524525                Config.getPref().putList(prefKey,
    525526                        Arrays.asList(Long.toString(System.currentTimeMillis()), localFile.toString()));
     
    549550            // Windows doesn't support paths longer than 260, leave 5 chars as safe buffer, 4 will be used by ".tmp"
    550551            // TODO: what about filename size on other systems? 255?
    551             if (directory.length() > 191 && Main.isPlatformWindows()) {
     552            if (directory.length() > 191 && PlatformManager.isPlatformWindows()) {
    552553                // digest length + name prefix == 64
    553554                // 255 - 64 = 191
  • trunk/src/org/openstreetmap/josm/io/CertificateAmendment.java

    r13822 r14138  
    2727import javax.net.ssl.TrustManagerFactory;
    2828
    29 import org.openstreetmap.josm.Main;
    3029import org.openstreetmap.josm.spi.preferences.Config;
    3130import org.openstreetmap.josm.tools.Logging;
     31import org.openstreetmap.josm.tools.PlatformManager;
    3232import org.openstreetmap.josm.tools.Utils;
    3333
     
    227227            // Try to add platform certificates. Do not exit in case of error (embedded certificates may be OK)
    228228            for (NativeCertAmend certAmend : PLATFORM_CERT_AMEND) {
    229                 X509Certificate cert = Main.platform.getX509Certificate(certAmend);
     229                X509Certificate cert = PlatformManager.getPlatform().getX509Certificate(certAmend);
    230230                if (checkAndAddCertificate(md, cert, certAmend, keyStore)) {
    231231                    certificateAdded = true;
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java

    r13679 r14138  
    3939import javax.net.ssl.TrustManagerFactory;
    4040
    41 import org.openstreetmap.josm.Main;
    4241import org.openstreetmap.josm.data.preferences.StringProperty;
    4342import org.openstreetmap.josm.spi.preferences.Config;
    4443import org.openstreetmap.josm.tools.Logging;
     44import org.openstreetmap.josm.tools.PlatformManager;
    4545
    4646import sun.security.util.ObjectIdentifier;
     
    301301        Enumeration<String> aliases = josmKs.aliases();
    302302        if (aliases.hasMoreElements()) {
    303             return Main.platform.setupHttpsCertificate(ENTRY_ALIAS,
     303            return PlatformManager.getPlatform().setupHttpsCertificate(ENTRY_ALIAS,
    304304                    new KeyStore.TrustedCertificateEntry(josmKs.getCertificate(aliases.nextElement())));
    305305        }
  • trunk/src/org/openstreetmap/josm/tools/KeyboardUtils.java

    r14022 r14138  
    99import java.util.Locale;
    1010import java.util.Map;
    11 
    12 import org.openstreetmap.josm.Main;
    1311
    1412/**
     
    293291            // UK Apple, https://en.wikipedia.org/wiki/QWERTY#UK_Apple_keyboard
    294292            // International English Apple, https://en.wikipedia.org/wiki/QWERTY#Apple_International_English_Keyboard
    295             if (Main.isPlatformOsx()) {
     293            if (PlatformManager.isPlatformOsx()) {
    296294                result.add('§'); // https://en.wikipedia.org/wiki/Section_sign
    297295            }
  • trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java

    r12620 r14138  
    2525
    2626    private static void displayUrlFallback(URI uri) throws IOException {
    27         if (Main.platform == null)
     27        if (PlatformManager.getPlatform() == null)
    2828            throw new IllegalStateException(tr("Failed to open URL. There is currently no platform set. Please set a platform first."));
    29         Main.platform.openUrl(uri.toString());
     29        PlatformManager.getPlatform().openUrl(uri.toString());
    3030    }
    3131
     
    4545        if (Desktop.isDesktopSupported()) {
    4646            try {
    47                 if (Main.isPlatformWindows()) {
     47                if (PlatformManager.isPlatformWindows()) {
    4848                    // Desktop API works fine under Windows, so we don't try any fallback in case of I/O exceptions because it's not API's fault
    4949                    Desktop.getDesktop().browse(uri);
    50                 } else if (Main.platform instanceof PlatformHookUnixoid || Main.platform instanceof PlatformHookOsx) {
     50                } else if (PlatformManager.isPlatformUnixoid() || PlatformManager.isPlatformOsx()) {
    5151                    // see #5629 #5108 #9568
    52                     Main.platform.openUrl(uri.toString());
     52                    PlatformManager.getPlatform().openUrl(uri.toString());
    5353                } else {
    5454                    // This is not the case with some Linux environments (see below),
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r14017 r14138  
    371371        if (initdone) return;
    372372        initdone = true;
    373         int commandDownMask = Main.platform.getMenuShortcutKeyMaskEx();
     373        int commandDownMask = PlatformManager.getPlatform().getMenuShortcutKeyMaskEx();
    374374        groups.put(NONE, -1);
    375375        groups.put(MNEMONIC, KeyEvent.ALT_DOWN_MASK);
     
    384384
    385385        // (1) System reserved shortcuts
    386         Main.platform.initSystemShortcuts();
     386        PlatformManager.getPlatform().initSystemShortcuts();
    387387        // (2) User defined shortcuts
    388388        Main.pref.getAllPrefixCollectionKeys("shortcut.entry.").stream()
     
    507507        } else if (existing.isPresent()) {
    508508            final Shortcut conflict = existing.get();
    509             if (Main.isPlatformOsx()) {
     509            if (PlatformManager.isPlatformOsx()) {
    510510                // Try to reassign Meta to Ctrl
    511511                int newmodifier = findNewOsxModifier(requestedGroup);
  • trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java

    r13636 r14138  
    5252    @Rule
    5353    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    54     public JOSMTestRules test = new JOSMTestRules().preferences().platform().projection().mapStyles().timeout(60000);
     54    public JOSMTestRules test = new JOSMTestRules().preferences().projection().mapStyles().timeout(60000);
    5555
    5656    /**
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r14125 r14138  
    3131import org.openstreetmap.josm.tools.JosmRuntimeException;
    3232import org.openstreetmap.josm.tools.Logging;
     33import org.openstreetmap.josm.tools.PlatformManager;
    3334import org.openstreetmap.josm.tools.date.DateUtils;
    3435
     
    108109        I18n.init();
    109110        // initialize the plaform hook, and
    110         Main.determinePlatformHook();
    111111        // call the really early hook before we anything else
    112         Main.platform.preStartupHook();
     112        PlatformManager.getPlatform().preStartupHook();
    113113
    114114        Logging.setLogLevel(Logging.LEVEL_INFO);
  • trunk/test/unit/org/openstreetmap/josm/MainTest.java

    r14125 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().main().projection();
     23    public JOSMTestRules test = new JOSMTestRules().https().devAPI().main().projection();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java

    r13733 r14138  
    3333    @Rule
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().preferences().platform().fakeAPI();
     35    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
    3636
    3737    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java

    r12636 r14138  
    4747    @Rule
    4848    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    49     public JOSMTestRules test = new JOSMTestRules().preferences().platform().fakeAPI();
     49    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
    5050
    5151    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java

    r12636 r14138  
    3838    @Rule
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    40     public JOSMTestRules test = new JOSMTestRules().platform().projection().main();
     40    public JOSMTestRules test = new JOSMTestRules().projection().main();
    4141
    4242    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/DeleteLayerActionTest.java

    r12636 r14138  
    2424    @Rule
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules test = new JOSMTestRules().platform();
     26    public JOSMTestRules test = new JOSMTestRules();
    2727
    2828    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java

    r14126 r14138  
    2929    @Rule
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    31     public JOSMTestRules test = new JOSMTestRules().platform().main();
     31    public JOSMTestRules test = new JOSMTestRules().main();
    3232
    3333    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/ExpertToggleActionTest.java

    r11224 r14138  
    2727    @Rule
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().preferences().platform();
     29    public JOSMTestRules test = new JOSMTestRules().preferences();
    3030
    3131    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java

    r12562 r14138  
    1717    @Rule
    1818    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    19     public JOSMTestRules test = new JOSMTestRules().platform().main();
     19    public JOSMTestRules test = new JOSMTestRules().main();
    2020
    2121    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r13950 r14138  
    4949    @Rule
    5050    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    51     public JOSMTestRules test = new JOSMTestRules().platform().main().projection();
     51    public JOSMTestRules test = new JOSMTestRules().main().projection();
    5252
    5353    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java

    r12636 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().platform().main();
     28    public JOSMTestRules test = new JOSMTestRules().main();
    2929
    3030    private MergeLayerAction action;
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java

    r12849 r14138  
    2828    @Rule
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().platform().projection();
     30    public JOSMTestRules test = new JOSMTestRules().projection();
    3131
    3232    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java

    r12636 r14138  
    3232    @Rule
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    34     public JOSMTestRules test = new JOSMTestRules().platform().main();
     34    public JOSMTestRules test = new JOSMTestRules().main();
    3535
    3636    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java

    r11109 r14138  
    2020    @Rule
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules().platform();
     22    public JOSMTestRules test = new JOSMTestRules();
    2323
    2424    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java

    r12636 r14138  
    4242    @Rule
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    44     public JOSMTestRules test = new JOSMTestRules().platform();
     44    public JOSMTestRules test = new JOSMTestRules();
    4545
    4646    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java

    r14101 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().platform().main().projection();
     28    public JOSMTestRules test = new JOSMTestRules().main().projection();
    2929
    3030    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java

    r12636 r14138  
    2727    @Rule
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().platform().main().projection();
     29    public JOSMTestRules test = new JOSMTestRules().main().projection();
    3030
    3131    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java

    r14134 r14138  
    4040    @Rule
    4141    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    42     public JOSMTestRules test = new JOSMTestRules().platform().main().projection().timeout(20000);
     42    public JOSMTestRules test = new JOSMTestRules().main().projection().timeout(20000);
    4343
    4444    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java

    r12636 r14138  
    2727    @Rule
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().platform().platform().main().projection();
     29    public JOSMTestRules test = new JOSMTestRules().main().projection();
    3030
    3131    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java

    r12636 r14138  
    2727    @Rule
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().platform().platform().main().projection();
     29    public JOSMTestRules test = new JOSMTestRules().main().projection();
    3030
    3131    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java

    r12636 r14138  
    2828    @Rule
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().platform().platform().main().projection();
     30    public JOSMTestRules test = new JOSMTestRules().main().projection();
    3131
    3232    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java

    r12636 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().platform().platform().main().projection();
     28    public JOSMTestRules test = new JOSMTestRules().main().projection();
    2929
    3030    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java

    r12849 r14138  
    6060    @Rule
    6161    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    62     public JOSMTestRules test = new JOSMTestRules().platform().projection().main();
     62    public JOSMTestRules test = new JOSMTestRules().projection().main();
    6363
    6464    /**
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java

    r13496 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().platform().fakeAPI().timeout(30000);
     23    public JOSMTestRules test = new JOSMTestRules().fakeAPI().timeout(30000);
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java

    r13616 r14138  
    3333    @Rule
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().platform();
     35    public JOSMTestRules test = new JOSMTestRules();
    3636    private CommandTestData testData;
    3737
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java

    r13079 r14138  
    3737    @Rule
    3838    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    39     public JOSMTestRules test = new JOSMTestRules().platform();
     39    public JOSMTestRules test = new JOSMTestRules();
    4040
    4141    /**
  • trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java

    r12989 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().platform().preferences().fakeAPI();
     23    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java

    r14120 r14138  
    3030    @Rule
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    32     public JOSMTestRules test = new JOSMTestRules().platform().projection();
     32    public JOSMTestRules test = new JOSMTestRules().projection();
    3333
    3434    @Rule
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java

    r14120 r14138  
    4747    @ClassRule
    4848    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    49     public static JOSMTestRules test = new JOSMTestRules().preferences().platform().projection().timeout((int) TimeUnit.MINUTES.toMillis(5));
     49    public static JOSMTestRules test = new JOSMTestRules().preferences().projection().timeout((int) TimeUnit.MINUTES.toMillis(5));
    5050
    5151    @Rule
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DefaultNameFormatterTest.java

    r13766 r14138  
    3838    @Rule
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    40     public JOSMTestRules test = new JOSMTestRules().platform();
     40    public JOSMTestRules test = new JOSMTestRules();
    4141
    4242    /**
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r13707 r14138  
    3535import org.junit.Rule;
    3636import org.junit.Test;
    37 import org.openstreetmap.josm.Main;
    3837import org.openstreetmap.josm.data.Bounds;
    3938import org.openstreetmap.josm.data.coor.EastNorth;
     
    4241import org.openstreetmap.josm.testutils.JOSMTestRules;
    4342import org.openstreetmap.josm.tools.Pair;
     43import org.openstreetmap.josm.tools.PlatformManager;
    4444import org.openstreetmap.josm.tools.Utils;
    4545
     
    9090    @Rule
    9191    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    92     public JOSMTestRules test = new JOSMTestRules().platform().projectionNadGrids().timeout(90_000);
     92    public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().timeout(90_000);
    9393
    9494    /**
     
    104104            }
    105105        }
    106         Main.determinePlatformHook();
    107106        Collection<RefEntry> refs = readData();
    108107        refs = updateData(refs);
     
    286285        // see http://geodesie.ign.fr/contenu/fichiers/documentation/algorithmes/notice/NT111_V1_HARMEL_TransfoNTF-RGF93_FormatGrilleNTV2.pdf
    287286        def = def.replace("ntf_r93_b.gsb", "ntf_r93.gsb");
    288         if (Main.isPlatformWindows()) {
     287        if (PlatformManager.isPlatformWindows()) {
    289288            def = def.replace("'", "\\'").replace("\"", "\\\"");
    290289        }
  • trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java

    r14120 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().platform();
     28    public JOSMTestRules test = new JOSMTestRules().projectionNadGrids();
    2929
    3030    /**
  • trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java

    r11921 r14138  
    1919    @Rule
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    21     public JOSMTestRules test = new JOSMTestRules().platform();
     21    public JOSMTestRules test = new JOSMTestRules();
    2222
    2323    /**
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r13616 r14138  
    5252    @Rule
    5353    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    54     public JOSMTestRules test = new JOSMTestRules().projection().platform();
     54    public JOSMTestRules test = new JOSMTestRules().projection();
    5555
    5656    static MapCSSTagChecker buildTagChecker(String css) throws ParseException {
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java

    r12568 r14138  
    3535    @Rule
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    37     public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main().platform();
     37    public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main();
    3838
    3939    private static Way createUnclosedWay(String tags) {
  • trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java

    r13812 r14138  
    2828import org.junit.Rule;
    2929import org.junit.Test;
    30 import org.openstreetmap.josm.Main;
    3130import org.openstreetmap.josm.TestUtils;
    3231import org.openstreetmap.josm.actions.AboutAction;
     
    4443import org.openstreetmap.josm.testutils.JOSMTestRules;
    4544import org.openstreetmap.josm.tools.Logging;
     45import org.openstreetmap.josm.tools.PlatformManager;
    4646import org.openstreetmap.josm.tools.Shortcut;
    4747
     
    196196    public void testSetupUIManager() {
    197197        MainApplication.setupUIManager();
    198         assertEquals(Config.getPref().get("laf", Main.platform.getDefaultStyle()), UIManager.getLookAndFeel().getClass().getCanonicalName());
     198        assertEquals(Config.getPref().get("laf", PlatformManager.getPlatform().getDefaultStyle()),
     199                UIManager.getLookAndFeel().getClass().getCanonicalName());
    199200    }
    200201
  • trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java

    r12636 r14138  
    2828    @Rule
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().main().platform().projection();
     30    public JOSMTestRules test = new JOSMTestRules().main().projection();
    3131
    3232    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java

    r14120 r14138  
    5656    @Rule
    5757    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    58     public JOSMTestRules test = new JOSMTestRules().preferences().platform().projection();
     58    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    5959
    6060    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java

    r14102 r14138  
    5353    @Rule
    5454    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    55     public JOSMTestRules test = new JOSMTestRules().platform().main();
     55    public JOSMTestRules test = new JOSMTestRules().main();
    5656
    5757    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java

    r14120 r14138  
    2929    @Rule
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    31     public JOSMTestRules test = new JOSMTestRules().preferences().projection().main().platform();
     31    public JOSMTestRules test = new JOSMTestRules().preferences().projection().main();
    3232
    3333    private final OsmTransferHandler transferHandler = new OsmTransferHandler();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java

    r14134 r14138  
    2828    @Rule
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    30     public JOSMTestRules test = new JOSMTestRules().main().platform().projection();
     30    public JOSMTestRules test = new JOSMTestRules().main().projection();
    3131
    3232    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java

    r12636 r14138  
    3333    @Rule
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().main().platform().projection();
     35    public JOSMTestRules test = new JOSMTestRules().main().projection();
    3636
    3737    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java

    r13169 r14138  
    3131    @Rule
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    33     public JOSMTestRules test = new JOSMTestRules().main().platform().projection().mapStyles();
     33    public JOSMTestRules test = new JOSMTestRules().main().projection().mapStyles();
    3434
    3535    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java

    r12636 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().main().platform().projection();
     23    public JOSMTestRules test = new JOSMTestRules().main().projection();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java

    r14122 r14138  
    5858    @Rule
    5959    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    60     public JOSMTestRules josmTestRules = new JOSMTestRules().main().platform().projection().fakeImagery();
     60    public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().fakeImagery();
    6161
    6262    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerTest.java

    r13846 r14138  
    3333    @Rule
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().preferences().platform();
     35    public JOSMTestRules test = new JOSMTestRules().preferences();
    3636
    3737    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java

    r12636 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().preferences().projection().platform().main();
     28    public JOSMTestRules test = new JOSMTestRules().preferences().projection().main();
    2929
    3030    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java

    r14031 r14138  
    3434    @Rule
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    36     public JOSMTestRules test = new JOSMTestRules().preferences().platform().main();
     36    public JOSMTestRules test = new JOSMTestRules().preferences().main();
    3737
    3838    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java

    r14028 r14138  
    3838    @Rule
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    40     public JOSMTestRules test = new JOSMTestRules().preferences().platform().main();
     40    public JOSMTestRules test = new JOSMTestRules().preferences().main();
    4141
    4242    protected OsmDataLayer layer;
  • trunk/test/unit/org/openstreetmap/josm/gui/help/HelpBrowserTest.java

    r12248 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().preferences().platform().https();
     28    public JOSMTestRules test = new JOSMTestRules().preferences().https();
    2929
    3030    static IHelpBrowser newHelpBrowser() {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java

    r13884 r14138  
    4646    @Rule
    4747    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    48     public JOSMTestRules test = new JOSMTestRules().platform().projection().main();
     48    public JOSMTestRules test = new JOSMTestRules().projection().main();
    4949
    5050    private static final class TMSTileStubSource extends AbstractTMSTileSource {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java

    r13116 r14138  
    4141    @Rule
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    43     public JOSMTestRules test = new JOSMTestRules().preferences().platform().projection();
     43    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    4444
    4545    private AutosaveTask task;
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java

    r13211 r14138  
    4141    @Rule
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    43     public JOSMTestRules test = new JOSMTestRules().platform().main().projection().i18n();
     43    public JOSMTestRules test = new JOSMTestRules().main().projection().i18n();
    4444
    4545    private static String getHtml(GpxLayer layer) {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r14075 r14138  
    4949    @Rule
    5050    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    51     public JOSMTestRules test = new JOSMTestRules().platform().projection().main();
     51    public JOSMTestRules test = new JOSMTestRules().projection().main();
    5252
    5353    private DataSet ds;
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java

    r12636 r14138  
    2323    @Rule
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    25     public JOSMTestRules test = new JOSMTestRules().main().platform().projection();
     25    public JOSMTestRules test = new JOSMTestRules().main().projection();
    2626
    2727    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java

    r13174 r14138  
    2525    @Rule
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    27     public JOSMTestRules test = new JOSMTestRules().platform().projection().main();
     27    public JOSMTestRules test = new JOSMTestRules().projection().main();
    2828
    2929    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java

    r12636 r14138  
    2323    @Rule
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    25     public JOSMTestRules test = new JOSMTestRules().main().platform().projection();
     25    public JOSMTestRules test = new JOSMTestRules().main().projection();
    2626
    2727    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java

    r12564 r14138  
    1919    @Rule
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    21     public JOSMTestRules test = new JOSMTestRules().platform();
     21    public JOSMTestRules test = new JOSMTestRules();
    2222
    2323    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackActionTest.java

    r14062 r14138  
    3232    @Rule
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    34     public JOSMTestRules test = new JOSMTestRules().preferences().platform();
     34    public JOSMTestRules test = new JOSMTestRules().preferences();
    3535
    3636    private static PleaseWaitRunnable createTask(String file) throws Exception {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java

    r14132 r14138  
    3030    @Rule
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    32     public JOSMTestRules test = new JOSMTestRules().platform().main().projection().fakeImagery().timeout(20000);
     32    public JOSMTestRules test = new JOSMTestRules().main().projection().fakeImagery().timeout(20000);
    3333
    3434    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java

    r12849 r14138  
    3333    @Rule
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().main().platform().preferences().projection();
     35    public JOSMTestRules test = new JOSMTestRules().main().preferences().projection();
    3636
    3737    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanelTest.java

    r13734 r14138  
    2020    @Rule
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    22     public JOSMTestRules test = new JOSMTestRules().platform().preferences();
     22    public JOSMTestRules test = new JOSMTestRules().preferences();
    2323
    2424    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java

    r12849 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().platform().main();
     28    public JOSMTestRules test = new JOSMTestRules().main();
    2929
    3030    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java

    r14081 r14138  
    5252    public JOSMTestRules test = new JOSMTestRules().assumeRevision(
    5353        "Revision: 10000\n"
    54     ).preferences().main().assertionsInEDT().platform();
     54    ).preferences().main().assertionsInEDT();
    5555
    5656    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java

    r14052 r14138  
    3434    @Rule
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    36     public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT().platform();
     36    public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
    3737
    3838    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferenceTest.java

    r10979 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().preferences().platform();
     23    public JOSMTestRules test = new JOSMTestRules().preferences();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/OverpassServerPreferenceTest.java

    r10979 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().preferences().platform();
     23    public JOSMTestRules test = new JOSMTestRules().preferences();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/ProxyPreferenceTest.java

    r10979 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().preferences().platform();
     23    public JOSMTestRules test = new JOSMTestRules().preferences();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/ServerAccessPreferenceTest.java

    r10979 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().preferences().platform();
     23    public JOSMTestRules test = new JOSMTestRules().preferences();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java

    r11921 r14138  
    3333    @Rule
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    35     public JOSMTestRules test = new JOSMTestRules().platform();
     35    public JOSMTestRules test = new JOSMTestRules();
    3636
    3737    /**
  • trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTestIT.java

    r14099 r14138  
    2525    @Rule
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    27     public JOSMTestRules test = new JOSMTestRules().platform().https().timeout(20000);
     27    public JOSMTestRules test = new JOSMTestRules().https().timeout(20000);
    2828
    2929    /**
  • trunk/test/unit/org/openstreetmap/josm/io/NetworkManagerTest.java

    r14121 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().main().projection();
     28    public JOSMTestRules test = new JOSMTestRules().https().devAPI().main().projection();
    2929
    3030    /**
  • trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java

    r13878 r14138  
    3232    @Rule
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    34     public JOSMTestRules test = new JOSMTestRules().platform().projection();
     34    public JOSMTestRules test = new JOSMTestRules().projection();
    3535
    3636    @Rule
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java

    r12558 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules test = new JOSMTestRules().platform();
     28    public JOSMTestRules test = new JOSMTestRules();
    2929
    3030    private static ImageryHandler newHandler(String url) throws RequestHandlerBadRequestException {
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r13243 r14138  
    3737    @Rule
    3838    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    39     public JOSMTestRules test = new JOSMTestRules().platform().projection();
     39    public JOSMTestRules test = new JOSMTestRules().projection();
    4040
    4141    private static String getSessionDataDir() {
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r14120 r14138  
    8989    @Rule
    9090    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    91     public JOSMTestRules test = new JOSMTestRules().platform().projection().main();
     91    public JOSMTestRules test = new JOSMTestRules().projection().main();
    9292
    9393    /**
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java

    r13079 r14138  
    3434    @Rule
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    36     public JOSMTestRules test = new JOSMTestRules().platform();
     36    public JOSMTestRules test = new JOSMTestRules();
    3737
    3838    /**
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java

    r14113 r14138  
    4242    @Rule
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    44     public JOSMTestRules test = new JOSMTestRules().platform().main().projection().preferences().timeout(10*60*1000);
     44    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences().timeout(10*60*1000);
    4545
    4646    /**
  • trunk/test/unit/org/openstreetmap/josm/spi/lifecycle/LifecycleTest.java

    r14125 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().main().projection();
     23    public JOSMTestRules test = new JOSMTestRules().https().devAPI().main().projection();
    2424
    2525    private static class InitStatusListenerStub implements InitStatusListener {
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r14120 r14138  
    7979    private Runnable navigableComponentMockingRunnable;
    8080    private Runnable edtAssertionMockingRunnable;
    81     private boolean platform;
    8281    private boolean useProjection;
    8382    private boolean useProjectionNadGrids;
     
    150149     * Enable {@link Main#platform} global variable.
    151150     * @return this instance, for easy chaining
    152      */
     151     * @deprecated Not needed anymore
     152     */
     153    @Deprecated
    153154    public JOSMTestRules platform() {
    154         platform = true;
    155155        return this;
    156156    }
     
    209209    public JOSMTestRules https() {
    210210        useHttps = true;
    211         platform = true;
    212211        return this;
    213212    }
     
    457456            // We force the use of a wrong API server, just in case anyone attempts an upload
    458457            Config.getPref().put("osm-server.url", "http://invalid");
    459         }
    460 
    461         // Set Platform
    462         if (platform) {
    463             Main.determinePlatformHook();
    464458        }
    465459
     
    550544        cleanLayerEnvironment();
    551545        Main.pref.resetToInitialState();
    552         Main.platform = null;
    553546        System.gc();
    554547    }
     
    592585        ProjectionRegistry.clearProjectionChangeListeners();
    593586        Main.pref.resetToInitialState();
    594         Main.platform = null;
    595587
    596588        if (this.assumeRevisionString != null && this.originalVersion != null) {
  • trunk/test/unit/org/openstreetmap/josm/tools/KeyboardUtilsTest.java

    r14026 r14138  
    2626    @Rule
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    28     public JOSMTestRules rules = new JOSMTestRules().platform();
     28    public JOSMTestRules rules = new JOSMTestRules();
    2929
    3030    /**
  • trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookOsxTest.java

    r14119 r14138  
    1414import org.junit.Test;
    1515import org.openstreetmap.josm.JOSMFixture;
    16 import org.openstreetmap.josm.Main;
    1716import org.openstreetmap.josm.spi.preferences.Config;
    1817
     
    6463    @Test
    6564    public void testOpenUrl() throws IOException {
    66         if (!Main.isPlatformWindows()) {
     65        if (!PlatformManager.isPlatformWindows()) {
    6766            hook.openUrl(Config.getUrls().getJOSMWebsite());
    6867        } else {
     
    8382        File cache = hook.getDefaultCacheDirectory();
    8483        assertNotNull(cache);
    85         if (Main.isPlatformOsx()) {
     84        if (PlatformManager.isPlatformOsx()) {
    8685            assertTrue(cache.toString().contains("/Library/"));
    8786        }
     
    9594        File cache = hook.getDefaultPrefDirectory();
    9695        assertNotNull(cache);
    97         if (Main.isPlatformOsx()) {
     96        if (PlatformManager.isPlatformOsx()) {
    9897            assertTrue(cache.toString().contains("/Library/"));
    9998        }
     
    114113    public void testGetOSDescription() {
    115114        String os = hook.getOSDescription();
    116         if (Main.isPlatformOsx()) {
     115        if (PlatformManager.isPlatformOsx()) {
    117116            assertTrue(os.contains("Mac"));
    118117        } else {
  • trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookWindowsTest.java

    r14119 r14138  
    1919import org.junit.Test;
    2020import org.openstreetmap.josm.JOSMFixture;
    21 import org.openstreetmap.josm.Main;
    2221import org.openstreetmap.josm.io.remotecontrol.RemoteControlHttpsServer;
    2322import org.openstreetmap.josm.io.remotecontrol.RemoteControlTest;
     
    5453    @Test
    5554    public void testGetRootKeystore() throws Exception {
    56         if (Main.isPlatformWindows()) {
     55        if (PlatformManager.isPlatformWindows()) {
    5756            assertNotNull(PlatformHookWindows.getRootKeystore());
    5857        } else {
     
    7271    @Test
    7372    public void testRemoveInsecureCertificates() throws Exception {
    74         if (Main.isPlatformWindows()) {
     73        if (PlatformManager.isPlatformWindows()) {
    7574            PlatformHookWindows.removeInsecureCertificates();
    7675        } else {
     
    9392        KeyStore ks = RemoteControlHttpsServer.loadJosmKeystore();
    9493        TrustedCertificateEntry trustedCert = new KeyStore.TrustedCertificateEntry(ks.getCertificate(ks.aliases().nextElement()));
    95         if (Main.isPlatformWindows()) {
     94        if (PlatformManager.isPlatformWindows()) {
    9695            hook.setupHttpsCertificate(RemoteControlHttpsServer.ENTRY_ALIAS, trustedCert);
    9796        } else {
     
    119118    @Test
    120119    public void testOpenUrl() throws IOException {
    121         if (Main.isPlatformWindows()) {
     120        if (PlatformManager.isPlatformWindows()) {
    122121            hook.openUrl(Config.getUrls().getJOSMWebsite());
    123122        } else {
     
    146145        File cache = hook.getDefaultCacheDirectory();
    147146        assertNotNull(cache);
    148         if (Main.isPlatformWindows()) {
     147        if (PlatformManager.isPlatformWindows()) {
    149148            assertTrue(cache.toString().contains(":"));
    150149        }
     
    158157        File cache = hook.getDefaultPrefDirectory();
    159158        assertNotNull(cache);
    160         if (Main.isPlatformWindows()) {
     159        if (PlatformManager.isPlatformWindows()) {
    161160            assertTrue(cache.toString().contains(":"));
    162161        }
     
    177176    public void testGetInstalledFonts() {
    178177        Collection<String> fonts = hook.getInstalledFonts();
    179         if (Main.isPlatformWindows()) {
     178        if (PlatformManager.isPlatformWindows()) {
    180179            assertFalse(fonts.isEmpty());
    181180        } else {
     
    190189    public void testGetOSDescription() {
    191190        String os = hook.getOSDescription();
    192         if (Main.isPlatformWindows()) {
     191        if (PlatformManager.isPlatformWindows()) {
    193192            assertTrue(os.contains("Windows"));
    194193        } else {
  • trunk/test/unit/org/openstreetmap/josm/tools/RightAndLefthandTrafficTest.java

    r12556 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules rules = new JOSMTestRules().platform().projection().rlTraffic();
     23    public JOSMTestRules rules = new JOSMTestRules().projection().rlTraffic();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTest.java

    r12802 r14138  
    2121    @Rule
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    23     public JOSMTestRules rules = new JOSMTestRules().platform().projection().territories();
     23    public JOSMTestRules rules = new JOSMTestRules().projection().territories();
    2424
    2525    /**
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportTest.java

    r12779 r14138  
    2727    @Rule
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    29     public JOSMTestRules test = new JOSMTestRules().preferences().platform();
     29    public JOSMTestRules test = new JOSMTestRules().preferences();
    3030
    3131    /**
Note: See TracChangeset for help on using the changeset viewer.