Java Code Examples for org.eclipse.jdt.launching.IVMInstallType#getVMInstalls()
The following examples show how to use
org.eclipse.jdt.launching.IVMInstallType#getVMInstalls() .
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: GradleProjectImporterTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Test public void testJavaHome() throws Exception { Preferences prefs = JavaLanguageServerPlugin.getPreferencesManager().getPreferences(); String javaHomePreference = prefs.getJavaHome(); IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); try { IVMInstallType installType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE); IVMInstall[] vms = installType.getVMInstalls(); IVMInstall vm = vms[0]; JavaRuntime.setDefaultVMInstall(vm, new NullProgressMonitor()); String javaHome = new File(TestVMType.getFakeJDKsLocation(), "11").getAbsolutePath(); prefs.setJavaHome(javaHome); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath rootFolder = root.getLocation().append("/projects/gradle/simple-gradle"); BuildConfiguration build = GradleProjectImporter.getBuildConfiguration(rootFolder.toFile().toPath()); assertEquals(vm.getInstallLocation().getAbsolutePath(), build.getJavaHome().get().getAbsolutePath()); } finally { prefs.setJavaHome(javaHomePreference); if (defaultVM != null) { JavaRuntime.setDefaultVMInstall(defaultVM, new NullProgressMonitor()); } } }
Example 2
Source File: TypeInfoViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
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); } } } }
Example 3
Source File: FilteredTypesSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void processVMInstallType(IVMInstallType installType, List<IPath> locations, List<String> labels) { if (installType != null) { IVMInstall[] installs= installType.getVMInstalls(); boolean isMac= Platform.OS_MACOSX.equals(Platform.getOS()); 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 { IPath filePath= Path.fromOSString(installs[i].getInstallLocation().getAbsolutePath()); // On MacOS X, install locations end in an additional "/Home" segment; remove it. if (isMac && "Home".equals(filePath.lastSegment())) //$NON-NLS-1$ filePath= filePath.removeLastSegments(1); locations.add(filePath); labels.add(label); } } } }
Example 4
Source File: FilteredTypesSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
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); } } } }
Example 5
Source File: CheckJavaVersionPostStartupContribution.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void execute() { final List standins = new ArrayList(); final IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (int i = 0; i < types.length; i++) { final IVMInstallType type = types[i]; final IVMInstall[] installs = type.getVMInstalls(); for (int j = 0; j < installs.length; j++) { final IVMInstall install = installs[j]; standins.add(new VMStandin(install)); } } if (standins.isEmpty()) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (MessageDialog.openQuestion(Display.getDefault().getActiveShell(), Messages.jreNotFoundTitle, Messages.jreNotFoundMessage)) { final BonitaPreferenceDialog dialog = new BonitaPreferenceDialog(Display.getDefault().getActiveShell()); dialog.open(); } } }); } }
Example 6
Source File: JVMConfigurator.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public static IVMInstall findVM(File file, String name) { IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (IVMInstallType type : types) { IVMInstall[] installs = type.getVMInstalls(); for (IVMInstall install : installs) { if (name != null && name.equals(install.getName())) { return install; } if (file != null && file.equals(install.getInstallLocation())) { return install; } } } return null; }
Example 7
Source File: NewJavaProjectWizardPageOne.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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()]); }
Example 8
Source File: MainProjectWizardPage.java From sarl with Apache License 2.0 | 5 votes |
private IVMInstall[] getWorkspaceJREs() { final List<VMStandin> standins = new ArrayList<>(); final IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (int i = 0; i < types.length; i++) { final IVMInstallType type = types[i]; final IVMInstall[] installs = type.getVMInstalls(); for (int j = 0; j < installs.length; j++) { final IVMInstall install = installs[j]; standins.add(new VMStandin(install)); } } return standins.toArray(new IVMInstall[standins.size()]); }