use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class SearchCoreUtil method getProjectsScope.
public static ErlSearchScope getProjectsScope(final Collection<IProject> projects, final boolean addExternals, final boolean addOtp) throws CoreException {
final ErlSearchScope result = new ErlSearchScope();
final Set<String> externalModulePaths = new HashSet<>();
final IErlModel model = ErlangEngine.getInstance().getModel();
for (final IProject project : projects) {
SearchCoreUtil.addProjectToScope(project, result);
if (NatureUtil.hasErlangNature(project)) {
final IErlProject erlProject = model.getErlangProject(project);
SearchCoreUtil.addExternalModules(erlProject, result, externalModulePaths, addExternals, addOtp);
}
}
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class DialyzerUtils method collectFilesAndIncludeDirs.
public static void collectFilesAndIncludeDirs(final Set<IErlModule> modules, final Set<IErlProject> projects, final Collection<String> files, final Collection<String> names, final Collection<IPath> includeDirs, final boolean fromSource) {
for (final IErlModule m : modules) {
final String name = m.getName();
final IErlProject erlProject = ErlangEngine.getInstance().getModelUtilService().getProject(m);
final IProject project = erlProject.getWorkspaceProject();
final IFolder ebin = project.getFolder(erlProject.getProperties().getOutputDir());
if (SourceKind.hasErlExtension(name)) {
if (fromSource) {
final IResource resource = m.getResource();
files.add(resource.getLocation().toPortableString());
} else {
final String moduleName = SystemConfiguration.withoutExtension(name);
final String beamName = moduleName + ".beam";
final IResource beam = ebin.findMember(beamName);
if (beam != null) {
files.add(beam.getLocation().toPortableString());
names.add(moduleName);
}
}
}
}
DialyzerUtils.helper = new BuilderHelper();
for (final IErlProject p : projects) {
includeDirs.addAll(DialyzerUtils.helper.getIncludeDirs(p.getWorkspaceProject()));
}
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlExternalReferenceEntry method buildStructure.
@Override
public boolean buildStructure(final IProgressMonitor pm) throws ErlModelException {
if (prebuilt) {
// already done
return true;
}
final IErlProject project = ErlangEngine.getInstance().getModelUtilService().getProject(this);
final IOtpRpc backend = OtpRpcFactory.getOtpRpcForProject(project);
if (backend != null) {
final List<String> files = ErlangEngine.getInstance().getOpenService().getLibFiles(path.toPortableString());
final List<IErlModule> children = Lists.newArrayListWithCapacity(files.size());
for (final String file : files) {
if (CommonUtils.isErlangFileContentFileName(getName(file))) {
children.add(new ErlModule(this, getName(file), file, null, null));
}
}
setChildren(children);
return true;
}
return false;
}
use of org.erlide.engine.model.root.IErlProject 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.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlModule method getDirectDependentModules.
@Override
public Set<ISourceUnit> getDirectDependentModules() throws ErlModelException {
final Set<ISourceUnit> result = new HashSet<>();
final IErlProject project = modelUtilService.getProject(this);
for (final IErlModule module : project.getModules()) {
final boolean wasOpen = module.isOpen();
if (!wasOpen) {
module.open(null);
}
final Collection<ErlangIncludeFile> incs = module.getIncludeFiles();
for (final ErlangIncludeFile inc : incs) {
if (inc.getFilename().equals(getName())) {
result.add(module);
break;
}
}
if (!wasOpen) {
module.close();
}
}
return result;
}
Aggregations