use of org.python.pydev.shared_core.global_feedback.GlobalFeedback.GlobalFeedbackReporter in project Pydev by fabioz.
the class AdditionalProjectInterpreterInfo method recreateAllInfo.
public static void recreateAllInfo(IPythonNature nature, IProgressMonitor monitor) {
try (GlobalFeedbackReporter r = GlobalFeedback.start("Full projects reindex...")) {
synchronized (additionalNatureInfoLock) {
// Note: at this point we're 100% certain that the ast manager is there.
ICodeCompletionASTManager astManager = nature.getAstManager();
if (astManager == null) {
return;
}
IModulesManager m = astManager.getModulesManager();
if (m == null) {
return;
}
IProject project = nature.getProject();
AbstractAdditionalDependencyInfo currInfo = AdditionalProjectInterpreterInfo.getAdditionalInfoForProject(nature);
if (currInfo != null) {
currInfo.clearAllInfo();
currInfo.dispose();
}
String feedback = "(project:" + project.getName() + ")";
synchronized (m) {
AbstractAdditionalDependencyInfo info = (AbstractAdditionalDependencyInfo) restoreInfoForModuleManager(monitor, m, feedback, new AdditionalProjectInterpreterInfo(project), nature, nature.getGrammarVersion());
if (info != null) {
// ok, set it and save it
additionalNatureInfo.put(FileUtilsFileBuffer.getValidProjectName(project), info);
info.save();
}
}
}
} catch (Exception e) {
Log.log(e);
throw new RuntimeException(e);
}
}
use of org.python.pydev.shared_core.global_feedback.GlobalFeedback.GlobalFeedbackReporter in project Pydev by fabioz.
the class AdditionalSystemInterpreterInfo method recreateAllInfo.
public static void recreateAllInfo(IInterpreterManager manager, String interpreter, IProgressMonitor monitor) {
synchronized (additionalSystemInfoLock) {
try (GlobalFeedbackReporter r = GlobalFeedback.start("Full system reindex...")) {
final IInterpreterInfo interpreterInfo = manager.getInterpreterInfo(interpreter, monitor);
int grammarVersion = interpreterInfo.getGrammarVersion();
AbstractAdditionalTokensInfo currInfo = AdditionalSystemInterpreterInfo.getAdditionalSystemInfo(manager, interpreter);
if (currInfo != null) {
currInfo.clearAllInfo();
}
InterpreterInfo defaultInterpreterInfo = (InterpreterInfo) manager.getInterpreterInfo(interpreter, monitor);
ISystemModulesManager m = defaultInterpreterInfo.getModulesManager();
AbstractAdditionalTokensInfo info = restoreInfoForModuleManager(monitor, m, "(system: " + manager.getManagerRelatedName() + " - " + interpreter + ")", new AdditionalSystemInterpreterInfo(manager, interpreter), null, grammarVersion);
if (info != null) {
// ok, set it and save it
additionalSystemInfo.put(new Tuple<String, String>(manager.getManagerRelatedName(), interpreter), info);
info.save();
}
} catch (Throwable e) {
Log.log(e);
}
}
}
use of org.python.pydev.shared_core.global_feedback.GlobalFeedback.GlobalFeedbackReporter in project Pydev by fabioz.
the class AdditionalProjectInterpreterInfo method getAdditionalInfoForProject.
/**
* @param project the project we want to get info on
* @return the additional info for a given project (gotten from the cache with its name)
* @throws MisconfigurationException
*/
public static AbstractAdditionalDependencyInfo getAdditionalInfoForProject(final IPythonNature nature) throws MisconfigurationException {
if (nature == null) {
return null;
}
IProject project = nature.getProject();
if (project == null) {
return null;
}
String name = FileUtilsFileBuffer.getValidProjectName(project);
synchronized (additionalNatureInfoLock) {
AbstractAdditionalDependencyInfo info = additionalNatureInfo.get(name);
if (info == null) {
info = new AdditionalProjectInterpreterInfo(project);
additionalNatureInfo.put(name, info);
if (!info.load()) {
recreateAllInfo(nature, new NullProgressMonitor());
} else {
final AbstractAdditionalDependencyInfo temp = info;
temp.setWaitForIntegrityCheck(true);
// Ok, after it's loaded the first time, check the index integrity!
Job j = new Job("Check index integrity for: " + project.getName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try (GlobalFeedbackReporter r = GlobalFeedback.start("Check index integrity...")) {
new InterpreterInfoBuilder().syncInfoToPythonPath(monitor, nature);
} catch (Exception e) {
Log.log(e);
} finally {
temp.setWaitForIntegrityCheck(false);
}
return Status.OK_STATUS;
}
};
j.setPriority(Job.INTERACTIVE);
j.setSystem(true);
j.schedule();
}
}
return info;
}
}
Aggregations