use of org.erlide.engine.model.IParent in project erlide_eclipse by erlang.
the class ModelFindUtil method getLocalIncludes.
private Collection<IErlModule> getLocalIncludes(final IErlModule module) throws ErlModelException {
final List<IErlModule> result = Lists.newArrayList();
final IParent parent = module.getParent();
for (final IErlElement child : parent.getChildrenOfKind(ErlElementKind.MODULE)) {
if (child instanceof IErlModule && SourceKind.nameToModuleKind(child.getName()) == SourceKind.HRL) {
result.add((IErlModule) child);
}
}
return result;
}
use of org.erlide.engine.model.IParent in project erlide_eclipse by erlang.
the class ModelInternalUtils method getModuleFromExternalModulePath.
@Override
public IErlModule getModuleFromExternalModulePath(final IErlModel model, final String modulePath) throws ErlModelException {
System.out.println(">> modulePath=" + modulePath);
final List<String> path = Lists.newArrayList(Splitter.on(ModelInternalUtils.DELIMITER).split(modulePath));
model.open(null);
final IErlElement childNamed = model.getChildNamed(path.get(0));
if (childNamed instanceof IParent) {
IParent parent = (IParent) childNamed;
final int n = path.size() - 1;
for (int i = 1; ; i++) {
if (parent == null) {
break;
}
if (parent instanceof IOpenable) {
final IOpenable openable = (IOpenable) parent;
openable.open(null);
}
if (i == n) {
break;
}
parent = getElementWithExternalName(parent, path.get(i));
}
if (parent != null) {
final IErlElement child = parent.getChildNamed(path.get(n));
if (child instanceof IErlModule) {
return (IErlModule) child;
}
}
}
return null;
}
use of org.erlide.engine.model.IParent in project erlide_eclipse by erlang.
the class SourceRefElement method getOpenableParent.
/**
* Return the first instance of IOpenable in the hierarchy of this type
* (going up the hierarchy from this type);
*/
@Override
public IOpenable getOpenableParent() {
IParent parent = getParent();
while (parent != null) {
if (parent instanceof IOpenable) {
return (IOpenable) parent;
}
if (parent instanceof IErlElement) {
final IErlElement parentElement = (IErlElement) parent;
parent = parentElement.getParent();
} else {
break;
}
}
return null;
}
use of org.erlide.engine.model.IParent in project erlide_eclipse by erlang.
the class ErlElement method toStringAncestors.
/**
* Debugging purposes
*/
protected void toStringAncestors(final StringBuilder buffer) {
final IParent parent = getParent();
if (parent != null) {
if (parent instanceof ErlElement) {
final ErlElement parentElement = (ErlElement) parent;
// $NON-NLS-1$
buffer.append("[> ");
parentElement.toStringInfo(0, buffer, ErlElement.NO_INFO);
parentElement.toStringAncestors(buffer);
}
// $NON-NLS-1$
buffer.append("] ");
}
}
Aggregations