use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlModule method getAllDependentModules.
@Override
public Set<ISourceUnit> getAllDependentModules() throws CoreException {
final Set<ISourceUnit> result = new HashSet<>();
final IErlProject project = modelUtilService.getProject(this);
for (final IErlModule module : project.getModules()) {
final Collection<IErlModule> allIncludedFiles = ErlangEngine.getInstance().getModelFindService().findAllIncludedFiles(module);
if (allIncludedFiles.contains(this)) {
result.add(module);
}
}
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlOtpExternalReferenceEntryList method buildStructure.
@Override
public boolean buildStructure(final IProgressMonitor pm) throws ErlModelException {
final IErlProject erlProject = ErlangEngine.getInstance().getModelUtilService().getProject(this);
final IOtpRpc backend = OtpRpcFactory.getOtpRpcForProject(erlProject);
if (backend != null) {
addExternalEntries(pm, backend);
}
return true;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlModel method findModuleFromProject.
@Override
public IErlModule findModuleFromProject(final IErlProject project, final String moduleName, final String modulePath, final boolean checkExternals, final IErlElementLocator.Scope scope) throws ErlModelException {
if (project != null) {
final IErlModule module = ErlModel.getModuleFromCacheByNameOrPath((ErlProject) project, moduleName, modulePath, scope);
if (module != null && module.isOnSourcePath()) {
return module;
}
}
final List<IErlModule> allModules = Lists.newArrayList();
final Set<String> paths = Sets.newHashSet();
try {
for (int i = 0; i < 2; ++i) {
final boolean externalModules = i > 0;
if (externalModules && !checkExternals) {
break;
}
if (project != null) {
final IErlModule module = tryFindModule(Sets.newHashSet(project), moduleName, modulePath, allModules, paths, externalModules);
if (module != null) {
return module;
}
}
if ((scope == Scope.REFERENCED_PROJECTS || scope == Scope.ALL_PROJECTS) && project != null) {
final Collection<IErlProject> projects = project.getReferencedProjects();
final IErlModule module = tryFindModule(projects, moduleName, modulePath, allModules, paths, externalModules);
if (module != null) {
return module;
}
}
if (scope == Scope.ALL_PROJECTS) {
final Collection<IErlProject> projects = getErlangProjects();
final IErlModule module = tryFindModule(projects, moduleName, modulePath, allModules, paths, externalModules);
if (module != null) {
return module;
}
}
}
return null;
} finally {
ErlModelCache.getDefault().putModules(allModules);
}
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlModel method getAllIncludes.
private Collection<IErlModule> getAllIncludes(final IErlProject project, final boolean checkExternals, final IErlElementLocator.Scope scope) throws ErlModelException {
final List<IErlProject> projects = Lists.newArrayList();
final List<IErlModule> result = Lists.newArrayList();
final Set<String> paths = Sets.newHashSet();
if (project != null) {
projects.add(project);
if (scope == IErlElementLocator.Scope.REFERENCED_PROJECTS) {
projects.addAll(project.getReferencedProjects());
}
}
if (scope == IErlElementLocator.Scope.ALL_PROJECTS) {
for (final IErlProject project2 : getErlangProjects()) {
if (!projects.contains(project2)) {
projects.add(project2);
}
}
}
for (final IErlProject project2 : projects) {
ErlModel.getAllModulesAux(project2.getIncludes(), result, paths);
}
if (checkExternals && project != null) {
ErlModel.getAllModulesAux(project.getExternalIncludes(), result, paths);
}
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlModelCache method removeProject.
public void removeProject(final IErlProject project) {
// ErlLogger.debug("removeForProject %s", project.getName());
final List<IErlModule> includes = projectIncludeCache.getIfPresent(project);
if (includes != null) {
for (final IErlModule module : includes) {
moduleIncludeCache.invalidate(module);
}
}
final List<IErlModule> modules = projectModuleCache.getIfPresent(project);
if (modules != null) {
for (final IErlModule module : modules) {
moduleIncludeCache.invalidate(module);
}
}
projectIncludeCache.invalidate(project);
projectModuleCache.invalidate(project);
final Set<String> keysToRemove = Sets.newHashSet();
final Set<Entry<String, Pair<IErlProject, List<ExternalTreeEntry>>>> entrySet = externalTreeCache.asMap().entrySet();
for (final Entry<String, Pair<IErlProject, List<ExternalTreeEntry>>> entry : entrySet) {
if (entry.getValue().getKey() == project) {
keysToRemove.add(entry.getKey());
}
}
for (final String keyToRemove : keysToRemove) {
externalTreeCache.invalidate(keyToRemove);
}
}
Aggregations