use of org.eclipse.jdt.launching.IVMInstallType in project webtools.servertools by eclipse.
the class GenericRuntimeComposite method updateJREs.
protected void updateJREs() {
// get all installed JVMs
installedJREs = new ArrayList<IVMInstall>();
IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
for (IVMInstallType vit : vmInstallTypes) {
IVMInstall[] vmInstalls = vit.getVMInstalls();
for (IVMInstall vmInstall : vmInstalls) installedJREs.add(vmInstall);
}
// get names
int size = installedJREs.size();
jreNames = new String[size + 1];
jreNames[0] = Messages.runtimeTypeDefaultJRE;
for (int i = 0; i < size; i++) {
IVMInstall vmInstall = installedJREs.get(i);
jreNames[i + 1] = vmInstall.getName();
}
}
use of org.eclipse.jdt.launching.IVMInstallType in project webtools.servertools by eclipse.
the class JRESelectDecorator method updateJREs.
protected void updateJREs() {
installedJREs = new ArrayList();
IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
int size = vmInstallTypes.length;
for (int i = 0; i < size; i++) {
IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
int size2 = vmInstalls.length;
for (int j = 0; j < size2; j++) {
installedJREs.add(vmInstalls[j]);
}
}
size = installedJREs.size();
jreNames = new String[size + 1];
jreNames[0] = GenericServerUIMessages.defaultJRE;
for (int i = 0; i < size; i++) {
IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
jreNames[i + 1] = vmInstall.getName();
}
}
use of org.eclipse.jdt.launching.IVMInstallType in project tdi-studio-se by Talend.
the class Tools method searchJdkRootDirectory.
/**
* Searches the JDK root directory.
*
* @return The JDK root directory, or empty string if not found
*/
private String searchJdkRootDirectory() {
// search from the JREs that are specified on preference page
for (IVMInstallType type : JavaRuntime.getVMInstallTypes()) {
for (IVMInstall install : type.getVMInstalls()) {
String jdkRootDirectory = install.getInstallLocation().getPath();
if (null == validateJdkRootDirectory(jdkRootDirectory)) {
Activator.log(IStatus.INFO, NLS.bind(Messages.jdkRootDirectoryFoundMsg, jdkRootDirectory), new Exception());
return jdkRootDirectory;
}
}
}
// search at the same directory as current JRE
String javaHome = System.getProperty(JAVA_HOME_PROPERTY_KEY);
for (File directory : getPossibleJdkRootDirectory(javaHome)) {
String path = directory.getPath();
if (null == validateJdkRootDirectory(path)) {
Activator.log(IStatus.INFO, NLS.bind(Messages.jdkRootDirectoryFoundMsg, path), new Exception());
return path;
}
}
Activator.log(IStatus.WARNING, Messages.jdkRootDirectoryNotFoundMsg, new Exception());
//$NON-NLS-1$
return "";
}
use of org.eclipse.jdt.launching.IVMInstallType in project sling by apache.
the class DefaultJavaVMInstall method before.
@Override
protected void before() throws Throwable {
if (JavaRuntime.getDefaultVMInstall() != null) {
return;
}
String jreHome = System.getProperty("java.home");
File installLocation = new File(jreHome);
final IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE);
// find an unused VM id
String id = null;
do {
id = String.valueOf(System.currentTimeMillis());
} while (vmInstallType.findVMInstall(id) != null);
VMStandin newVm = new VMStandin(vmInstallType, id);
newVm.setName("Default-VM");
newVm.setInstallLocation(installLocation);
IVMInstall realVm = newVm.convertToRealVM();
JavaRuntime.setDefaultVMInstall(realVm, new NullProgressMonitor());
// wait for the default vm reconfiguration to settle
// TODO - find something to poll agains rather than sleeping blindly
Thread.sleep(5000);
}
use of org.eclipse.jdt.launching.IVMInstallType in project xtext-eclipse by eclipse.
the class JREContainerProvider method getConfiguredBREEs.
/**
* @return an {@link Iterable} of BREE that have a configured default VM<br>
* or have a strictly compatible installed JRE (aka "perfect match")
* @since 2.9
*/
public static Iterable<String> getConfiguredBREEs() {
final Set<IVMInstall> vms = Sets.newHashSet();
for (IVMInstallType vmType : JavaRuntime.getVMInstallTypes()) {
vms.addAll(Arrays.asList(vmType.getVMInstalls()));
}
Iterable<IExecutionEnvironment> supportedEEs = filter(Arrays.asList(JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments()), new Predicate<IExecutionEnvironment>() {
@Override
public boolean apply(final IExecutionEnvironment ee) {
return ee.getDefaultVM() != null || any(vms, new Predicate<IVMInstall>() {
@Override
public boolean apply(IVMInstall vm) {
return ee.isStrictlyCompatible(vm);
}
});
}
});
return transform(supportedEEs, new Function<IExecutionEnvironment, String>() {
@Override
public String apply(IExecutionEnvironment input) {
return input.getId();
}
});
}
Aggregations