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


Java JavaRuntime.getVMInstallTypes方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:rajendarreddyj,项目名称:eclipse-weblogic-plugin,代码行数:19,代码来源:JVMOptionsPreferencePage.java

示例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";
}
 
开发者ID:fmoraes74,项目名称:eclipseforces,代码行数:25,代码来源:JavaLanguageSupport.java

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

示例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();
}
 
开发者ID:rajendarreddyj,项目名称:eclipse-weblogic-plugin,代码行数:17,代码来源:WeblogicLauncher.java

示例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;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:13,代码来源:JDTLanguageServer.java

示例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);
			}
		}
	}
}
 
开发者ID:diffplug,项目名称:goomph,代码行数:16,代码来源:InstalledJreAdderInternal.java

示例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;
}
 
开发者ID:diffplug,项目名称:goomph,代码行数:13,代码来源:InstalledJreAdderInternal.java

示例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;
                    }
                }
            }
        }
    }
}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:39,代码来源:ProjectHelper.java

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

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

示例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()]);

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:FilteredTypesSelectionDialog.java

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

示例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");
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:31,代码来源:JettyRuntimeComposite.java

示例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( )] );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:15,代码来源:ReportLauncherUtils.java


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