use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlModule method getImports.
@Override
public Collection<IErlImport> getImports() {
final List<IErlImport> result = new ArrayList<>();
synchronized (getModelLock()) {
for (final IErlElement e : internalGetChildren()) {
if (e instanceof IErlImport) {
final IErlImport ei = (IErlImport) e;
result.add(ei);
}
}
}
return result;
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlProject method addOtpExternals.
private void addOtpExternals(final List<IErlElement> children) {
final String name = "OTP " + getRuntimeVersion().toString();
IErlElement external = getChildNamed(name);
if (external == null) {
external = new ErlOtpExternalReferenceEntryList(this, name);
}
children.add(external);
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlProject method getModulesOrIncludes.
private static List<IErlModule> getModulesOrIncludes(final IProject project, final IErlElementLocator model, final Collection<IPath> dirs, final boolean getModules) throws ErlModelException {
final List<IErlModule> result = Lists.newArrayList();
for (final IPath dir : dirs) {
final IFolder folder = project.getFolder(dir);
final IErlElement element = model.findElement(folder, true);
if (element instanceof IErlFolder) {
final IErlFolder erlFolder = (IErlFolder) element;
erlFolder.open(null);
for (final IErlElement e : erlFolder.getChildrenOfKind(ErlElementKind.MODULE)) {
if (e instanceof IErlModule) {
final IErlModule m = (IErlModule) e;
final boolean isModule = SourceKind.nameToModuleKind(m.getName()) != SourceKind.HRL;
if (isModule == getModules) {
result.add(m);
}
}
}
}
}
return result;
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlProject method getExternalIncludes.
@Override
public Collection<IErlModule> getExternalIncludes() throws ErlModelException {
final List<IErlModule> result = Lists.newArrayList();
accept(new IErlElementVisitor() {
@Override
public boolean visit(final IErlElement element) throws ErlModelException {
final boolean isExternalOrProject = element.getKind() == ErlElementKind.EXTERNAL_ROOT || element.getKind() == ErlElementKind.EXTERNAL_APP || element.getKind() == ErlElementKind.EXTERNAL_FOLDER || element.getKind() == ErlElementKind.PROJECT;
if (element instanceof IErlModule) {
final IErlModule module = (IErlModule) element;
if (module.getSourceKind() == SourceKind.HRL && (module.getAncestorOfKind(ErlElementKind.PROJECT) == ErlProject.this || element.getKind() == ErlElementKind.EXTERNAL_APP || element.getKind() == ErlElementKind.EXTERNAL_FOLDER)) {
result.add(module);
}
return false;
} else if (isExternalOrProject && element instanceof IOpenable) {
final IOpenable openable = (IOpenable) element;
openable.open(null);
}
return isExternalOrProject;
}
}, EnumSet.noneOf(AcceptFlags.class), ErlElementKind.MODULE);
return result;
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class Openable method close.
@Override
public void close() throws ErlModelException {
for (final IErlElement child : getChildren()) {
if (child instanceof IOpenable) {
final IOpenable openable = (IOpenable) child;
if (openable.isOpen()) {
openable.close();
}
}
}
internalGetChildren().clear();
setStructureKnown(false);
}
Aggregations