use of org.erlide.engine.model.root.IErlModule in project erlide_eclipse by erlang.
the class ErlProject method getExternalModules.
@Override
public Collection<IErlModule> getExternalModules() 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.getAncestorOfKind(ErlElementKind.PROJECT) == ErlProject.this) {
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.root.IErlModule in project erlide_eclipse by erlang.
the class ErlideTestUtils method createModuleFromText.
public static IErlModule createModuleFromText(final String initialText) {
final IErlModel model = ErlangEngine.getInstance().getModel();
final IErlModule module = model.getModuleFromText(model, "test1", initialText, null);
ErlideTestUtils.modulesAndIncludes.add(module);
return module;
}
use of org.erlide.engine.model.root.IErlModule in project erlide_eclipse by erlang.
the class ErlideTestUtils method createModule.
public static IErlModule createModule(final String moduleName, final String moduleContents, final IFolder folder) throws CoreException {
final IFile file = ErlideTestUtils.createFile(folder.getProject(), folder.getName() + "/" + moduleName, moduleContents);
final IErlModel model = ErlangEngine.getInstance().getModel();
IErlModule module = model.findModule(file);
if (module == null) {
final IPath path = file.getLocation();
module = model.getModuleFromFile(model, file.getName(), path, Charset.defaultCharset());
}
return module;
}
use of org.erlide.engine.model.root.IErlModule in project erlide_eclipse by erlang.
the class ErlideTestUtils method createModule.
public static IErlModule createModule(final IErlProject project, final String moduleName, final String moduleContents) throws CoreException {
final IFolder folder = project.getWorkspaceProject().getFolder("src");
final IErlModule module = ErlideTestUtils.createModule(moduleName, moduleContents, folder);
ErlideTestUtils.modulesAndIncludes.add(module);
return module;
}
use of org.erlide.engine.model.root.IErlModule in project erlide_eclipse by erlang.
the class ErlideSearchServer method getModulesFromScope.
private OtpErlangList getModulesFromScope(final ErlSearchScope scope) {
final OtpErlangObject[] result = new OtpErlangObject[scope.size()];
int i = 0;
for (final IErlModule module : scope.getModules()) {
result[i] = make2Tuple(module.getScannerName(), module.getFilePath());
i++;
}
return new OtpErlangList(result);
}
Aggregations