}
}
}
private void restorePythopathForNatures(IProgressMonitor monitor) {
IInterpreterInfo defaultInterpreterInfo;
try {
defaultInterpreterInfo = getDefaultInterpreterInfo(false);
} catch (NotConfiguredInterpreterException e1) {
defaultInterpreterInfo = null; //go on as usual... (the natures must know that they're not bound to an interpreter anymore).
}
FastStringBuffer buf = new FastStringBuffer();
//Also notify that all the natures had the pythonpath changed (it's the system pythonpath, but still,
//clients need to know about it)
List<IPythonNature> pythonNatures;
try {
pythonNatures = PythonNature.getAllPythonNatures();
} catch (IllegalStateException e1) {
//java.lang.IllegalStateException: Workspace is closed.
// at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:367)
return;
}
for (IPythonNature nature : pythonNatures) {
try {
//If they have the same type of the interpreter manager, notify.
if (this.getInterpreterType() == nature.getInterpreterType()) {
IPythonPathNature pythonPathNature = nature.getPythonPathNature();
//There's a catch here: if the nature uses some variable defined in the string substitution
//from the interpreter info, we need to do a full build instead of only making a notification.
String complete = pythonPathNature.getProjectExternalSourcePath(false)
+ pythonPathNature.getProjectSourcePath(false);
PythonNature n = (PythonNature) nature;
String projectInterpreterName = n.getProjectInterpreterName();
IInterpreterInfo info;
if (IPythonNature.DEFAULT_INTERPRETER.equals(projectInterpreterName)) {
//if it's the default, let's translate it to the outside world
info = defaultInterpreterInfo;
} else {
synchronized (lock) {
info = exeToInfo.get(projectInterpreterName);
}
}
boolean makeCompleteRebuild = false;
if (info != null) {
Properties stringSubstitutionVariables = info.getStringSubstitutionVariables();
if (stringSubstitutionVariables != null) {
Enumeration<Object> keys = stringSubstitutionVariables.keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
buf.clear();