file, envVars, libs, new NullProgressMonitor());
if (!status.isOK()){
throw new RuntimeException(status.getMessage());
}
IInterpreterInstall deflt =
ScriptRuntime.getDefaultInterpreterInstall(
new ScriptRuntime.DefaultInterpreterEntry(nature, env.getId()));
if (deflt != null && deflt.getInstallLocation().equals(file)){
throw new RuntimeException(
Services.getMessage("interpreter.already.exists", interpreterPath));
}
ArrayList<IInterpreterInstall> interpreters =
new ArrayList<IInterpreterInstall>();
IInterpreterInstallType[] types =
ScriptRuntime.getInterpreterInstallTypes(nature);
for (IInterpreterInstallType iit : types){
IInterpreterInstall[] installs = iit.getInterpreterInstalls();
for (IInterpreterInstall install : installs){
if (install.getInstallLocation().equals(file)){
throw new RuntimeException(
Services.getMessage("interpreter.already.exists", interpreterPath));
}
interpreters.add(install);
}
}
String name = commandLine.getValue(Options.NAME_OPTION);
if (name == null){
name = generateInterpreterName(file, nature);
}
String id = null;
do {
id = String.valueOf(System.currentTimeMillis());
} while (type.findInterpreterInstall(id) != null);
IInterpreterInstall install = new InterpreterStandin(type, id);
install.setInstallLocation(
new LazyFileHandle(env.getId(), new Path(interpreterPath)));
install.setName(name);
install.setLibraryLocations(libs);
install.setInterpreterArgs(null); // future use
install = ((InterpreterStandin)install).convertToRealInterpreter();
interpreters.add(install);
if(deflt == null){
deflt = install;