// ErlLogger.debug("ErlExternalReferenceEntryList.buildStructure %s",
// getName());
final IErlProject project = ErlangEngine.getInstance().getModelUtilService()
.getProject(this);
final ErlModelCache cache = ErlModelCache.getDefault();
List<ExternalTreeEntry> externalModuleTree = cache
.getExternalTree(externalModules);
List<ExternalTreeEntry> externalIncludeTree = cache
.getExternalTree(externalIncludes);
if (externalModuleTree == null || externalIncludeTree == null) {
final OtpErlangList pathVars = ErlangEngine.getInstance().getModel()
.getPathVars(project.getWorkspaceProject());
final IOtpRpc backend = OtpRpcFactory.getOtpRpcForProject(project);
if (externalModuleTree == null && externalModules.length() > 0) {
if (pm != null) {
pm.worked(1);
}
externalModuleTree = ErlangEngine.getInstance()
.getService(OpenService.class)
.getExternalModuleTree(backend, externalModules, pathVars);
}
if (externalIncludeTree == null && externalIncludes.length() > 0) {
if (pm != null) {
pm.worked(1);
}
externalIncludeTree = ErlangEngine.getInstance()
.getService(OpenService.class)
.getExternalModuleTree(backend, externalIncludes, pathVars);
}
}
setChildren(null);
final IErlModel model = ErlangEngine.getInstance().getModel();
if (externalModuleTree != null && !externalModuleTree.isEmpty()) {
addExternalEntries(pm, externalModuleTree, model, "modules", null, false);
cache.putExternalTree(externalModules, project, externalModuleTree);
}
if (externalIncludeTree != null && !externalIncludeTree.isEmpty()
|| !projectIncludes.isEmpty()) {
addExternalEntries(pm, externalIncludeTree, model, "includes",
projectIncludes, true);
if (externalIncludeTree != null) {
cache.putExternalTree(externalIncludes, project, externalIncludeTree);
}
}
return true;
}