info.modulesNotInMemory.add(key);
buffer.append(com.aptana.shared_core.string.StringUtils.format("ModulesKey %s exists in the disk but not in memory.\n", key));
}
if (!allAdditionalInfoTrackedModules.contains(key.name)) {
try {
AbstractModule mod = AbstractModule.createModule(key.name, key.file, info.nature, true);
if (!(mod instanceof SourceModule)) {
continue;
}
SourceModule module = (SourceModule) mod;
if (module == null || module.getAst() == null) {
buffer.append(com.aptana.shared_core.string.StringUtils.format(
"Warning: cannot parse: %s - %s (so, it's ok not having additional info on it)\n",
key.name, key.file));
} else {
try {
Iterator<ASTEntry> innerEntriesForAST = AbstractAdditionalDependencyInfo
.getInnerEntriesForAST(module.getAst()).o2;
if (innerEntriesForAST.hasNext()) {
info.allOk = false;
info.moduleNotInAdditionalInfo.add(module);
buffer.append(com.aptana.shared_core.string.StringUtils.format(
"The additional info index of the module: %s is not updated.\n", key.name));
}
} catch (Exception e) {
buffer.append(com.aptana.shared_core.string.StringUtils.format("Unexpected error happened on: %s - %s: %s\n", key.name,
key.file, e.getMessage()));
}
}
} catch (IOException e) {
//OK, it cannot be parsed, so, we cannot generate its info
buffer.append(com.aptana.shared_core.string.StringUtils.format(
"Warning: cannot parse: %s - %s (so, it's ok not having additional info on it)\n",
key.name, key.file));
}
}
}
if (info.allOk) {
buffer.append("All checks OK!\n");
} else {
if (fix) {
buffer.append("Fixing:\n");
//modules manager
buffer.append(com.aptana.shared_core.string.StringUtils.format("Removing modules from memory: %s\n", info.modulesNotInDisk));
info.modulesManager.removeModules(info.modulesNotInDisk);
buffer.append(com.aptana.shared_core.string.StringUtils.format("Adding to memory modules: %s\n", info.modulesNotInMemory));
for (ModulesKey key : info.modulesNotInMemory) {
buffer.append("Adding modules ...\n");
info.modulesManager.addModule(key);
}
//additional info
buffer.append(com.aptana.shared_core.string.StringUtils
.format("Removing from additional info: %s\n", info.additionalModulesNotInDisk));
for (String s : info.additionalModulesNotInDisk) {
info.additionalProjectInfo.removeInfoFromModule(s, true);
}
buffer.append(com.aptana.shared_core.string.StringUtils.format("Adding to additional info modules found in disk: %s\n",
info.moduleNotInAdditionalInfo));
for (SourceModule mod : info.moduleNotInAdditionalInfo) {
info.additionalProjectInfo.addAstInfo(mod.getAst(), mod.getModulesKey(), true);
}
}
}
}