org.eclipse.jdt.launching.IVMInstall2 Java Examples

The following examples show how to use org.eclipse.jdt.launching.IVMInstall2. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaProjectSetupUtil.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public static void makeJava7Default() {
	if (!isJava7Default) {
		IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
		IExecutionEnvironment[] environments = manager.getExecutionEnvironments();
		for (int i = 0; i < environments.length; i++) {
			IExecutionEnvironment environment = environments[i];
			if (environment.getId().equals("JavaSE-1.6") && environment.getDefaultVM() == null) {
				IVMInstall[] compatibleVMs = environment.getCompatibleVMs();
				for (IVMInstall ivmInstall : compatibleVMs) {
					if (ivmInstall instanceof IVMInstall2) {
						IVMInstall2 install2 = (IVMInstall2) ivmInstall;
						if (install2.getJavaVersion().startsWith("1.7")) {
							environment.setDefaultVM(ivmInstall);
						}
					}
				}
			}
		}
		isJava7Default = true;
	}
}
 
Example #2
Source File: JavaProjectSetupUtil.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public static void makeJava7Default() {
	if (!isJava7Default) {
		IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
		IExecutionEnvironment[] environments = manager.getExecutionEnvironments();
		for (int i = 0; i < environments.length; i++) {
			IExecutionEnvironment environment = environments[i];
			if (environment.getId().equals("JavaSE-1.6") && environment.getDefaultVM() == null) {
				IVMInstall[] compatibleVMs = environment.getCompatibleVMs();
				for (IVMInstall ivmInstall : compatibleVMs) {
					if (ivmInstall instanceof IVMInstall2) {
						IVMInstall2 install2 = (IVMInstall2) ivmInstall;
						if (install2.getJavaVersion().startsWith("1.7")) {
							environment.setDefaultVM(ivmInstall);
						}
					}
				}
			}
		}
		isJava7Default = true;
	}
}
 
Example #3
Source File: JavaModelUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #4
Source File: JavaModelUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example #5
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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$
}
 
Example #6
Source File: SARLRuntimeEnvironmentTab.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Replies if the selected configuration has a valid version for
 * a SARL application.
 *
 * @param config the configuration.
 * @return <code>true</code> if the JRE is compatible with SARL.
 */
protected boolean isValidJREVersion(ILaunchConfiguration config) {
	final IVMInstall install = this.fJREBlock.getJRE();
	if (install instanceof IVMInstall2) {
		final String version = ((IVMInstall2) install).getJavaVersion();
		if (version == null) {
			setErrorMessage(MessageFormat.format(
					Messages.RuntimeEnvironmentTab_3, install.getName()));
			return false;
		}
		if (!Utils.isCompatibleJDKVersionWhenInSARLProjectClasspath(version)) {
			setErrorMessage(MessageFormat.format(
					Messages.RuntimeEnvironmentTab_4,
					install.getName(),
					version,
					SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH,
					SARLVersion.INCOMPATIBLE_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH));
			return false;
		}
	}
	return true;
}
 
Example #7
Source File: StandardScriptVMRunner.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #8
Source File: StandardScriptVMRunner.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
	}

}
 
Example #9
Source File: MainProjectWizardPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
private String getDefaultEEName() {
	final IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();

	final IExecutionEnvironment[] environments = JavaRuntime.getExecutionEnvironmentsManager()
			.getExecutionEnvironments();
	if (defaultVM != null) {
		for (int i = 0; i < environments.length; i++) {
			final IVMInstall eeDefaultVM = environments[i].getDefaultVM();
			if (eeDefaultVM != null && defaultVM.getId().equals(eeDefaultVM.getId())) {
				return environments[i].getId();
			}
		}
	}

	final String defaultCC;
	if (defaultVM instanceof IVMInstall2) {
		defaultCC = JavaModelUtil.getCompilerCompliance((IVMInstall2) defaultVM, SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH);
	} else {
		defaultCC = SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH;
	}

	for (int i = 0; i < environments.length; i++) {
		final String eeCompliance = JavaModelUtil.getExecutionEnvironmentCompliance(environments[i]);
		if (defaultCC.endsWith(eeCompliance)) {
			return environments[i].getId();
		}
	}

	return SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH;
}
 
Example #10
Source File: ComplianceConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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()));
	}
}
 
