platformtype.java
来自「sourcode about java basic」· Java 代码 · 共 54 行
JAVA
54 行
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 + =
减小字号Ctrl + -
显示快捷键?