//the nature may still not be completely restored...
if (astManager != null) {
IModulesManager modulesManager = astManager.getModulesManager();
if (modulesManager instanceof IProjectModulesManager) {
IProjectModulesManager projectModulesManager = (IProjectModulesManager) modulesManager;
String moduleName = projectModulesManager.resolveModuleInDirectManager(file
.getActualObject());
if (moduleName != null) {
IModule module = projectModulesManager.getModuleInDirectManager(moduleName, nature,
true);
if (module == null) {
//ok, something strange happened... it shouldn't be null... maybe empty, but not null at this point
//so, if it exists, let's try to create it...
//TODO: This should be moved to somewhere else.
String resourceOSString = PydevPlugin.getIResourceOSString(file.getActualObject());
if (resourceOSString != null) {
File f = new File(resourceOSString);
if (f.exists()) {
projectModulesManager.addModule(new ModulesKey(moduleName, f));
module = projectModulesManager.getModuleInDirectManager(moduleName, nature,
true);
}
}
}
if (module instanceof SourceModule) {