当前位置: 首页>>代码示例>>Java>>正文


Java IExecutionEnvironment类代码示例

本文整理汇总了Java中org.eclipse.jdt.launching.environments.IExecutionEnvironment的典型用法代码示例。如果您正苦于以下问题:Java IExecutionEnvironment类的具体用法?Java IExecutionEnvironment怎么用?Java IExecutionEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IExecutionEnvironment类属于org.eclipse.jdt.launching.environments包,在下文中一共展示了IExecutionEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavaModelUtil.java

示例2: getDefaultEEName

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的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$
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:NewJavaProjectWizardPageOne.java

示例3: updateComplianceFollowsEE

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
private void updateComplianceFollowsEE() {
	if (fProject != null) {
		String complianceFollowsEE= DISABLED;
		IExecutionEnvironment ee= getEE();
		String label;
		if (ee != null) {
			complianceFollowsEE= getComplianceFollowsEE(ee);
			label= Messages.format(PreferencesMessages.ComplianceConfigurationBlock_compliance_follows_EE_with_EE_label, ee.getId());
		} else {
			label= PreferencesMessages.ComplianceConfigurationBlock_compliance_follows_EE_label;
		}
		Link checkBoxLink= getCheckBoxLink(INTR_COMPLIANCE_FOLLOWS_EE);
		if (checkBoxLink != null) {
			checkBoxLink.setText(label);
		}
		setValue(INTR_COMPLIANCE_FOLLOWS_EE, complianceFollowsEE);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:ComplianceConfigurationBlock.java

示例4: getEE

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
private IExecutionEnvironment getEE() {
	if (fProject == null)
		return null;
	
	try {
		IClasspathEntry[] entries= JavaCore.create(fProject).getRawClasspath();
		for (int i= 0; i < entries.length; i++) {
			IClasspathEntry entry= entries[i];
			if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
				String eeId= JavaRuntime.getExecutionEnvironmentId(entry.getPath());
				if (eeId != null) {
					return JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(eeId);
				}
			}
		}
	} catch (CoreException e) {
		JavaPlugin.log(e);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ComplianceConfigurationBlock.java

示例5: getEEOptions

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
/**
 * Returns the compliance options from the given EE. If the result is not <code>null</code>,
 * it contains at least these core options:
 * <ul>
 * <li>{@link JavaCore#COMPILER_COMPLIANCE}</li>
 * <li>{@link JavaCore#COMPILER_SOURCE}</li>
 * <li>{@link JavaCore#COMPILER_CODEGEN_TARGET_PLATFORM}</li>
 * <li>{@link JavaCore#COMPILER_PB_ASSERT_IDENTIFIER}</li>
 * <li>{@link JavaCore#COMPILER_PB_ENUM_IDENTIFIER}</li>
 * <li>{@link JavaCore#COMPILER_CODEGEN_INLINE_JSR_BYTECODE} for compliance levels 1.5 and greater</li>
 * </ul>
 * 
 * @param ee the EE, can be <code>null</code>
 * @return the options, or <code>null</code> if none
 * @since 3.5
 */
public static Map<String, String> getEEOptions(IExecutionEnvironment ee) {
	if (ee == null)
		return null;
	Map<String, String> eeOptions= ee.getComplianceOptions();
	if (eeOptions == null)
		return null;
	
	Object complianceOption= eeOptions.get(JavaCore.COMPILER_COMPLIANCE);
	if (!(complianceOption instanceof String))
		return null;

	// eeOptions can miss some options, make sure they are complete:
	HashMap<String, String> options= new HashMap<String, String>();
	JavaModelUtil.setComplianceOptions(options, (String)complianceOption);
	options.putAll(eeOptions);
	return options;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:BuildPathSupport.java

示例6: 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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:22,代码来源:JavaModelUtil.java

示例7: verifyVMInstall

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
@Override
public IVMInstall verifyVMInstall(ILaunchConfiguration configuration) throws CoreException {
	IVMInstall vm = super.verifyVMInstall(configuration);
	IVMInstall compatibleVM = null;
	IExecutionEnvironment env = EnvironmentsManager.getDefault().getEnvironment("JavaSE-1.8");
	List<IVMInstall> vms = Arrays.asList(env.getCompatibleVMs());
	if (vms.isEmpty() || vms.contains(vm)) {
		compatibleVM = vm;
	} else {
		compatibleVM = vms.get(0);
	}
	return compatibleVM;
}
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:14,代码来源:WildFlySwarmLaunchConfiguration.java

示例8: setCompatibleVMs

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
public static void setCompatibleVMs(String id) {
	// update all environments compatible to use the test JRE
	IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
	IExecutionEnvironment[] environments = manager.getExecutionEnvironments();
	for (IExecutionEnvironment environment : environments) {
		IVMInstall[] compatibleVMs = environment.getCompatibleVMs();
		for (IVMInstall compatibleVM : compatibleVMs) {
			if (id.equals(compatibleVM.getVMInstallType().getId()) && compatibleVM.getVMInstallType().findVMInstall(compatibleVM.getId()) != null && !compatibleVM.equals(environment.getDefaultVM())
			// Fugly way to ensure the lowest VM version is set:
					&& (environment.getDefaultVM() == null || compatibleVM.getId().compareTo(environment.getDefaultVM().getId()) < 0)) {
				environment.setDefaultVM(compatibleVM);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:16,代码来源:JDTUtils.java

示例9: linkWithExecutionEnvironments

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
protected void linkWithExecutionEnvironments(IVMInstall installedVm, InstalledJre jreToAdd) {
	if (jreToAdd.getExecutionEnvironments().isEmpty()) {
		return;
	} else {
		Set<String> execEnvsToAdd = new HashSet<>(jreToAdd.getExecutionEnvironments());
		IExecutionEnvironment[] executionEnvironments = JavaRuntime.getExecutionEnvironmentsManager()
				.getExecutionEnvironments();
		for (IExecutionEnvironment iExecutionEnvironment : executionEnvironments) {
			if (execEnvsToAdd.contains(iExecutionEnvironment.getId())) {
				iExecutionEnvironment.setDefaultVM(installedVm);
			}
		}
	}
}
 
开发者ID:diffplug,项目名称:goomph,代码行数:15,代码来源:InstalledJreAdderInternal.java

示例10: getMatchingEnvironments

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
@Override
protected IExecutionEnvironment[] getMatchingEnvironments() throws CoreException {
	return new ProductValidationOperation(null) {
		@Override
		public IExecutionEnvironment[] getMatchingEnvironments() throws CoreException {
			return super.getMatchingEnvironments();
		}
	}.getMatchingEnvironments();
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:10,代码来源:ProductEclipsePluginValidationOperation.java

示例11: addProjectSettings

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
public static void addProjectSettings(IProject project, ProjectSettings settings, boolean includeStdLib) throws JavaModelException {
	IJavaProject javaProject = JavaCore.create(project);

	List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
	IExecutionEnvironmentsManager executionEnvironmentsManager = JavaRuntime.getExecutionEnvironmentsManager();
	IExecutionEnvironment[] executionEnvironments = executionEnvironmentsManager.getExecutionEnvironments();
	for (IExecutionEnvironment iExecutionEnvironment : executionEnvironments) {
		if (iExecutionEnvironment.getId().equals(settings.executionEnviromentID)) {
			entries.add(JavaCore.newContainerEntry(JavaRuntime.newJREContainerPath(iExecutionEnvironment)));
			break;
		}
	}

	IPackageFragmentRoot packageRoot = javaProject.getPackageFragmentRoot(settings.source);

	IPackageFragmentRoot packageRootSrcGen = javaProject.getPackageFragmentRoot(settings.sourcegen);

	entries.add(JavaCore.newContainerEntry(RuntimeLibraryContainerInitializer.LIBRARY_PATH));
	if (includeStdLib) {
		entries.add(JavaCore.newSourceEntry(STDLIB_PATH));
	}
	entries.add(JavaCore.newSourceEntry(packageRoot.getPath()));
	entries.add(JavaCore.newSourceEntry(packageRootSrcGen.getPath()));

	javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);
	javaProject.setOutputLocation(settings.output.getFullPath(), null);
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:28,代码来源:ProjectCreator.java

示例12: fillExecutionEnvironments

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的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);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:NewJavaProjectWizardPageOne.java

示例13: 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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:ReorgCorrectionsSubProcessor.java

示例14: getAdditionalProposalInfo

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
@Override
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
	StringBuffer message= new StringBuffer();
	if (fChangeOnWorkspace) {
		message.append(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_required_compliance_changeworkspace_description, fRequiredVersion));
	} else {
		message.append(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_required_compliance_changeproject_description, fRequiredVersion));
	}

	try {
		IVMInstall install= JavaRuntime.getVMInstall(fProject); // can be null
		if (fChangeOnWorkspace) {
			IVMInstall vmInstall= findRequiredOrGreaterVMInstall();
			if (vmInstall != null) {
				IVMInstall defaultVM= JavaRuntime.getDefaultVMInstall(); // can be null
				if (defaultVM != null && !defaultVM.equals(install)) {
					message.append(CorrectionMessages.ReorgCorrectionsSubProcessor_50_compliance_changeProjectJREToDefault_description);
				}
				if (defaultVM == null || !isRequiredOrGreaterVMInstall(defaultVM)) {
					message.append(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_50_compliance_changeWorkspaceJRE_description, vmInstall.getName()));
				}
			}
		} else {
			IExecutionEnvironment bestEE= findBestMatchingEE();
			if (bestEE != null) {
				if (install == null || !isEEOnClasspath(bestEE)) {
					message.append(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_50_compliance_changeProjectJRE_description, bestEE.getId()));
				}
			}
		}
	} catch (CoreException e) {
		// ignore
	}
	return message.toString();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:ReorgCorrectionsSubProcessor.java

示例15: isEEOnClasspath

import org.eclipse.jdt.launching.environments.IExecutionEnvironment; //导入依赖的package包/类
private boolean isEEOnClasspath(IExecutionEnvironment ee) throws JavaModelException {
	IPath eePath= JavaRuntime.newJREContainerPath(ee);
	
	for (IClasspathEntry entry: fProject.getRawClasspath()) {
		if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER && entry.getPath().equals(eePath))
			return true;
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:ReorgCorrectionsSubProcessor.java


注:本文中的org.eclipse.jdt.launching.environments.IExecutionEnvironment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。