本文整理汇总了Java中org.eclipse.jdt.launching.JavaRuntime.getVMInstallTypes方法的典型用法代码示例。如果您正苦于以下问题:Java JavaRuntime.getVMInstallTypes方法的具体用法?Java JavaRuntime.getVMInstallTypes怎么用?Java JavaRuntime.getVMInstallTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.launching.JavaRuntime
的用法示例。
在下文中一共展示了JavaRuntime.getVMInstallTypes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAllVMs
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
* This method will fetch and set All Available JVMs in Dropdown
*/
private void setAllVMs() {
final List<IVMInstall> allVMs = new ArrayList<>();
final IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
for (final IVMInstallType vmType : vmTypes) {
final IVMInstall[] vms = vmType.getVMInstalls();
for (final IVMInstall vm : vms) {
allVMs.add(vm);
}
}
this.jvmNamesAndValues = new String[allVMs.size()][2];
for (int i = 0; i < allVMs.size(); i++) {
this.jvmNamesAndValues[i][0] = allVMs.get(i).getName();
this.jvmNamesAndValues[i][1] = allVMs.get(i).getId();
}
}
示例2: eclipseAndJvmSupportedJavaVersion
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/** TopCoder supports java 1.8. */
private static String eclipseAndJvmSupportedJavaVersion() {
boolean jvm18Installed = false;
for(IVMInstallType vm : JavaRuntime.getVMInstallTypes()) {
for(IVMInstall inst : vm.getVMInstalls()) {
if(inst instanceof IVMInstall2) {
String jvmVersion = ((IVMInstall2) inst).getJavaVersion();
String[] jvmVersionParts = jvmVersion.split("\\.");
int major = Integer.parseInt(jvmVersionParts[0]);
int minor = Integer.parseInt(jvmVersionParts[1]);
if((major == 1 && minor >= 8) || major >=2) {
jvm18Installed = true;
}
}
}
}
Version jdtVersion = JavaCore.getJavaCore().getBundle().getVersion();
boolean jdtSupports18 = jdtVersion.getMajor() >= 4
|| (jdtVersion.getMajor() == 3 && jdtVersion.getMinor() >= 10)
|| (jdtVersion.getMajor() == 3 && jdtVersion.getMinor() >= 9 && jdtVersion.getMicro() >= 50);
return jvm18Installed && jdtSupports18 ? "1.8" : "1.7";
}
示例3: findRequiredOrGreaterVMInstall
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private IVMInstall findRequiredOrGreaterVMInstall() {
String bestMatchingCompliance= null;
IVMInstall bestMatchingVMInstall= null;
IVMInstallType[] installTypes= JavaRuntime.getVMInstallTypes();
for (int i= 0; i < installTypes.length; i++) {
IVMInstall[] installs= installTypes[i].getVMInstalls();
for (int k= 0; k < installs.length; k++) {
String vmInstallCompliance= getVMInstallCompliance(installs[k]);
if (fRequiredVersion.equals(vmInstallCompliance)) {
return installs[k]; // perfect match
} else if (JavaModelUtil.isVersionLessThan(vmInstallCompliance, fRequiredVersion)) {
continue; // no match
} else if (bestMatchingVMInstall != null) {
if (JavaModelUtil.isVersionLessThan(bestMatchingCompliance, vmInstallCompliance)) {
continue; // the other one is the least matching
}
}
bestMatchingCompliance= vmInstallCompliance;
bestMatchingVMInstall= installs[k];
}
}
return null;
}
示例4: getVMInstall
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
*
* @return
*/
public IVMInstall getVMInstall() {
final IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
for (final IVMInstallType vmType : vmTypes) {
final IVMInstall[] vms = vmType.getVMInstalls();
for (final IVMInstall vm : vms) {
if (vm.getId().equals(WeblogicPlugin.getDefault().getJRE())) {
return vm;
}
}
}
return JavaRuntime.getDefaultVMInstall();
}
示例5: findVM
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private IVMInstall findVM(File jvmHome) {
IVMInstallType[] types = JavaRuntime.getVMInstallTypes();
for (IVMInstallType type : types) {
IVMInstall[] installs = type.getVMInstalls();
for (IVMInstall install : installs) {
if (jvmHome.equals(install.getInstallLocation())) {
return install;
}
}
}
return null;
}
示例6: runWithinEclipse
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
@Override
protected void runWithinEclipse() throws Throwable {
IVMInstallType[] types = JavaRuntime.getVMInstallTypes();
for (IVMInstallType type : types) {
if ("org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType".equals(type.getId())) {
for (InstalledJre jreToAdd : host.installedJres) {
IVMInstall realVM = addInstalledJre(type, jreToAdd);
if (jreToAdd.isMarkDefault()) {
JavaRuntime.setDefaultVMInstall(realVM, new NullProgressMonitor());
}
linkWithExecutionEnvironments(realVM, jreToAdd);
}
}
}
}
示例7: findJre
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private IVMInstall findJre(String version, File location) throws Exception {
for (IVMInstallType vmInstallType : JavaRuntime.getVMInstallTypes()) {
for (IVMInstall vmInstall : vmInstallType.getVMInstalls()) {
File installLocation = vmInstall.getInstallLocation();
if (location.equals(installLocation)) {
return vmInstall;
}
}
}
return null;
}
示例8: enforcePreferredCompilerCompliance
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
* Makes the given project use JDK 6 (or more specifically,
* {@link AdtConstants#COMPILER_COMPLIANCE_PREFERRED} as the compilation
* target, regardless of what the default IDE JDK level is, provided a JRE
* of the given level is installed.
*
* @param javaProject the Java project
* @throws CoreException if the IDE throws an exception setting the compiler
* level
*/
@SuppressWarnings("restriction") // JDT API for setting compliance options
public static void enforcePreferredCompilerCompliance(IJavaProject javaProject)
throws CoreException {
String compliance = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
if (compliance == null ||
JavaModelUtil.isVersionLessThan(compliance, COMPILER_COMPLIANCE_PREFERRED)) {
IVMInstallType[] types = JavaRuntime.getVMInstallTypes();
for (int i = 0; i < types.length; i++) {
IVMInstallType type = types[i];
IVMInstall[] installs = type.getVMInstalls();
for (int j = 0; j < installs.length; j++) {
IVMInstall install = installs[j];
if (install instanceof IVMInstall2) {
IVMInstall2 install2 = (IVMInstall2) install;
// Java version can be 1.6.0, and preferred is 1.6
if (install2.getJavaVersion().startsWith(COMPILER_COMPLIANCE_PREFERRED)) {
Map<String, String> options = javaProject.getOptions(false);
JavaCore.setComplianceOptions(COMPILER_COMPLIANCE_PREFERRED, options);
JavaModelUtil.setDefaultClassfileOptions(options,
COMPILER_COMPLIANCE_PREFERRED);
javaProject.setOptions(options);
return;
}
}
}
}
}
}
示例9: TypeInfoLabelProvider
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public TypeInfoLabelProvider(ITypeInfoImageProvider extension) {
fProviderExtension= extension;
List locations= new ArrayList();
List labels= new ArrayList();
IVMInstallType[] installs= JavaRuntime.getVMInstallTypes();
for (int i= 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
fInstallLocations= (String[])locations.toArray(new String[locations.size()]);
fVMNames= (String[])labels.toArray(new String[labels.size()]);
}
示例10: getWorkspaceJREs
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private IVMInstall[] getWorkspaceJREs() {
List<VMStandin> standins = new ArrayList<VMStandin>();
IVMInstallType[] types = JavaRuntime.getVMInstallTypes();
for (int i = 0; i < types.length; i++) {
IVMInstallType type = types[i];
IVMInstall[] installs = type.getVMInstalls();
for (int j = 0; j < installs.length; j++) {
IVMInstall install = installs[j];
standins.add(new VMStandin(install));
}
}
return standins.toArray(new IVMInstall[standins.size()]);
}
示例11: TypeInfoUtil
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public TypeInfoUtil(ITypeInfoImageProvider extension) {
fProviderExtension= extension;
List<IPath> locations= new ArrayList<IPath>();
List<String> labels= new ArrayList<String>();
IVMInstallType[] installs= JavaRuntime.getVMInstallTypes();
for (int i= 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
fInstallLocations= CollectionsUtil.toArray(locations, IPath.class);
fVMNames= labels.toArray(new String[labels.size()]);
}
示例12: TypeItemsComparator
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
* Creates new instance of TypeItemsComparator
*/
public TypeItemsComparator() {
List<String> locations= new ArrayList<String>();
List<String> labels= new ArrayList<String>();
IVMInstallType[] installs= JavaRuntime.getVMInstallTypes();
for (int i= 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
fInstallLocations= locations.toArray(new String[locations.size()]);
fVMNames= labels.toArray(new String[labels.size()]);
}
示例13: updateJREs
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
protected void updateJREs()
{
Trace.trace(Trace.CONFIG, "JettyRuntimeComposite: updateJRE(): start");
// get all installed JVMs
_installedJREs = new ArrayList<IVMInstall>();
IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
int size = vmInstallTypes.length;
for (int i = 0; i < size; i++)
{
IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
int size2 = vmInstalls.length;
for (int j = 0; j < size2; j++)
{
_installedJREs.add(vmInstalls[j]);
}
}
// get names
size = _installedJREs.size();
_jreNames = new String[size + 1];
_jreNames[0] = Messages.runtimeDefaultJRE;
for (int i = 0; i < size; i++)
{
IVMInstall vmInstall = (IVMInstall)_installedJREs.get(i);
_jreNames[i + 1] = vmInstall.getName();
}
Trace.trace(Trace.CONFIG, "JettyRuntimeComposite: updateJRE(): end");
}
示例14: TypeInfoUtil
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public TypeInfoUtil(ITypeInfoImageProvider extension) {
fProviderExtension= extension;
List<String> locations= new ArrayList<String>();
List<String> labels= new ArrayList<String>();
IVMInstallType[] installs= JavaRuntime.getVMInstallTypes();
for (int i= 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
fInstallLocations= locations.toArray(new String[locations.size()]);
fVMNames= labels.toArray(new String[labels.size()]);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:13,代码来源:FilteredTypesSelectionDialog.java
示例15: getAllVMInstances
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public static IVMInstall[] getAllVMInstances( )
{
ArrayList res = new ArrayList( );
IVMInstallType[] types = JavaRuntime.getVMInstallTypes( );
for ( int i = 0; i < types.length; i++ )
{
IVMInstall[] installs = types[i].getVMInstalls( );
for ( int k = 0; k < installs.length; k++ )
{
res.add( installs[k] );
}
}
return (IVMInstall[]) res.toArray( new IVMInstall[res.size( )] );
}