本文整理汇总了Java中org.eclipse.jdt.launching.IVMInstallType类的典型用法代码示例。如果您正苦于以下问题:Java IVMInstallType类的具体用法?Java IVMInstallType怎么用?Java IVMInstallType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IVMInstallType类属于org.eclipse.jdt.launching包,在下文中一共展示了IVMInstallType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAllVMs
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
/**
* This method will fetch and set All Available JVMs in Dropdown
*/
private void setAllVMs() {
final List<IVMInstall> allVMs = new ArrayList<>();
final IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
for (final IVMInstallType vmType : vmTypes) {
final IVMInstall[] vms = vmType.getVMInstalls();
for (final IVMInstall vm : vms) {
allVMs.add(vm);
}
}
this.jvmNamesAndValues = new String[allVMs.size()][2];
for (int i = 0; i < allVMs.size(); i++) {
this.jvmNamesAndValues[i][0] = allVMs.get(i).getName();
this.jvmNamesAndValues[i][1] = allVMs.get(i).getId();
}
}
示例2: getVMInstall
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
protected IVMInstall getVMInstall() {
IVMInstall vmInstall = null;
// Try using the very same VM the Toolbox is running with (e.g.
// this avoids problems when the Toolbox runs with a 64bit VM, but
// the nested VM is a 32bit one).
final String javaHome = System.getProperty("java.home");
if (javaHome != null) {
final IVMInstallType installType = new StandardVMType();
vmInstall = installType.createVMInstall("TLCModelCheckerNestedVM");
vmInstall.setInstallLocation(new File(javaHome));
return vmInstall;
}
// get OS default VM (determined by path) not necessarily the same
// the toolbox is running with.
return JavaRuntime.getDefaultVMInstall();
}
示例3: getVMInstall
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
public IVMInstall getVMInstall() {
if (getVMInstallTypeId() == null)
return JavaRuntime.getDefaultVMInstall();
try {
IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
int size = vmInstalls.length;
String id = getVMInstallId();
for (int i = 0; i < size; i++) {
if (id.equals(vmInstalls[i].getId()))
return vmInstalls[i];
}
}
catch (Exception e) {
// ignore
}
return null;
}
示例4: eclipseAndJvmSupportedJavaVersion
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
/** TopCoder supports java 1.8. */
private static String eclipseAndJvmSupportedJavaVersion() {
boolean jvm18Installed = false;
for(IVMInstallType vm : JavaRuntime.getVMInstallTypes()) {
for(IVMInstall inst : vm.getVMInstalls()) {
if(inst instanceof IVMInstall2) {
String jvmVersion = ((IVMInstall2) inst).getJavaVersion();
String[] jvmVersionParts = jvmVersion.split("\\.");
int major = Integer.parseInt(jvmVersionParts[0]);
int minor = Integer.parseInt(jvmVersionParts[1]);
if((major == 1 && minor >= 8) || major >=2) {
jvm18Installed = true;
}
}
}
}
Version jdtVersion = JavaCore.getJavaCore().getBundle().getVersion();
boolean jdtSupports18 = jdtVersion.getMajor() >= 4
|| (jdtVersion.getMajor() == 3 && jdtVersion.getMinor() >= 10)
|| (jdtVersion.getMajor() == 3 && jdtVersion.getMinor() >= 9 && jdtVersion.getMicro() >= 50);
return jvm18Installed && jdtSupports18 ? "1.8" : "1.7";
}
示例5: processVMInstallType
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
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);
}
}
}
}
示例6: findRequiredOrGreaterVMInstall
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
private IVMInstall findRequiredOrGreaterVMInstall() {
String bestMatchingCompliance= null;
IVMInstall bestMatchingVMInstall= null;
IVMInstallType[] installTypes= JavaRuntime.getVMInstallTypes();
for (int i= 0; i < installTypes.length; i++) {
IVMInstall[] installs= installTypes[i].getVMInstalls();
for (int k= 0; k < installs.length; k++) {
String vmInstallCompliance= getVMInstallCompliance(installs[k]);
if (fRequiredVersion.equals(vmInstallCompliance)) {
return installs[k]; // perfect match
} else if (JavaModelUtil.isVersionLessThan(vmInstallCompliance, fRequiredVersion)) {
continue; // no match
} else if (bestMatchingVMInstall != null) {
if (JavaModelUtil.isVersionLessThan(bestMatchingCompliance, vmInstallCompliance)) {
continue; // the other one is the least matching
}
}
bestMatchingCompliance= vmInstallCompliance;
bestMatchingVMInstall= installs[k];
}
}
return null;
}
示例7: processVMInstallType
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
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);
}
}
}
}
示例8: getVMInstall
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
public IVMInstall getVMInstall()
{
if (getVMInstallTypeId() == null)
return JavaRuntime.getDefaultVMInstall();
try
{
IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
int size = vmInstalls.length;
String id = getVMInstallId();
for (int i = 0; i < size; i++)
{
if (id.equals(vmInstalls[i].getId()))
return vmInstalls[i];
}
}
catch (Exception e)
{
JettyPlugin.log(e);
}
return null;
}
示例9: processVMInstallType
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
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);
}
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:23,代码来源:FilteredTypesSelectionDialog.java
示例10: getVMInstall
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
/**
*
* @return
*/
public IVMInstall getVMInstall() {
final IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
for (final IVMInstallType vmType : vmTypes) {
final IVMInstall[] vms = vmType.getVMInstalls();
for (final IVMInstall vm : vms) {
if (vm.getId().equals(WeblogicPlugin.getDefault().getJRE())) {
return vm;
}
}
}
return JavaRuntime.getDefaultVMInstall();
}
示例11: configureVM
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
public boolean configureVM() throws CoreException {
String javaHome = preferenceManager.getPreferences().getJavaHome();
if (javaHome != null) {
File jvmHome = new File(javaHome);
if (jvmHome.isDirectory()) {
IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
File location = defaultVM.getInstallLocation();
if (!location.equals(jvmHome)) {
IVMInstall vm = findVM(jvmHome);
if (vm == null) {
IVMInstallType installType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE);
long unique = System.currentTimeMillis();
while (installType.findVMInstall(String.valueOf(unique)) != null) {
unique++;
}
String vmId = String.valueOf(unique);
VMStandin vmStandin = new VMStandin(installType, vmId);
String name = StringUtils.defaultIfBlank(jvmHome.getName(), "JRE");
vmStandin.setName(name);
vmStandin.setInstallLocation(jvmHome);
vm = vmStandin.convertToRealVM();
}
JavaRuntime.setDefaultVMInstall(vm, new NullProgressMonitor());
JDTUtils.setCompatibleVMs(vm.getId());
return true;
}
}
}
return false;
}
示例12: findVM
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
private IVMInstall findVM(File jvmHome) {
IVMInstallType[] types = JavaRuntime.getVMInstallTypes();
for (IVMInstallType type : types) {
IVMInstall[] installs = type.getVMInstalls();
for (IVMInstall install : installs) {
if (jvmHome.equals(install.getInstallLocation())) {
return install;
}
}
}
return null;
}
示例13: testDefaultVM
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
@Test
public void testDefaultVM() throws CoreException {
String oldJavaHome = prefManager.getPreferences().getJavaHome();
IVMInstall oldVm = JavaRuntime.getDefaultVMInstall();
assertNotNull(oldVm);
try {
IVMInstall vm = null;
IVMInstallType type = JavaRuntime.getVMInstallType(TestVMType.VMTYPE_ID);
IVMInstall[] installs = type.getVMInstalls();
for (IVMInstall install : installs) {
if (!install.equals(oldVm)) {
vm = install;
break;
}
}
assertNotNull(vm);
assertNotEquals(vm, oldVm);
String javaHome = new File(TestVMType.getFakeJDKsLocation(), "9").getAbsolutePath();
prefManager.getPreferences().setJavaHome(javaHome);
boolean changed = server.configureVM();
IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
assertTrue("A VM hasn't been changed", changed);
assertEquals(vm, defaultVM);
assertNotEquals(oldVm, defaultVM);
} finally {
prefManager.getPreferences().setJavaHome(oldJavaHome);
TestVMType.setTestJREAsDefault();
}
}
示例14: setTestJREAsDefault
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
public static void setTestJREAsDefault() throws CoreException {
IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(VMTYPE_ID);
IVMInstall testVMInstall = vmInstallType.findVMInstall("1.8");
if (!testVMInstall.equals(JavaRuntime.getDefaultVMInstall())) {
// set the 1.8 test JRE as the new default JRE
JavaRuntime.setDefaultVMInstall(testVMInstall, new NullProgressMonitor());
}
JDTUtils.setCompatibleVMs(VMTYPE_ID);
}
示例15: runWithinEclipse
import org.eclipse.jdt.launching.IVMInstallType; //导入依赖的package包/类
@Override
protected void runWithinEclipse() throws Throwable {
IVMInstallType[] types = JavaRuntime.getVMInstallTypes();
for (IVMInstallType type : types) {
if ("org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType".equals(type.getId())) {
for (InstalledJre jreToAdd : host.installedJres) {
IVMInstall realVM = addInstalledJre(type, jreToAdd);
if (jreToAdd.isMarkDefault()) {
JavaRuntime.setDefaultVMInstall(realVM, new NullProgressMonitor());
}
linkWithExecutionEnvironments(realVM, jreToAdd);
}
}
}
}