Example #11
Source File: ComplianceConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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();
		}
	}
 
Example #12
Source File: ReorgCorrectionsSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #13
Source File: ReorgCorrectionsSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: PasteAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private String getVMVersion(IVMInstall vm) {
	if (vm instanceof IVMInstall2) {
		IVMInstall2 vm2= (IVMInstall2) vm;
		return JavaModelUtil.getCompilerCompliance(vm2, null);
	} else {
		return null;
	}
}
 
Example #15
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
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);
			}

		}
 
Example #16
Source File: MainProjectWizardPage.java    From sarl with Apache License 2.0 4 votes vote down vote up
private void fillInstalledJREs(ComboDialogField comboField) {
	String selectedItem = getLastSelectedJRE();
	int selectionIndex = comboField.getSelectionIndex();
	if (this.useProjectJRE.isSelected()) {
		if (selectionIndex != -1) {
			// paranoia
			selectedItem = comboField.getItems()[selectionIndex];
		}
	}

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

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

	});
	// find new index
	selectionIndex = -1;
	final String[] jreLabels = new String[this.installedJVMs.length];
	this.jreCompliance = new String[this.installedJVMs.length];
	for (int i = 0; i < this.installedJVMs.length; i++) {
		jreLabels[i] = this.installedJVMs[i].getName();
		if (selectedItem != null && jreLabels[i].equals(selectedItem)) {
			selectionIndex = i;
		}
		if (this.installedJVMs[i] instanceof IVMInstall2) {
			this.jreCompliance[i] = JavaModelUtil.getCompilerCompliance(
					(IVMInstall2) this.installedJVMs[i],
					SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH);
		} else {
			this.jreCompliance[i] = SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH;
		}
	}
	comboField.setItems(jreLabels);
	if (selectionIndex == -1) {
		comboField.selectItem(getDefaultJVMName());
	} else {
		comboField.selectItem(selectedItem);
	}
}
 
Example #17
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
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);
	}
}
 
Example #18
Source File: MainProjectWizardPage.java    From sarl with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("synthetic-access")
public void handlePossibleJVMChange() {

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

	String selectedCompliance = MainProjectWizardPage.this.jreGroup.getSelectedCompilerCompliance();
	if (selectedCompliance != null) {
		final String defaultCompliance = JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE);
		if (selectedCompliance.equals(defaultCompliance)) {
			this.fHintText.setVisible(false);
			this.icon.setVisible(false);
		} else {
			this.fHintText.setText(MessageFormat.format(
					NewWizardMessages.NewJavaProjectWizardPageOne_DetectGroup_differendWorkspaceCC_message,
					TextProcessor.process(defaultCompliance),
					TextProcessor.process(selectedCompliance)));
			this.fHintText.setVisible(true);
			this.icon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_INFO));
			this.icon.setVisible(true);
		}
		return;
	}

	selectedCompliance = JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE);
	IVMInstall selectedJVM = MainProjectWizardPage.this.jreGroup.getSelectedJVM();
	if (selectedJVM == null) {
		selectedJVM = JavaRuntime.getDefaultVMInstall();
	}
	String jvmCompliance = SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH;
	if (selectedJVM instanceof IVMInstall2) {
		jvmCompliance = JavaModelUtil.getCompilerCompliance((IVMInstall2) selectedJVM,
				SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH);
	}
	if (!selectedCompliance.equals(jvmCompliance)
			&& (JavaModelUtil.is50OrHigher(selectedCompliance)
			|| JavaModelUtil.is50OrHigher(jvmCompliance))) {
		this.fHintText.setText(MessageFormat.format(
				NewWizardMessages.NewJavaProjectWizardPageOne_DetectGroup_jre_message,
				TextProcessor.process(selectedCompliance),
				TextProcessor.process(jvmCompliance)));
		this.fHintText.setVisible(true);
		this.icon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
		this.icon.setVisible(true);
	} else {
		this.fHintText.setVisible(false);
		this.icon.setVisible(false);
	}

}
 
Example #19
Source File: StandardDeployCommandHandler.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
private String describeVm(IVMInstall vmInstall) {
  if (vmInstall instanceof IVMInstall2) {
    return vmInstall.getName() + " (" + ((IVMInstall2) vmInstall).getJavaVersion() + ")";
  }
  return vmInstall.getName();
}