private void checkRutaInterpreter() throws IOException, CoreException {
// TODO move this method... it is called way too early when eclipse starts
IEnvironment localEnv = LocalEnvironment.getInstance();
DefaultInterpreterEntry defaultInterpreterEntry = new DefaultInterpreterEntry(
RutaNature.NATURE_ID, localEnv.getId());
IInterpreterInstall defaultInterpreterInstall = null;
try {
defaultInterpreterInstall = ScriptRuntime
.getDefaultInterpreterInstall(defaultInterpreterEntry);
} catch (Exception e) {
error(e);
}
if(defaultInterpreterInstall == null) {
// initialized too early
return;
}
IFileHandle rawInstallLocation = defaultInterpreterInstall.getRawInstallLocation();
if (!rawInstallLocation.exists()) {
String pluginIdToJarPath = pluginIdToJarPath(RutaIdeUIPlugin.PLUGIN_ID);
FileAsFileHandle fh = new FileAsFileHandle(new File(pluginIdToJarPath));
defaultInterpreterInstall.setInstallLocation(fh);
ScriptRuntime.setDefaultInterpreterInstall(defaultInterpreterInstall,
new NullProgressMonitor());
}
}