try {
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
final JobProgressComunicator jobProgressComunicator = new JobProgressComunicator(monitor,
"Rebuilding modules", IProgressMonitor.UNKNOWN, this);
final PythonNature nature = PythonNature.this;
try {
ICodeCompletionASTManager tempAstManager = astManager;
if (tempAstManager == null) {
tempAstManager = new ASTManager();
}
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
synchronized (tempAstManager.getLock()) {
astManager = tempAstManager;
tempAstManager.setProject(getProject(), nature, false); //it is a new manager, so, remove all deltas
//begins task automatically
tempAstManager.changePythonPath(paths, project, jobProgressComunicator);
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
saveAstManager();
List<IInterpreterObserver> participants = ExtensionHelper
.getParticipants(ExtensionHelper.PYDEV_INTERPRETER_OBSERVER);
for (IInterpreterObserver observer : participants) {
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
try {
observer.notifyProjectPythonpathRestored(nature, jobProgressComunicator);
} catch (Exception e) {
//let's keep it safe
Log.log(e);
}
}
}
} catch (Throwable e) {
Log.log(e);
}
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
PythonNatureListenersManager.notifyPythonPathRebuilt(project, nature);
//end task
jobProgressComunicator.done();
} catch (Exception e) {
Log.log(e);
}
return Status.OK_STATUS;
}