本文整理汇总了Java中org.eclipse.jdt.launching.environments.IExecutionEnvironment.getId方法的典型用法代码示例。如果您正苦于以下问题:Java IExecutionEnvironment.getId方法的具体用法?Java IExecutionEnvironment.getId怎么用?Java IExecutionEnvironment.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.launching.environments.IExecutionEnvironment
的用法示例。
在下文中一共展示了IExecutionEnvironment.getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExecutionEnvironmentCompliance
import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入方法依赖的package包/类
public static String getExecutionEnvironmentCompliance(IExecutionEnvironment executionEnvironment) {
Map<String, String> complianceOptions= executionEnvironment.getComplianceOptions();
if (complianceOptions != null) {
Object compliance= complianceOptions.get(JavaCore.COMPILER_COMPLIANCE);
if (compliance instanceof String)
return (String)compliance;
}
// fallback:
String desc= executionEnvironment.getId();
if (desc.indexOf(JavaCore.VERSION_1_8) != -1) {
return JavaCore.VERSION_1_8;
} else if (desc.indexOf(JavaCore.VERSION_1_7) != -1) {
return JavaCore.VERSION_1_7;
} else if (desc.indexOf(JavaCore.VERSION_1_6) != -1) {
return JavaCore.VERSION_1_6;
} else if (desc.indexOf(JavaCore.VERSION_1_5) != -1) {
return JavaCore.VERSION_1_5;
} else if (desc.indexOf(JavaCore.VERSION_1_4) != -1) {
return JavaCore.VERSION_1_4;
}
return JavaCore.VERSION_1_3;
}
示例2: getExecutionEnvironmentCompliance
import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入方法依赖的package包/类
public static String getExecutionEnvironmentCompliance(IExecutionEnvironment executionEnvironment) {
Map<String, String> complianceOptions= executionEnvironment.getComplianceOptions();
if (complianceOptions != null) {
Object compliance= complianceOptions.get(JavaCore.COMPILER_COMPLIANCE);
if (compliance instanceof String)
return (String)compliance;
}
// fallback:
String desc= executionEnvironment.getId();
if (desc.indexOf(JavaCore.VERSION_1_7) != -1) {
return JavaCore.VERSION_1_7;
} else if (desc.indexOf(JavaCore.VERSION_1_6) != -1) {
return JavaCore.VERSION_1_6;
} else if (desc.indexOf(JavaCore.VERSION_1_5) != -1) {
return JavaCore.VERSION_1_5;
} else if (desc.indexOf(JavaCore.VERSION_1_4) != -1) {
return JavaCore.VERSION_1_4;
}
return JavaCore.VERSION_1_3;
}
示例3: findBestMatchingEE
import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入方法依赖的package包/类
private IExecutionEnvironment findBestMatchingEE() {
IExecutionEnvironmentsManager eeManager= JavaRuntime.getExecutionEnvironmentsManager();
IExecutionEnvironment[] ees= eeManager.getExecutionEnvironments();
IExecutionEnvironment bestEE= null;
String bestEECompliance= null;
for (int i= 0; i < ees.length; i++) {
IExecutionEnvironment ee= ees[i];
String eeCompliance= JavaModelUtil.getExecutionEnvironmentCompliance(ee);
String eeId= ee.getId();
if (fRequiredVersion.equals(eeCompliance)) {
if (eeId.startsWith("J") && eeId.endsWith(fRequiredVersion)) { //$NON-NLS-1$
bestEE= ee;
break; // perfect match
}
} else if (JavaModelUtil.isVersionLessThan(eeCompliance, fRequiredVersion)) {
continue; // no match
} else { // possible match
if (bestEE != null) {
if (! eeId.startsWith("J")) { //$NON-NLS-1$
continue; // avoid taking e.g. OSGi profile if a Java profile is available
}
if (JavaModelUtil.isVersionLessThan(bestEECompliance, eeCompliance)) {
continue; // the other one is the least matching
}
}
}
// found a new best
bestEE= ee;
bestEECompliance= eeCompliance;
}
return bestEE;
}