use of org.erlide.engine.internal.model.cache.ErlModelCache in project erlide_eclipse by erlang.
the class ErlProject method getModulesAndIncludes.
@Override
public Collection<IErlModule> getModulesAndIncludes() throws ErlModelException {
final List<IErlModule> result = new ArrayList<>();
final ErlModelCache erlModelCache = ErlModelCache.getDefault();
final List<IErlModule> modulesForProject = erlModelCache.getModulesForProject(this);
final List<IErlModule> includesForProject = erlModelCache.getIncludesForProject(this);
if (modulesForProject != null && includesForProject != null) {
result.addAll(modulesForProject);
result.addAll(includesForProject);
} else {
final List<IErlModule> cached = erlModelCache.getModulesForProject(this);
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
if (cached == null) {
final List<IErlModule> modules = ErlProject.getModulesOrIncludes(fProject, model, getProperties().getSourceDirs(), true);
result.addAll(modules);
} else {
result.addAll(cached);
}
final Collection<IErlModule> includes = getIncludes();
result.addAll(includes);
}
return result;
}
use of org.erlide.engine.internal.model.cache.ErlModelCache in project erlide_eclipse by erlang.
the class ErlModel method createErlangProject.
private IErlProject createErlangProject(final IProject project) {
final IErlProject ep = new ErlProject(project, this);
addChild(ep);
final ErlModelCache cache = getModelCache();
cache.newProjectCreated();
return ep;
}
use of org.erlide.engine.internal.model.cache.ErlModelCache in project erlide_eclipse by erlang.
the class ErlExternalReferenceEntryList method buildStructure.
@Override
public boolean buildStructure(final IProgressMonitor pm) throws ErlModelException {
// TODO some code duplication within this function
// 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();
final IOtpRpc backend = OtpRpcFactory.getOtpRpcForProject(project);
if (externalModuleTree == null && !externalModules.isEmpty()) {
if (pm != null) {
pm.worked(1);
}
externalModuleTree = ErlangEngine.getInstance().getOpenService().getExternalModuleTree(backend, externalModules, pathVars);
}
if (externalIncludeTree == null && !externalIncludes.isEmpty()) {
if (pm != null) {
pm.worked(1);
}
externalIncludeTree = ErlangEngine.getInstance().getOpenService().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;
}
use of org.erlide.engine.internal.model.cache.ErlModelCache in project erlide_eclipse by erlang.
the class ErlProject method getIncludes.
@Override
public Collection<IErlModule> getIncludes() throws ErlModelException {
final ErlModelCache erlModelCache = ErlModelCache.getDefault();
final List<IErlModule> cached = erlModelCache.getIncludesForProject(this);
if (cached != null) {
return cached;
}
final List<IErlModule> includes = ErlProject.getModulesOrIncludes(fProject, ErlangEngine.getInstance().getModel(), getProperties().getIncludeDirs(), false);
erlModelCache.putIncludesForProject(this, includes);
return includes;
}
Aggregations