/** * Make the name of a detected VM stand out. * @param vm the VM to generate a name for * @return the new name or <code>JRE</code> */ private static String generateDetectedVMName(IVMInstall vm) { String name = vm.getInstallLocation().getName(); name = name.trim(); if (name.length() == 0) { name = LaunchingMessages.JavaRuntime_25; } return name; }
IPath containerPath = new Path(JavaRuntime.JRE_CONTAINER); IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall(); IPath vmPath = containerPath .append(vmInstall.getVMInstallType().getId()) .append(vmInstall.getName()); IClasspathEntry jreEntry = JavaCore.newContainerEntry(vmPath);
/** * Construct a <code>VMStandin</code> instance based on the specified <code>IVMInstall</code>. * Changes to this stand-in will not be reflected in the 'real' VM until <code>convertToRealVM</code> * is called. * * @param realVM the 'real' VM from which to construct this stand-in VM */ public VMStandin(IVMInstall realVM) { this (realVM.getVMInstallType(), realVM.getId()); init(realVM); }
/** * @see ITableLabelProvider#getColumnText(Object, int) */ public String getColumnText(Object element, int columnIndex) { if (element instanceof IVMInstall) { IVMInstall vm= (IVMInstall)element; switch(columnIndex) { case 0: if (isContributed(vm)) { return MessageFormat.format(JREMessages.InstalledJREsBlock_19, new String[]{vm.getName()}); } return vm.getName(); case 1: return vm.getInstallLocation().getAbsolutePath(); case 2: return vm.getVMInstallType().getName(); } } return element.toString(); }
private void processVMInstallType(IVMInstallType installType, List<String> locations, List<String> labels) { if (installType != null) { IVMInstall[] installs= installType.getVMInstalls(); boolean isMac= Platform.OS_MACOSX.equals(Platform.getOS()); final String HOME_SUFFIX= "/Home"; //$NON-NLS-1$ for (int i= 0; i < installs.length; i++) { String label= getFormattedLabel(installs[i].getName()); LibraryLocation[] libLocations= installs[i].getLibraryLocations(); if (libLocations != null) { processLibraryLocation(libLocations, label); } else { String filePath= installs[i].getInstallLocation().getAbsolutePath(); // on MacOS X install locations end in an additional // "/Home" segment; remove it if (isMac && filePath.endsWith(HOME_SUFFIX)) filePath= filePath.substring(0, filePath.length() - HOME_SUFFIX.length() + 1); locations.add(filePath); labels.add(label); } } } }
element.setAttribute("id", vm.getId()); //$NON-NLS-1$ element.setAttribute("name", vm.getName()); //$NON-NLS-1$ File installLocation= vm.getInstallLocation(); if (installLocation != null) { installPath= installLocation.getAbsolutePath(); LibraryLocation[] libraryLocations= vm.getLibraryLocations(); if (libraryLocations != null) { Element libLocationElement = libraryLocationsAsElement(doc, libraryLocations); URL url = vm.getJavadocLocation(); if (url != null) { element.setAttribute("javadocURL", url.toExternalForm()); //$NON-NLS-1$ String[] vmArgs = vm.getVMArguments(); if (vmArgs != null && vmArgs.length > 0) { StringBuffer buffer = new StringBuffer();
/** * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) */ public String getText(Object element) { return ((IVMInstall)element).getName(); } }
LibraryLocation[] libs = vm.getLibraryLocations(); LibraryLocation[] defaultLibs = vm.getVMInstallType().getDefaultLibraryLocations(vm.getInstallLocation()); boolean overrideJavadoc = false; if (libs == null) { File vmInstallLocation= vm.getInstallLocation(); if (vmInstallLocation != null) { LibraryInfo libraryInfo= LaunchingPlugin.getLibraryInfo(vmInstallLocation.getAbsolutePath());
/** * Return the default VM set with <code>setDefaultVM()</code>. * @return Returns the default VM. May return <code>null</code> when no default * VM was set or when the default VM has been disposed. */ public static IVMInstall getDefaultVMInstall() { IVMInstall install= getVMFromCompositeId(getDefaultVMId()); if (install != null) { File location = install.getInstallLocation(); if (location != null) { if (location.exists()) { return install; } } } // if the default JRE goes missing, re-detect if (install != null) { install.getVMInstallType().disposeVMInstall(install.getId()); } synchronized (fgVMLock) { fgDefaultVMId = null; fgVMTypes = null; initializeVMs(); } return getVMFromCompositeId(getDefaultVMId()); }
URL[] javadocLocations; URL[] indexes; LibraryLocation[] locations= vm.getLibraryLocations(); if (locations == null) { URL defJavaDocLocation = vm.getJavadocLocation(); File installLocation = vm.getInstallLocation(); if (installLocation == null) { return new LibraryLocation[0]; LibraryLocation[] dflts= vm.getVMInstallType().getDefaultLibraryLocations(installLocation); libraryPaths = new IPath[dflts.length]; sourcePaths = new IPath[dflts.length];
/** * Returns the VM runner for the given launch mode to use when launching the * given configuration. * * @param configuration launch configuration * @param mode launch node * @return VM runner to use when launching the given configuration in the given mode * @throws CoreException if a VM runner cannot be determined * @since 3.1 */ public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException { IVMInstall vm = verifyVMInstall(configuration); IVMRunner runner = vm.getVMRunner(mode); if (runner == null) { abort(NLS.bind(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_0, new String[]{vm.getName(), mode}), null, IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST); } return runner; }
@Override public IVMInstall findVMInstall(String id) { synchronized (this) { for (int i = 0; i < fVMs.size(); i++) { IVMInstall vm = fVMs.get(i); if (vm.getId().equals(id)) { return vm; } } } return null; }
/** * Removes the VM from this container. * * @param vm VM install */ public void removeVM(IVMInstall vm) { fVMList.remove(vm); fInvalidVMList.remove(vm); List<IVMInstall> list = fVMTypeToVMMap.get(vm.getVMInstallType()); if (list != null) { list.remove(vm); } }
File javaHome = getVMInstall().getInstallLocation(); try { Boolean b = (Boolean) sdkMap.get(javaHome); IVMRunner vmRunner = getVMInstall().getVMRunner(ILaunchManager.RUN_MODE); VMRunnerConfiguration config = new VMRunnerConfiguration("org.eclipse.jst.server.tomcat.core.internal.ClassDetector", new String[] { file.getAbsolutePath() }); config.setProgramArguments(new String[] { "com.sun.tools.javac.Main" });
LibraryLocation[] libs = vm.getLibraryLocations(); boolean overrideJavaDoc = false; if (libs == null) {
public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException { IVMInstall launcher = VMHelper.createLauncher(configuration); return launcher.getVMRunner(mode); }
private void processVMInstallType(IVMInstallType installType, List locations, List labels) { if (installType != null) { IVMInstall[] installs= installType.getVMInstalls(); boolean isMac= Platform.OS_MACOSX.equals(Platform.getOS()); final String HOME_SUFFIX= "/Home"; //$NON-NLS-1$ for (int i= 0; i < installs.length; i++) { String label= getFormattedLabel(installs[i].getName()); LibraryLocation[] libLocations= installs[i].getLibraryLocations(); if (libLocations != null) { processLibraryLocation(libLocations, label); } else { String filePath= installs[i].getInstallLocation().getAbsolutePath(); // on MacOS X install locations end in an additional "/Home" segment; remove it if (isMac && filePath.endsWith(HOME_SUFFIX)) filePath= filePath.substring(0, filePath.length()- HOME_SUFFIX.length() + 1); locations.add(filePath); labels.add(label); } } } } private void processLibraryLocation(LibraryLocation[] libLocations, String label) {
element.setAttribute("id", vm.getId()); //$NON-NLS-1$ element.setAttribute("name", vm.getName()); //$NON-NLS-1$ File installLocation= vm.getInstallLocation(); if (installLocation != null) { installPath= installLocation.getAbsolutePath(); LibraryLocation[] libraryLocations= vm.getLibraryLocations(); if (libraryLocations != null) { Element libLocationElement = libraryLocationsAsElement(doc, libraryLocations); URL url = vm.getJavadocLocation(); if (url != null) { element.setAttribute("javadocURL", url.toExternalForm()); //$NON-NLS-1$ String[] vmArgs = vm.getVMArguments(); if (vmArgs != null && vmArgs.length > 0) { StringBuilder buffer = new StringBuilder();
LibraryLocation[] libs = vm.getLibraryLocations(); LibraryLocation[] defaultLibs = vm.getVMInstallType().getDefaultLibraryLocations(vm.getInstallLocation()); boolean overrideJavadoc = false; if (libs == null) { File vmInstallLocation= vm.getInstallLocation(); if (vmInstallLocation != null) { LibraryInfo libraryInfo= LaunchingPlugin.getLibraryInfo(vmInstallLocation.getAbsolutePath());