public void widgetSelected(SelectionEvent e) { setPath(JavaRuntime.newJREContainerPath(getEnvironment())); firePropertyChange(); } });
private boolean updateJRE(IJavaProject project, String compliance) throws CoreException, JavaModelException { IExecutionEnvironment bestEE= ClasspathVMUtil.findBestMatchingEE(compliance); if (bestEE != null) { IPath newPath= JavaRuntime.newJREContainerPath(bestEE); boolean classpathUpdated= ClasspathVMUtil.updateClasspath(newPath, project, new NullProgressMonitor()); return !classpathUpdated; } return true; }
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { if (argument == null) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, EnvironmentMessages.ExecutionEnvironmentVariableResolver_0)); } IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager(); IExecutionEnvironment env = manager.getEnvironment(argument); if (env == null) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, NLS.bind(EnvironmentMessages.ExecutionEnvironmentVariableResolver_1, new String[]{argument}))); } IPath path = JavaRuntime.newJREContainerPath(env); IVMInstall jre = JavaRuntime.getVMInstall(path); if (jre == null) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, NLS.bind(EnvironmentMessages.ExecutionEnvironmentVariableResolver_2, new String[]{argument}))); } return jre.getInstallLocation().getAbsolutePath(); }
@Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { if (argument == null) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, EnvironmentMessages.ExecutionEnvironmentVariableResolver_0)); } IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager(); IExecutionEnvironment env = manager.getEnvironment(argument); if (env == null) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, NLS.bind(EnvironmentMessages.ExecutionEnvironmentVariableResolver_1, new String[]{argument}))); } IPath path = JavaRuntime.newJREContainerPath(env); IVMInstall jre = JavaRuntime.getVMInstall(path); if (jre == null) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, NLS.bind(EnvironmentMessages.ExecutionEnvironmentVariableResolver_2, new String[]{argument}))); } return jre.getInstallLocation().getAbsolutePath(); }
public static void addJreClasspathEntry(IJavaProject javaProject, String bree) throws JavaModelException { IPath jreContainerPath = JavaRuntime.newJREContainerPath(StandardVMType.ID_STANDARD_VM_TYPE, bree); addToClasspath(javaProject, JavaCore.newContainerEntry(jreContainerPath)); }
public IPath getJREContainerPath() { if (fUseProjectJRE.isSelected()) { int index= fJRECombo.getSelectionIndex(); if (index >= 0 && index < fInstalledJVMs.length) { // paranoia return JavaRuntime.newJREContainerPath(fInstalledJVMs[index]); } } else if (fUseEEJRE.isSelected()) { int index= fEECombo.getSelectionIndex(); if (index >= 0 && index < fInstalledEEs.length) { // paranoia return JavaRuntime.newJREContainerPath(fInstalledEEs[index]); } } return null; }
public IPath getJREContainerPath() { if (fUseProjectJRE.isSelected()) { int index= fJRECombo.getSelectionIndex(); if (index >= 0 && index < fInstalledJVMs.length) { // paranoia return JavaRuntime.newJREContainerPath(fInstalledJVMs[index]); } } else if (fUseEEJRE.isSelected()) { int index= fEECombo.getSelectionIndex(); if (index >= 0 && index < fInstalledEEs.length) { // paranoia return JavaRuntime.newJREContainerPath(fInstalledEEs[index]); } } return null; }
public IPath getJREContainerPath() { if (fUseProjectJRE.isSelected()) { int index= fJRECombo.getSelectionIndex(); if (index >= 0 && index < fInstalledJVMs.length) { // paranoia return JavaRuntime.newJREContainerPath(fInstalledJVMs[index]); } } else if (fUseEEJRE.isSelected()) { int index= fEECombo.getSelectionIndex(); if (index >= 0 && index < fInstalledEEs.length) { // paranoia return JavaRuntime.newJREContainerPath(fInstalledEEs[index]); } } return null; }
private IPath getJrePathFromSourceSettings() { String targetVersion = JavaVersionUtil.adaptVersionToEclipseNamingConversions(this.sourceSettings.getTargetBytecodeVersion()); File vmLocation = this.sourceSettings.getJdk().getJavaHome(); IVMInstall vm = EclipseVmUtil.findOrRegisterStandardVM(targetVersion, vmLocation); Optional<IExecutionEnvironment> executionEnvironment = EclipseVmUtil.findExecutionEnvironment(targetVersion); return executionEnvironment.isPresent() ? JavaRuntime.newJREContainerPath(executionEnvironment.get()) : JavaRuntime.newJREContainerPath(vm); }
public IPath getJREContainerPath() { if (this.useProjectJRE.isSelected()) { final int index = this.jreCombo.getSelectionIndex(); if (index >= 0 && index < this.installedJVMs.length) { // paranoia return JavaRuntime.newJREContainerPath(this.installedJVMs[index]); } } else if (this.useEEJRE.isSelected()) { final int index = this.eeCombo.getSelectionIndex(); if (index >= 0 && index < this.installedEEs.length) { // paranoia return JavaRuntime.newJREContainerPath(this.installedEEs[index]); } } return null; }
public static String getVMInstallName(IExecutionEnvironment ee) throws CoreException { IPath containerPath = JavaRuntime.newJREContainerPath(ee); IVMInstall vmi = JavaRuntime.getVMInstall(containerPath); if (vmi == null) throw new CoreException(createErrorStatus(NLS.bind(UtilMessages.VMHelper_noJreForExecEnv, ee.getId()))); return vmi.getName(); }
private void setEE(IExecutionEnvironment ee) { IPath eePath = null; if (ee != null) eePath = JavaRuntime.newJREContainerPath(ee); getJVMLocations().setJREContainerPath(getOS(fLastTab), eePath); }
protected void selectJRE(String typeID, String vmName) { if (typeID == null) { fJREBlock.setPath(JavaRuntime.newDefaultJREContainerPath()); } else { fJREBlock.setPath(JavaRuntime.newJREContainerPath(typeID, vmName)); } }
/** * Returns a path for the JRE classpath container identifying the * specified VM install by type and name. * * @param vm VM install * @return classpath container path * @since 3.2 */ public static IPath newJREContainerPath(IVMInstall vm) { return newJREContainerPath(vm.getVMInstallType().getId(), vm.getName()); }
/** * Returns a path for the JRE classpath container identifying the * specified VM install by type and name. * * @param vm VM install * @return classpath container path * @since 3.2 */ public static IPath newJREContainerPath(IVMInstall vm) { return newJREContainerPath(vm.getVMInstallType().getId(), vm.getName()); }
/** * Returns the JRE container path for the execution environment with the given id. * @param ee execution environment id or <code>null</code> * @return JRE container path for the execution environment */ private static IPath getEEPath(String ee) { IPath path = null; if (ee != null) { IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager(); IExecutionEnvironment env = manager.getEnvironment(ee); if (env != null) path = JavaRuntime.newJREContainerPath(env); } if (path == null) { path = JavaRuntime.newDefaultJREContainerPath(); } return path; }
private boolean isEEOnClasspath(IExecutionEnvironment ee) throws JavaModelException { IPath eePath= JavaRuntime.newJREContainerPath(ee); for (IClasspathEntry entry: fProject.getRawClasspath()) { if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER && entry.getPath().equals(eePath)) return true; } return false; }
private boolean isEEOnClasspath(IExecutionEnvironment ee) throws JavaModelException { IPath eePath= JavaRuntime.newJREContainerPath(ee); for (IClasspathEntry entry: fProject.getRawClasspath()) { if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER && entry.getPath().equals(eePath)) return true; } return false; }
protected void saveJRESection(ILaunchConfigurationWorkingCopy config) { String javaCommand = fJavawButton.getSelection() ? null : "java"; //$NON-NLS-1$ config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JAVA_COMMAND, javaCommand); IPath jrePath = null; if (fJreButton.getSelection()) { if (fJreCombo.getSelectionIndex() != -1) { String jreName = fJreCombo.getText(); IVMInstall install = VMHelper.getVMInstall(jreName); // remove the name to make portable jrePath = JavaRuntime.newJREContainerPath(install); } } else { if (fEeCombo.getSelectionIndex() != -1) { IExecutionEnvironment environment = VMUtil.getExecutionEnvironment(parseEESelection(fEeCombo.getText())); if (environment != null) { jrePath = JavaRuntime.newJREContainerPath(environment); } } } String attr = null; if (jrePath != null) { attr = jrePath.toPortableString(); } config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, attr); }
@Override public String getText(Object element) { if (!(element instanceof IExecutionEnvironment)) return ""; //$NON-NLS-1$ IExecutionEnvironment env = (IExecutionEnvironment) element; IPath path = JavaRuntime.newJREContainerPath(env); IVMInstall install = JavaRuntime.getVMInstall(path); String eeItem; if (install != null) { eeItem = MessageFormat.format(PDEUIMessages.JRESection_eeBoundJRE, env.getId(), install.getName()); } else { eeItem = MessageFormat.format(PDEUIMessages.JRESection_eeUnboundJRE, env.getId()); } return eeItem; } }