本文整理汇总了Java中org.eclipse.jdt.internal.corext.util.JavaModelUtil.getExecutionEnvironmentCompliance方法的典型用法代码示例。如果您正苦于以下问题:Java JavaModelUtil.getExecutionEnvironmentCompliance方法的具体用法?Java JavaModelUtil.getExecutionEnvironmentCompliance怎么用?Java JavaModelUtil.getExecutionEnvironmentCompliance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.util.JavaModelUtil
的用法示例。
在下文中一共展示了JavaModelUtil.getExecutionEnvironmentCompliance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultEEName
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private String getDefaultEEName() {
IVMInstall defaultVM= JavaRuntime.getDefaultVMInstall();
IExecutionEnvironment[] environments= JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments();
if (defaultVM != null) {
for (int i= 0; i < environments.length; i++) {
IVMInstall eeDefaultVM= environments[i].getDefaultVM();
if (eeDefaultVM != null && defaultVM.getId().equals(eeDefaultVM.getId()))
return environments[i].getId();
}
}
String defaultCC=JavaModelUtil.VERSION_LATEST;
if (defaultVM instanceof IVMInstall2)
defaultCC= JavaModelUtil.getCompilerCompliance((IVMInstall2)defaultVM, defaultCC);
for (int i= 0; i < environments.length; i++) {
String eeCompliance= JavaModelUtil.getExecutionEnvironmentCompliance(environments[i]);
if (defaultCC.endsWith(eeCompliance))
return environments[i].getId();
}
return "JavaSE-1.7"; //$NON-NLS-1$
}
示例2: fillExecutionEnvironments
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private void fillExecutionEnvironments(ComboDialogField comboField) {
String selectedItem= getLastSelectedEE();
int selectionIndex= -1;
if (fUseEEJRE.isSelected()) {
selectionIndex= comboField.getSelectionIndex();
if (selectionIndex != -1) {// paranoia
selectedItem= comboField.getItems()[selectionIndex];
}
}
fInstalledEEs= JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments();
Arrays.sort(fInstalledEEs, new Comparator<IExecutionEnvironment>() {
public int compare(IExecutionEnvironment arg0, IExecutionEnvironment arg1) {
return Policy.getComparator().compare(arg0.getId(), arg1.getId());
}
});
selectionIndex= -1;//find new index
String[] eeLabels= new String[fInstalledEEs.length];
fEECompliance= new String[fInstalledEEs.length];
for (int i= 0; i < fInstalledEEs.length; i++) {
eeLabels[i]= fInstalledEEs[i].getId();
if (selectedItem != null && eeLabels[i].equals(selectedItem)) {
selectionIndex= i;
}
fEECompliance[i]= JavaModelUtil.getExecutionEnvironmentCompliance(fInstalledEEs[i]);
}
comboField.setItems(eeLabels);
if (selectionIndex == -1) {
comboField.selectItem(getDefaultEEName());
} else {
comboField.selectItem(selectedItem);
}
}
示例3: findBestMatchingEE
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的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;
}
示例4: getDefaultEEName
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private String getDefaultEEName() {
IVMInstall defaultVM= JavaRuntime.getDefaultVMInstall();
IExecutionEnvironment[] environments= JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments();
if (defaultVM != null) {
for (int i= 0; i < environments.length; i++) {
IVMInstall eeDefaultVM= environments[i].getDefaultVM();
if (eeDefaultVM != null && defaultVM.getId().equals(eeDefaultVM.getId()))
return environments[i].getId();
}
}
String defaultCC;
if (defaultVM instanceof IVMInstall2) {
defaultCC= JavaModelUtil.getCompilerCompliance((IVMInstall2)defaultVM, JavaCore.VERSION_1_4);
} else {
defaultCC= JavaCore.VERSION_1_4;
}
for (int i= 0; i < environments.length; i++) {
String eeCompliance= JavaModelUtil.getExecutionEnvironmentCompliance(environments[i]);
if (defaultCC.endsWith(eeCompliance))
return environments[i].getId();
}
return "JavaSE-1.6"; //$NON-NLS-1$
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:28,代码来源:NewJavaProjectWizardPageOne.java