⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 platformtype.java

📁 sourcode about java basic
💻 JAVA
字号:
package jsunit.java.source_server.net.jsunit;

import net.jsunit.utility.SystemUtility;

public enum PlatformType {

    WINDOWS(new String[]{"rundll32", "url.dll,FileProtocolHandler"}, null) {
        public boolean matchesSystem() {
            String os = SystemUtility.osName();
            return os != null && os.startsWith("Windows");
        }
    },
    MACINTOSH(new String[]{"bin/mac/start-firefox.sh"}, "bin/mac/stop-firefox.sh") {
        public boolean matchesSystem() {
            String os = SystemUtility.osName();
            return os != null && os.startsWith("Mac");
        }
    },
    UNIX(new String[]{"bin/unix/start-firefox.sh"}, "bin/unix/stop-firefox.sh") {
        public boolean matchesSystem() {
            //TODO: uhhh...
            return false;
        }
    };

    public static PlatformType DEFAULT = UNIX;

    private String[] defaultBrowserCommandLineArray;
    private String defaultBrowserKillCommand;

    private PlatformType(String[] defaultBrowserCommandLineArray, String defaultBrowserKillCommand) {
        this.defaultBrowserKillCommand = defaultBrowserKillCommand;
        this.defaultBrowserCommandLineArray = defaultBrowserCommandLineArray;
    }

    public static PlatformType resolve() {
        for (PlatformType type : values()) {
            if (type.matchesSystem())
                return type;
        }
        return DEFAULT;
    }

    protected abstract boolean matchesSystem();

    public String[] getDefaultCommandLineBrowserArray() {
        return defaultBrowserCommandLineArray;
    }

    public String getDefaultBrowserKillCommand() {
        return defaultBrowserKillCommand;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -