use of org.erlide.engine.model.root.IErlExternalRoot in project erlide_eclipse by erlang.
the class ErlangExternalsContentProvider method hasChildren.
@Override
public boolean hasChildren(final Object element0) {
Object element = element0;
if (element instanceof IProject) {
final IProject project = (IProject) element;
if (project.isOpen()) {
element = ErlangEngine.getInstance().getModel().findProject(project);
}
}
if (element instanceof IErlModule) {
return erlangFileContentProvider.hasChildren(element);
}
if (element instanceof IParent) {
if (element instanceof IErlExternalRoot || element instanceof IErlProject || element instanceof IErlModel) {
// we know these have children
return true;
}
final Stopwatch clock = Stopwatch.createStarted();
if (element instanceof IOpenable) {
final IOpenable openable = (IOpenable) element;
try {
openable.open(null);
} catch (final ErlModelException e) {
}
}
final IParent parent = (IParent) element;
final boolean result = parent.hasChildrenOfKind(ErlElementKind.EXTERNAL_ROOT, ErlElementKind.EXTERNAL_APP, ErlElementKind.EXTERNAL_FOLDER, ErlElementKind.MODULE);
if (clock.elapsed(TimeUnit.MILLISECONDS) > 100) {
ErlLogger.debug("TIME open " + element.getClass() + " " + element + " " + clock.elapsed(TimeUnit.MILLISECONDS) + " ms");
}
return result;
}
return false;
}
use of org.erlide.engine.model.root.IErlExternalRoot in project erlide_eclipse by erlang.
the class ErlProject method addExternals.
private void addExternals(final List<IErlElement> children) {
final ErlangProjectProperties myProperties = getProperties();
final String externalIncludes = myProperties.getExternalIncludes();
final String externalModules = myProperties.getExternalModules();
final Collection<IPath> includeDirs = myProperties.getIncludeDirs();
final List<String> projectIncludes = Lists.newArrayList();
for (final IPath path : new PathResolver().resolvePaths(includeDirs)) {
if (path.isAbsolute() && !fProject.getLocation().isPrefixOf(path)) {
final Collection<String> includes = ErlangEngine.getInstance().getOpenService().getIncludesInDir(path.toPortableString());
if (includes != null) {
for (final String include : includes) {
projectIncludes.add(path.append(include).toPortableString());
}
}
}
}
if (!externalIncludes.isEmpty() || !externalModules.isEmpty() || !projectIncludes.isEmpty()) {
final IErlExternalRoot external = new ErlExternalReferenceEntryList(this, "Externals", externalIncludes, projectIncludes, externalModules);
children.add(external);
}
}
Aggregations