use of org.erlide.engine.model.root.IErlProject 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.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlModel method getErlangProjects.
/**
* @see IErlModel
*/
@Override
public Collection<IErlProject> getErlangProjects() throws ErlModelException {
final Collection<IErlElement> list = getChildrenOfKind(ErlElementKind.PROJECT);
final Collection<IErlProject> result = Lists.newArrayList();
for (final IErlElement e : list) {
result.add((IErlProject) e);
}
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ModelFindUtil method findAllIncludedFiles.
public Collection<IErlModule> findAllIncludedFiles(final IErlModule module, final List<IErlModule> checked) throws CoreException {
final Collection<IErlModule> result = Sets.newHashSet();
if (checked.contains(module)) {
return result;
}
checked.add(module);
final List<IErlModule> includedFilesForModule = ErlModelCache.getDefault().getIncludedFilesForModule(module);
if (includedFilesForModule != null && !includedFilesForModule.isEmpty()) {
return includedFilesForModule;
}
final Collection<ErlangIncludeFile> includedFiles = module.getIncludeFiles();
final IErlProject project = modelUtilService.getProject(module);
if (project == null) {
return result;
}
final Collection<IErlModule> includes = project.getIncludes();
includes.addAll(getLocalIncludes(module));
Collection<IErlModule> externalIncludes = null;
Collection<IErlModule> referencedIncludes = null;
Collection<IErlModule> modules = null;
for (final ErlangIncludeFile includeFile : includedFiles) {
final String includeFileName = includeFile.getFilenameLastPart();
if (findAllIncludedFilesAux(checked, result, includes, includeFileName)) {
continue;
}
if (referencedIncludes == null) {
referencedIncludes = Lists.newArrayList();
final Collection<IErlProject> referencedProjects = project.getReferencedProjects();
for (final IErlProject referencedProject : referencedProjects) {
referencedIncludes.addAll(referencedProject.getIncludes());
}
}
if (findAllIncludedFilesAux(checked, result, referencedIncludes, includeFileName)) {
continue;
}
if (externalIncludes == null) {
externalIncludes = project.getExternalIncludes();
}
if (findAllIncludedFilesAux(checked, result, externalIncludes, includeFileName)) {
continue;
}
if (modules == null) {
modules = project.getModules();
}
findAllIncludedFilesAux(checked, result, modules, includeFileName);
}
ErlModelCache.getDefault().putIncludedFilesForModule(module, result);
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ModelFindUtil method findExternalIncludeInOpenProjects.
public static IErlModule findExternalIncludeInOpenProjects(final IErlModule externalInclude) throws CoreException {
final String filePath = externalInclude.getFilePath();
final Collection<IErlProject> projects = ErlangEngine.getInstance().getModel().getErlangProjects();
for (final IErlProject project : projects) {
final Collection<IErlModule> includes = project.getIncludes();
for (final IErlModule include : includes) {
if (include.getFilePath().equals(filePath)) {
return include;
}
}
}
return externalInclude;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ModelInternalUtils method findUnitsWithPrefix.
@Override
public List<String> findUnitsWithPrefix(final String prefix, final IErlProject project, final boolean checkExternals, final boolean includes) throws ErlModelException {
final List<String> result = Lists.newArrayList();
final Collection<IErlModule> units = getUnits(project, checkExternals, includes);
addUnitNamesWithPrefix(prefix, result, units, false, includes);
if (project != null) {
for (final IErlProject p : project.getReferencedProjects()) {
if (p != null) {
p.open(null);
addUnitNamesWithPrefix(prefix, result, getUnits(p, checkExternals, includes), false, includes);
}
}
if (checkExternals) {
final Collection<IErlModule> externalUnits = includes ? project.getExternalIncludes() : project.getExternalModules();
addUnitNamesWithPrefix(prefix, result, externalUnits, true, includes);
}
}
return result;
}
Aggregations