1 11 package org.eclipse.jdt.launching; 12 13 14 15 36 public class VMStandin extends AbstractVMInstall { 37 38 42 private String fJavaVersion = null; 43 44 47 public VMStandin(IVMInstallType type, String id) { 48 super(type, id); 49 setNotify(false); 50 } 51 52 59 public VMStandin(IVMInstall sourceVM, String id) { 60 super(sourceVM.getVMInstallType(), id); 61 setNotify(false); 62 init(sourceVM); 63 } 64 65 72 public VMStandin(IVMInstall realVM) { 73 this (realVM.getVMInstallType(), realVM.getId()); 74 init(realVM); 75 } 76 77 83 private void init(IVMInstall realVM) { 84 setName(realVM.getName()); 85 setInstallLocation(realVM.getInstallLocation()); 86 setLibraryLocations(realVM.getLibraryLocations()); 87 setJavadocLocation(realVM.getJavadocLocation()); 88 if (realVM instanceof IVMInstall2) { 89 IVMInstall2 vm2 = (IVMInstall2) realVM; 90 setVMArgs(vm2.getVMArgs()); 91 fJavaVersion = vm2.getJavaVersion(); 92 } else { 93 setVMArguments(realVM.getVMArguments()); 94 fJavaVersion = null; 95 } 96 } 97 98 104 public IVMInstall convertToRealVM() { 105 IVMInstallType vmType= getVMInstallType(); 106 IVMInstall realVM= vmType.findVMInstall(getId()); 107 boolean notify = true; 108 109 if (realVM == null) { 110 realVM= vmType.createVMInstall(getId()); 111 notify = false; 112 } 113 if (realVM instanceof AbstractVMInstall) { 115 ((AbstractVMInstall)realVM).setNotify(notify); 116 } 117 realVM.setName(getName()); 118 realVM.setInstallLocation(getInstallLocation()); 119 realVM.setLibraryLocations(getLibraryLocations()); 120 realVM.setJavadocLocation(getJavadocLocation()); 121 if (realVM instanceof IVMInstall2) { 122 IVMInstall2 vm2 = (IVMInstall2) realVM; 123 vm2.setVMArgs(getVMArgs()); 124 } else { 125 realVM.setVMArguments(getVMArguments()); 126 } 127 128 if (realVM instanceof AbstractVMInstall) { 129 ((AbstractVMInstall)realVM).setNotify(true); 130 } 131 if (!notify) { 132 JavaRuntime.fireVMAdded(realVM); 133 } 134 return realVM; 135 } 136 137 140 public String getJavaVersion() { 141 return fJavaVersion; 142 } 143 } 144 | Popular Tags |