use of org.erlide.engine.model.root.IErlFolder 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.root.IErlFolder in project erlide_eclipse by erlang.
the class IParentTest method getChildWithResource.
// IErlElement getChildWithResource(IResource rsrc);
@Test
public void getChildWithResource() throws Exception {
final IProject workspaceProject = project.getWorkspaceProject();
final IErlModel model = ErlangEngine.getInstance().getModel();
final IErlElement childWithResource = model.getChildWithResource(workspaceProject);
final IResource resource = module.getResource();
final IErlElement childWithResource2 = model.getChildWithResource(resource);
final IErlFolder folder = (IErlFolder) project.getChildNamed("src");
final IErlElement childWithResource3 = folder.getChildWithResource(resource);
assertEquals(project, childWithResource);
assertNull(childWithResource2);
assertEquals(module, childWithResource3);
}
use of org.erlide.engine.model.root.IErlFolder in project erlide_eclipse by erlang.
the class IErlFolderTest method isSourcePathParent.
// boolean isSourcePathParent();
@Test
public void isSourcePathParent() throws Exception {
final IErlFolder srcFolder2 = (IErlFolder) IErlFolderTest.project2.getChildNamed("src");
final IErlFolder includeFolder2 = (IErlFolder) IErlFolderTest.project2.getChildNamed("include");
final IErlFolder ebinFolder2 = (IErlFolder) IErlFolderTest.project2.getChildNamed("ebin");
assertTrue(srcFolder2.isSourcePathParent());
assertFalse(includeFolder2.isSourcePathParent());
assertFalse(ebinFolder2.isSourcePathParent());
}
Aggregations