• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IVMInstall2类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IVMInstall2类属于org.eclipse.jdt.launching包,在下文中一共展示了IVMInstall2类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: eclipseAndJvmSupportedJavaVersion

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的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


示例2: is50OrHigherJRE

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
/**
 * Checks if the JRE of the given project or workspace default JRE have source compliance 1.5 or
 * greater.
 *
 * @param project the project to test or <code>null</code> to test the workspace JRE
 * @return <code>true</code> if the JRE of the given project or workspace default JRE have
 *         source compliance 1.5 or greater.
 * @throws CoreException if unable to determine the project's VM install
 */
public static boolean is50OrHigherJRE(IJavaProject project) throws CoreException {
	IVMInstall vmInstall;
	if (project == null) {
		vmInstall= JavaRuntime.getDefaultVMInstall();
	} else {
		vmInstall= JavaRuntime.getVMInstall(project);
	}
	if (!(vmInstall instanceof IVMInstall2))
		return true; // assume 1.5.

	String compliance= getCompilerCompliance((IVMInstall2) vmInstall, null);
	if (compliance == null)
		return true; // assume 1.5
	return is50OrHigher(compliance);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:JavaModelUtil.java


示例3: getCompilerCompliance

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
public static String getCompilerCompliance(IVMInstall2 vMInstall, String defaultCompliance) {
	String version= vMInstall.getJavaVersion();
	if (version == null) {
		return defaultCompliance;
	} else if (version.startsWith(JavaCore.VERSION_1_8)) {
		return JavaCore.VERSION_1_8;
	} else if (version.startsWith(JavaCore.VERSION_1_7)) {
		return JavaCore.VERSION_1_7;
	} else if (version.startsWith(JavaCore.VERSION_1_6)) {
		return JavaCore.VERSION_1_6;
	} else if (version.startsWith(JavaCore.VERSION_1_5)) {
		return JavaCore.VERSION_1_5;
	} else if (version.startsWith(JavaCore.VERSION_1_4)) {
		return JavaCore.VERSION_1_4;
	} else if (version.startsWith(JavaCore.VERSION_1_3)) {
		return JavaCore.VERSION_1_3;
	} else if (version.startsWith(JavaCore.VERSION_1_2)) {
		return JavaCore.VERSION_1_3;
	} else if (version.startsWith(JavaCore.VERSION_1_1)) {
		return JavaCore.VERSION_1_3;
	}
	return defaultCompliance;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavaModelUtil.java


示例4: getDefaultEEName

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的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


示例5: is50OrHigherJRE

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
/**
 * Checks if the JRE of the given project or workspace default JRE have source compliance 1.5 or
 * greater.
 *
 * @param project the project to test or <code>null</code> to test the workspace JRE
 * @return <code>true</code> if the JRE of the given project or workspace default JRE have
 *         source compliance 1.5 or greater.
 * @throws CoreException if unable to determine the project's VM install
 */
public static boolean is50OrHigherJRE(IJavaProject project) throws CoreException {
	IVMInstall vmInstall;
	if (project == null) {
		vmInstall= JavaRuntime.getDefaultVMInstall();
	} else {
		vmInstall= JavaRuntime.getVMInstall(project);
	}
	if (!(vmInstall instanceof IVMInstall2))
		return true; // assume 1.5.

	String compliance= getCompilerCompliance((IVMInstall2) vmInstall, null);
	if (compliance == null)
		return true; // assume 1.5
	return compliance.startsWith(JavaCore.VERSION_1_5)
			|| compliance.startsWith(JavaCore.VERSION_1_6)
			|| compliance.startsWith(JavaCore.VERSION_1_7);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:27,代码来源:JavaModelUtil.java


示例6: getCompilerCompliance

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
public static String getCompilerCompliance(IVMInstall2 vMInstall, String defaultCompliance) {
	String version= vMInstall.getJavaVersion();
	if (version == null) {
		return defaultCompliance;
	} else if (version.startsWith(JavaCore.VERSION_1_7)) {
		return JavaCore.VERSION_1_7;
	} else if (version.startsWith(JavaCore.VERSION_1_6)) {
		return JavaCore.VERSION_1_6;
	} else if (version.startsWith(JavaCore.VERSION_1_5)) {
		return JavaCore.VERSION_1_5;
	} else if (version.startsWith(JavaCore.VERSION_1_4)) {
		return JavaCore.VERSION_1_4;
	} else if (version.startsWith(JavaCore.VERSION_1_3)) {
		return JavaCore.VERSION_1_3;
	} else if (version.startsWith(JavaCore.VERSION_1_2)) {
		return JavaCore.VERSION_1_3;
	} else if (version.startsWith(JavaCore.VERSION_1_1)) {
		return JavaCore.VERSION_1_3;
	}
	return defaultCompliance;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:22,代码来源:JavaModelUtil.java


示例7: enforcePreferredCompilerCompliance

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的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


示例8: getVMVersion

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
private String getVMVersion(IVMInstall vm) {
	if (vm instanceof IVMInstall2) {
		IVMInstall2 vm2= (IVMInstall2) vm;
		return JavaModelUtil.getCompilerCompliance(vm2, null);
	} else {
		return null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:PasteAction.java


示例9: isRequiredOrGreaterVMInstall

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
private boolean isRequiredOrGreaterVMInstall(IVMInstall install) {
	if (install instanceof IVMInstall2) {
		String compliance= JavaModelUtil.getCompilerCompliance((IVMInstall2) install, JavaCore.VERSION_1_3);
		return !JavaModelUtil.isVersionLessThan(compliance, fRequiredVersion);
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:ReorgCorrectionsSubProcessor.java


示例10: getVMInstallCompliance

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
private String getVMInstallCompliance(IVMInstall install) {
	if (install instanceof IVMInstall2) {
		String compliance= JavaModelUtil.getCompilerCompliance((IVMInstall2) install, JavaCore.VERSION_1_3);
		return compliance;
	}
	return JavaCore.VERSION_1_1;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:ReorgCorrectionsSubProcessor.java


示例11: validateComplianceStatus

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
private void validateComplianceStatus() {
		if (fJRE50InfoText != null && !fJRE50InfoText.isDisposed()) {
			boolean isVisible= false;
			String compliance= getStoredValue(PREF_COMPLIANCE); // get actual value
			IVMInstall install= null;
			if (fProject != null) { // project specific settings: only test if a 50 JRE is installed
				try {
					install= JavaRuntime.getVMInstall(JavaCore.create(fProject));
				} catch (CoreException e) {
					JavaPlugin.log(e);
				}
			} else {
				install= JavaRuntime.getDefaultVMInstall();
			}
			if (install instanceof IVMInstall2) {
				String compilerCompliance= JavaModelUtil.getCompilerCompliance((IVMInstall2) install, compliance);
				if (!compilerCompliance.equals(compliance)) { // Discourage using compiler with version other than compliance
					String[] args= { getVersionLabel(compliance), getVersionLabel(compilerCompliance) };
					if (fProject == null) {
						fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info, args));
					} else {
						fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info_project, args));
					}
					isVisible= true;
				}
			}
			
//			String source= getValue(PREF_SOURCE_COMPATIBILITY);
//			if (VERSION_1_8.equals(source)) {
//				fJRE50InfoText.setText("This is an implementation of an early-draft specification developed under the Java Community Process (JCP) and is made available for testing and evaluation purposes only. The code is not compatible with any specification of the JCP."); //$NON-NLS-1$
//				isVisible= true;
//			}
			
			fJRE50InfoText.setVisible(isVisible);
			fJRE50InfoImage.setImage(isVisible ? JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING) : null);
			fJRE50InfoImage.getParent().layout();
		}
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:ComplianceConfigurationBlock.java


示例12: setDefaultCompilerComplianceValues

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
/**
 * Sets the default compiler compliance options based on the current default JRE in the
 * workspace.
 * 
 * @since 3.5
 */
private void setDefaultCompilerComplianceValues() {
	IVMInstall defaultVMInstall= JavaRuntime.getDefaultVMInstall();
	if (defaultVMInstall instanceof IVMInstall2 && isOriginalDefaultCompliance()) {
		String complianceLevel= JavaModelUtil.getCompilerCompliance((IVMInstall2)defaultVMInstall, JavaCore.VERSION_1_4);
		Map<String, String> complianceOptions= new HashMap<String, String>();
		JavaModelUtil.setComplianceOptions(complianceOptions, complianceLevel);
		setDefaultValue(PREF_COMPLIANCE, complianceOptions.get(PREF_COMPLIANCE.getName()));
		setDefaultValue(PREF_PB_ASSERT_AS_IDENTIFIER, complianceOptions.get(PREF_PB_ASSERT_AS_IDENTIFIER.getName()));
		setDefaultValue(PREF_PB_ENUM_AS_IDENTIFIER, complianceOptions.get(PREF_PB_ENUM_AS_IDENTIFIER.getName()));
		setDefaultValue(PREF_SOURCE_COMPATIBILITY, complianceOptions.get(PREF_SOURCE_COMPATIBILITY.getName()));
		setDefaultValue(PREF_CODEGEN_TARGET_PLATFORM, complianceOptions.get(PREF_CODEGEN_TARGET_PLATFORM.getName()));
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ComplianceConfigurationBlock.java


示例13: getDefaultEEName

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的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


示例14: validateComplianceStatus

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
private void validateComplianceStatus() {
	if (fJRE50InfoText != null && !fJRE50InfoText.isDisposed()) {
		boolean isVisible= false;
		String compliance= getStoredValue(PREF_COMPLIANCE); // get actual value
		IVMInstall install= null;
		if (fProject != null) { // project specific settings: only test if a 50 JRE is installed
			try {
				install= JavaRuntime.getVMInstall(JavaCore.create(fProject));
			} catch (CoreException e) {
				JavaPlugin.log(e);
			}
		} else {
			install= JavaRuntime.getDefaultVMInstall();
		}
		if (install instanceof IVMInstall2) {
			String compilerCompliance= JavaModelUtil.getCompilerCompliance((IVMInstall2) install, compliance);
			if (!compilerCompliance.equals(compliance)) { // Discourage using compiler with version other than compliance
				String[] args= { getVersionLabel(compliance), getVersionLabel(compilerCompliance) };
				if (fProject == null) {
					fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info, args));
				} else {
					fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info_project, args));
				}
				isVisible= true;
			}
		}
		fJRE50InfoText.setVisible(isVisible);
		fJRE50InfoImage.setImage(isVisible ? JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING) : null);
		fJRE50InfoImage.getParent().layout();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:32,代码来源:ComplianceConfigurationBlock.java


示例15: getJavaVersion

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
/**
 * Returns the version of the current VM in use
 * 
 * @return the VM version
 */
private double getJavaVersion( )
{
	String version = null;
	if ( fVMInstance instanceof IVMInstall2 )
	{
		version = ( (IVMInstall2) fVMInstance ).getJavaVersion( );
	}
	else
	{
		LibraryInfo libInfo = LaunchingPlugin.getLibraryInfo( fVMInstance.getInstallLocation( )
				.getAbsolutePath( ) );
		if ( libInfo == null )
		{
			return 0D;
		}
		version = libInfo.getVersion( );
	}
	int index = version.indexOf( "." ); //$NON-NLS-1$
	int nextIndex = version.indexOf( ".", index + 1 ); //$NON-NLS-1$
	try
	{
		if ( index > 0 && nextIndex > index )
		{
			return Double.parseDouble( version.substring( 0, nextIndex ) );
		}
		return Double.parseDouble( version );
	}
	catch ( NumberFormatException e )
	{
		return 0D;
	}

}
 
开发者ID:eclipse,项目名称:birt,代码行数:39,代码来源:StandardScriptVMRunner.java


示例16: prependJREPath

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
/**
 * Prepends the correct java version variable state to the environment path for Mac VMs
 * 
 * @param env the current array of environment variables to run with
 * @param jdkpath the path of the current jdk
 * @since 3.3
 */
protected String[] prependJREPath(String[] env) {
	if (Platform.OS_MACOSX.equals(Platform.getOS())) {
		if (fVMInstance instanceof IVMInstall2) {
			IVMInstall2 vm = (IVMInstall2) fVMInstance;
			String javaVersion = vm.getJavaVersion();
			if (javaVersion != null) {
				if (env == null) {
					Map map = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved();
					if (map.containsKey(JAVA_JVM_VERSION)) {
						String[] env2 = new String[map.size()];
						Iterator iterator = map.entrySet().iterator();
						int i = 0;
						while (iterator.hasNext()) {
							Entry entry = (Entry) iterator.next();
							String key = (String) entry.getKey();
							if (JAVA_JVM_VERSION.equals(key)) {
								env2[i] = key + "=" + javaVersion; //$NON-NLS-1$
							} else {
								env2[i] = key + "=" + (String)entry.getValue(); //$NON-NLS-1$
							}
							i++;
						}
						env = env2;
					}
				} else {
					for (int i = 0; i < env.length; i++) {
						String string = env[i];
						if (string.startsWith(JAVA_JVM_VERSION)) {
							env[i]=JAVA_JVM_VERSION+"="+javaVersion; //$NON-NLS-1$
							break;
						}
					}
				}
			}
		}
	}
	return env;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:46,代码来源:StandardScriptVMRunner.java


示例17: analyze

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
/**
 * Analyzes the given vm install and returns a collection of compatible
 * Select execution environments, possibly empty.
 * 
 * For Select we may match on a subset of SE installs.
 */
public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor)
        throws CoreException {

    // Get the Java version string from the VM
    if (!(vm instanceof IVMInstall2)) {
        Activator.getDefault().log("VM is not a v2 installation : " + vm.getName());
        return new CompatibleEnvironment[0];
    }
    IVMInstall2 vm2 = (IVMInstall2) vm;

    String javaVersion = vm2.getJavaVersion();
    if (javaVersion == null) {
        Activator.getDefault().log(
                "VM does not report version string : " + vm.getName());
        return new CompatibleEnvironment[0];
    }

    // Select is a subset of SE runtimes that are 1.5 or above
    boolean perfectMatch = javaVersion.startsWith("Harmony-Select-6.0");
    if (perfectMatch || javaVersion.startsWith("1.7") || javaVersion.startsWith("1.6")) {

        IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
        IExecutionEnvironment env = manager.getEnvironment("Harmony-Select-6.0");
        if (env != null) {
            CompatibleEnvironment[] result = new CompatibleEnvironment[1];
            // SE is not a perfect match
            result[0] = new CompatibleEnvironment(env, perfectMatch);
            return result;
        }
    }

    // We didn't match as a subset
    return new CompatibleEnvironment[0];
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:41,代码来源:ExecutionEnvironmentAnalyzer.java


示例18: fillInstalledJREs

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
private void fillInstalledJREs(ComboDialogField comboField) {
	String selectedItem= getLastSelectedJRE();
	int selectionIndex= -1;
	if (fUseProjectJRE.isSelected()) {
		selectionIndex= comboField.getSelectionIndex();
		if (selectionIndex != -1) {//paranoia
			selectedItem= comboField.getItems()[selectionIndex];
		}
	}

	fInstalledJVMs= getWorkspaceJREs();
	Arrays.sort(fInstalledJVMs, new Comparator<IVMInstall>() {

		public int compare(IVMInstall i0, IVMInstall i1) {
			if (i1 instanceof IVMInstall2 && i0 instanceof IVMInstall2) {
				String cc0= JavaModelUtil.getCompilerCompliance((IVMInstall2) i0, JavaCore.VERSION_1_4);
				String cc1= JavaModelUtil.getCompilerCompliance((IVMInstall2) i1, JavaCore.VERSION_1_4);
				int result= cc1.compareTo(cc0);
				if (result != 0)
					return result;
			}
			return Policy.getComparator().compare(i0.getName(), i1.getName());
		}

	});
	selectionIndex= -1;//find new index
	String[] jreLabels= new String[fInstalledJVMs.length];
	fJRECompliance= new String[fInstalledJVMs.length];
	for (int i= 0; i < fInstalledJVMs.length; i++) {
		jreLabels[i]= fInstalledJVMs[i].getName();
		if (selectedItem != null && jreLabels[i].equals(selectedItem)) {
			selectionIndex= i;
		}
		if (fInstalledJVMs[i] instanceof IVMInstall2) {
			fJRECompliance[i]= JavaModelUtil.getCompilerCompliance((IVMInstall2) fInstalledJVMs[i], JavaCore.VERSION_1_4);
		} else {
			fJRECompliance[i]= JavaCore.VERSION_1_4;
		}
	}
	comboField.setItems(jreLabels);
	if (selectionIndex == -1) {
		comboField.selectItem(getDefaultJVMName());
	} else {
		comboField.selectItem(selectedItem);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:47,代码来源:NewJavaProjectWizardPageOne.java


示例19: handlePossibleJVMChange

import org.eclipse.jdt.launching.IVMInstall2; //导入依赖的package包/类
public void handlePossibleJVMChange() {

			if (JavaRuntime.getDefaultVMInstall() == null) {
				fHintText.setText(NewWizardMessages.NewJavaProjectWizardPageOne_NoJREFound_link);
				fHintText.setVisible(true);
				fIcon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
				fIcon.setVisible(true);
				return;
			}

			String selectedCompliance= fJREGroup.getSelectedCompilerCompliance();
			if (selectedCompliance != null) {
				String defaultCompliance= JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE);
				if (selectedCompliance.equals(defaultCompliance)) {
					fHintText.setVisible(false);
					fIcon.setVisible(false);
				} else {
					fHintText.setText(Messages.format(NewWizardMessages.NewJavaProjectWizardPageOne_DetectGroup_differendWorkspaceCC_message, new String[] {  BasicElementLabels.getVersionName(defaultCompliance), BasicElementLabels.getVersionName(selectedCompliance)}));
					fHintText.setVisible(true);
					fIcon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_INFO));
					fIcon.setVisible(true);
				}
				return;
			}

			selectedCompliance= JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE);
			IVMInstall selectedJVM= fJREGroup.getSelectedJVM();
			if (selectedJVM == null) {
				selectedJVM= JavaRuntime.getDefaultVMInstall();
			}
			String jvmCompliance= JavaCore.VERSION_1_4;
			if (selectedJVM instanceof IVMInstall2) {
				jvmCompliance= JavaModelUtil.getCompilerCompliance((IVMInstall2) selectedJVM, JavaCore.VERSION_1_4);
			}
			if (!selectedCompliance.equals(jvmCompliance) && (JavaModelUtil.is50OrHigher(selectedCompliance) || JavaModelUtil.is50OrHigher(jvmCompliance))) {
				fHintText.setText(Messages.format(NewWizardMessages.NewJavaProjectWizardPageOne_DetectGroup_jre_message, new String[] {BasicElementLabels.getVersionName(selectedCompliance), BasicElementLabels.getVersionName(jvmCompliance)}));
				fHintText.setVisible(true);
				fIcon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
				fIcon.setVisible(true);
			} else {
				fHintText.setVisible(false);
				fIcon.setVisible(false);
			}

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractJClass类代码示例发布时间:2022-05-22
下一篇:
Java AutomationException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap