public Tuple<Collection<String>, IPythonNature> getPythonpathAndNature(IInterpreterInfo interpreter) {
if (this.interpreterManager != null) {
if (this.natures.size() == 1) {
//chosen for the editor
IPythonNature nature = this.natures.get(0);
return new Tuple<Collection<String>, IPythonNature>(new ArrayList<String>(nature.getPythonPathNature()
.getCompleteProjectPythonPath(interpreter, this.interpreterManager)), nature);
}
// collect all the python path (no duplicates, hence a set)
HashSet<String> pythonpath = new LinkedHashSet<String>();
// Add all the paths in the interpreter (note: it's important that this goes before the
// path for the other natures so that if we have something as IPython, the one used will
// be the one from the interpreter).
pythonpath.addAll(interpreter.getPythonPath());
//we need to get the natures matching the one selected in all the projects.
IWorkspace w = ResourcesPlugin.getWorkspace();
for (IProject p : w.getRoot().getProjects()) {
PythonNature nature = PythonNature.getPythonNature(p);
try {
if (nature != null) {
if (nature.getRelatedInterpreterManager() == this.interpreterManager) {
natures.add(nature);
List<String> completeProjectPythonPath = nature.getPythonPathNature()
.getCompleteProjectPythonPath(interpreter, this.interpreterManager);
if (completeProjectPythonPath != null) {
pythonpath.addAll(completeProjectPythonPath);
} else {
Log.logInfo("Unable to get pythonpath for project: " + nature.getProject()
+ " (initialization not finished).");
}
}
}
} catch (Exception e) {