use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ModelInternalUtils method getElementWithExternalName.
private IErlExternal getElementWithExternalName(final IParent parent, final String name) throws ErlModelException {
System.out.println(" ?? " + name);
for (final IErlElement e : parent.getChildrenOfKind(ErlElementKind.EXTERNAL_ROOT, ErlElementKind.EXTERNAL_APP, ErlElementKind.EXTERNAL_FOLDER)) {
final IErlExternal external = (IErlExternal) e;
final String externalName = external.getName();
System.out.println(" ? " + externalName);
if (externalName.equals(name)) {
return external;
}
}
return null;
}
use of org.erlide.engine.model.IErlElement 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.IErlElement in project erlide_eclipse by erlang.
the class ErlElement method toStringChildren.
/**
* Debugging purposes
*/
protected void toStringChildren(final int tab, final StringBuilder buffer, final Object info) {
if (!(info instanceof ErlElement)) {
return;
}
if (getChildCount() > 0) {
buffer.append("{");
int i = 0;
try {
for (final IErlElement element : getChildren()) {
((ErlElement) element).toString(tab + 1, buffer);
// $NON-NLS-1$
buffer.append(",");
if (++i > 3) {
buffer.append("...");
break;
}
}
} catch (final ErlModelException e) {
}
buffer.deleteCharAt(buffer.length() - 1);
buffer.append("}");
}
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlModel method getLibraries.
@Override
public Collection<IErlLibrary> getLibraries() throws ErlModelException {
final Collection<IErlElement> list = getChildrenOfKind(ErlElementKind.LIBRARY);
final Collection<IErlLibrary> result = Lists.newArrayList();
for (final IErlElement e : list) {
result.add((IErlLibrary) e);
}
return result;
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlangCompletionService method getRecordFieldCompletions.
List<CompletionData> getRecordFieldCompletions(final String recordName, final int offset, final String prefix, final int hashMarkPos, final List<String> fieldsSoFar) {
if (module == null) {
return ErlangCompletionService.EMPTY_COMPLETIONS;
}
IErlPreprocessorDef pd;
try {
pd = ErlangEngine.getInstance().getModelFindService().findPreprocessorDef(module, recordName, ErlElementKind.RECORD_DEF);
} catch (final CoreException e) {
return ErlangCompletionService.EMPTY_COMPLETIONS;
}
if (pd instanceof IErlRecordDef) {
final List<CompletionData> result = new ArrayList<>();
try {
for (final IErlElement i : pd.getChildren()) {
final IErlRecordField field = (IErlRecordField) i;
final String fieldName = field.getFieldName();
if (!fieldsSoFar.contains(fieldName)) {
addIfMatches(fieldName, prefix, offset, result);
}
}
} catch (final ErlModelException e) {
}
return result;
}
return ErlangCompletionService.EMPTY_COMPLETIONS;
}
Aggregations