本文整理了Java中org.eclipse.core.runtime.Platform.getOS()
方法的一些代码示例,展示了Platform.getOS()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getOS()
方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getOS
[英]Returns the string name of the current operating system for use in finding files whose path starts with $os$
. OS_UNKNOWN
is returned if the operating system cannot be determined. The value may indicate one of the operating systems known to the platform (as specified in knownOSValues
) or a user-defined string if the operating system name is specified on the command line.
Clients are also able to acquire the EnvironmentInfo service and query it for the operating-system.
[中]返回当前操作系统的字符串名称,用于查找路径以$os$
开头的文件。如果无法确定操作系统,则返回OS_UNKNOWN
。该值可能表示平台已知的操作系统之一(如knownOSValues
中所指定),或者如果在命令行上指定了操作系统名称,则表示用户定义的字符串。
客户还可以获取EnvironmentInfo服务并查询其操作系统。
代码示例来源:origin: eclipse/eclipse.jdt.ls
protected static boolean isWindows() {
return Platform.OS_WIN32.equals(Platform.getOS());
}
代码示例来源:origin: org.eclipse.equinox.p2.ui.sdk/scheduler
private ConfigurationDescriptor getConfigdataFromProductFile(File installFolder) {
Object[] productFileInfo = loadEclipseProductFile(installFolder);
//Contrarily to the runtime, when the .eclipseproduct can't be found, we don't fallback to org.eclipse.platform.
if (productFileInfo.length == 0)
return null;
return new ConfigurationDescriptor((String) productFileInfo[0], (Identifier) productFileInfo[1], getInstallDirHash(installFolder), Platform.getOS() + '_' + Platform.getWS() + '_' + Platform.getOSArch(), null);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.help
private boolean filterByOS(String os) {
return !os.equals(Platform.getOS());
}
代码示例来源:origin: org.eclipse/org.eclipse.help.ui
public boolean isAvailable() {
return Constants.WS_WIN32.equalsIgnoreCase(Platform.getOS());
}
/*
代码示例来源:origin: org.eclipse/org.eclipse.pde.core
public String getDisplayOS() {
if (fOS == null || fOS.trim().length() == 0)
return Platform.getOS();
return fOS.trim();
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
public static File toFile(URI uri) {
if (Platform.OS_WIN32.equals(Platform.getOS())) {
return URIUtil.toFile(uri);
}
return new File(uri);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.launching
@Override
public File detectInstallLocation() {
// We want a Mac OSX VM install so don't process the install location for this type
if(Platform.OS_MACOSX.equals(Platform.getOS())) {
return null;
}
return getJavaHomeLocation();
}
代码示例来源:origin: org.eclipse/org.eclipse.pde.core
/**
* Returns the target operating system as specified on the <b>Environment</b>
* tab of the <b>Plug-in Development > Target Platform</b> preference page.
*
* @return the target operating system
*/
public static String getOS() {
return getProperty(ICoreConstants.OS, Platform.getOS());
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jdt.launching
@Override
public File detectInstallLocation() {
// We want a Mac OSX VM install so don't process the install location for this type
if(Platform.OS_MACOSX.equals(Platform.getOS())) {
return null;
}
return getJavaHomeLocation();
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jdt.launching
private static String[] quoteWindowsArgs(String[] cmdLine) {
// see https://bugs.eclipse.org/387504 , workaround for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6511002
if (Platform.getOS().equals(Constants.OS_WIN32)) {
String[] winCmdLine = new String[cmdLine.length];
if(cmdLine.length > 0) {
winCmdLine[0] = cmdLine[0];
}
for (int i = 1; i < cmdLine.length; i++) {
winCmdLine[i] = winQuote(cmdLine[i]);
}
cmdLine = winCmdLine;
}
return cmdLine;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.frameworks
public static boolean isPlatformCaseSensitive() {
return Platform.OS_MACOSX.equals(Platform.getOS()) ? false : new
java.io.File("a").compareTo(new java.io.File("A")) != 0; //$NON-NLS-1$//$NON-NLS-2$
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
/**
* Fix uris by adding missing // to single file:/ prefix
*/
public static String fixURI(URI uri) {
if (Platform.OS_WIN32.equals(Platform.getOS()) && URIUtil.isFileURI(uri)) {
uri = URIUtil.toFile(uri).toURI();
}
String uriString = uri.toString();
return uriString.replaceFirst("file:/([^/])", "file:///$1");
}
代码示例来源:origin: org.eclipse/org.eclipse.team.cvs.ssh
static String defaultFilename() {
if (!Platform.getOS().equals(Platform.OS_LINUX)) return internalFilename();
String HOME = System.getProperty("user.home"); //$NON-NLS-1$
if (HOME==null) return internalFilename();
return HOME+"/.ssh/known_hosts"; //$NON-NLS-1$
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.core.resources
static private IPath convertToProperCase(IPath path) {
if (Platform.getOS().equals(Platform.OS_WIN32))
return Path.fromPortableString(path.toPortableString().toLowerCase());
return path;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.core.resources
static private IPath convertToProperCase(IPath path) {
if (Platform.getOS().equals(Platform.OS_WIN32))
return Path.fromPortableString(path.toPortableString().toLowerCase());
return path;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources
static private IPath convertToProperCase(IPath path) {
if (Platform.getOS().equals(Platform.OS_WIN32))
return Path.fromPortableString(path.toPortableString().toLowerCase());
return path;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
private IPath convertToProperCase(IPath path) {
if (Platform.getOS().equals(Platform.OS_WIN32))
return Path.fromPortableString(path.toPortableString()
.toLowerCase());
return path;
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
private IPath fixDevice(IPath path) {
if (path != null && path.getDevice() != null) {
return path.setDevice(path.getDevice().toUpperCase());
}
if (Platform.OS_WIN32.equals(Platform.getOS()) && path != null && path.toString().startsWith("//")) {
String server = path.segment(0);
String pathStr = path.toString().replace(server, server.toUpperCase());
return new Path(pathStr);
}
return path;
}
代码示例来源:origin: eclipse-cdt/cdt
/**
* On Windows, interrupt the spawned program by send it a CTRL-C (even if it's a Cygwin program). On
* linux, interrupt it by raising a SIGINT.
*
* @since 5.2
*/
public int interruptCTRLC() {
if (Platform.getOS().equals(Platform.OS_WIN32)) {
return raise(pid, CTRLC);
} else {
return interrupt();
}
}
代码示例来源:origin: eclipse-cdt/cdt
public PersistentPTY(Mode mode) throws IOException {
super(mode);
in2 = new PersistentPTYInputStream(new MasterFD());
out2 = new PersistentPTYOutputStream(new MasterFD(), !Platform.OS_WIN32.equals(Platform.getOS()));
}
内容来源于网络,如有侵权,请联系作者删除!