當前位置: 首頁>>代碼示例>>Java>>正文


Java JavaRuntime.getExecutionEnvironmentsManager方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.launching.JavaRuntime.getExecutionEnvironmentsManager方法的典型用法代碼示例。如果您正苦於以下問題:Java JavaRuntime.getExecutionEnvironmentsManager方法的具體用法?Java JavaRuntime.getExecutionEnvironmentsManager怎麽用?Java JavaRuntime.getExecutionEnvironmentsManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.launching.JavaRuntime的用法示例。


在下文中一共展示了JavaRuntime.getExecutionEnvironmentsManager方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setCompatibleVMs

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的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

示例2: addProjectSettings

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的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

示例3: findBestMatchingEE

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的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

示例4: hasJavaSE8

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
/**
 * Return {@code true} if we have a Java 8 compatible VM available. Intended for use with
 * {@link org.junit.Assume}.
 */
public static boolean hasJavaSE8() {
  IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
  IExecutionEnvironment java8 = manager.getEnvironment("JavaSE-1.8");
  return java8 != null && java8.getCompatibleVMs().length > 0;
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:10,代碼來源:JavaRuntimeUtils.java

示例5: getWorkspaceInfo

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
private String getWorkspaceInfo() {
	StringBuilder b = new StringBuilder();
	b.append("Projects:\n");
	for (IProject project : getWorkspaceRoot().getProjects()) {
		b.append(project.getName()).append(": ").append(project.getLocation().toOSString()).append('\n');
		if (ProjectUtils.isJavaProject(project)) {
			IJavaProject javaProject = JavaCore.create(project);
			try {
				b.append("  resolved classpath:\n");
				IClasspathEntry[] cpEntries = javaProject.getRawClasspath();
				for (IClasspathEntry cpe : cpEntries) {
					b.append("  ").append(cpe.getPath().toString()).append('\n');
					if (cpe.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
						IPackageFragmentRoot[] roots = javaProject.findPackageFragmentRoots(cpe);
						for (IPackageFragmentRoot root : roots) {
							b.append("    ").append(root.getPath().toString()).append('\n');
						}
					}
				}
			} catch (CoreException e) {
				// ignore
			}
		} else {
			b.append("  non-Java project\n");
		}
	}
	b.append("Java Runtimes:\n");
	IVMInstall defaultVMInstall = JavaRuntime.getDefaultVMInstall();
	b.append("  default: ");
	if (defaultVMInstall != null) {
		b.append(defaultVMInstall.getInstallLocation().toString());
	} else {
		b.append("-");
	}
	IExecutionEnvironmentsManager eem = JavaRuntime.getExecutionEnvironmentsManager();
	for (IExecutionEnvironment ee : eem.getExecutionEnvironments()) {
		IVMInstall[] vms = ee.getCompatibleVMs();
		b.append("  ").append(ee.getDescription()).append(": ");
		if (vms.length > 0) {
			b.append(vms[0].getInstallLocation().toString());
		} else {
			b.append("-");
		}
		b.append("\n");
	}
	return b.toString();
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:48,代碼來源:ProjectsManager.java


注:本文中的org.eclipse.jdt.launching.JavaRuntime.getExecutionEnvironmentsManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。