use of org.erlide.engine.model.root.IErlElementLocator in project erlide_eclipse by erlang.
the class IErlElementTest method getResource.
// IResource getResource();
@Test
public void getResource() throws Exception {
project.open(null);
final IProject workspaceProject = project.getWorkspaceProject();
final IFolder srcFolder = workspaceProject.getFolder("src");
final IFile file = srcFolder.getFile("xx.erl");
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
final IErlModule otpFile = model.findModuleFromProject(project, "file.erl", null, IErlElementLocator.Scope.PROJECT_ONLY);
module.open(null);
final IErlElement element = module.getElementAtLine(3);
assertEquals(file, module.getResource());
assertNull(otpFile.getResource());
assertEquals(module.getResource(), element.getResource());
}
use of org.erlide.engine.model.root.IErlElementLocator in project erlide_eclipse by erlang.
the class IErlElementTest method getModel.
// IErlModel getModel();
@Test
public void getModel() throws Exception {
module.open(null);
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
assertEquals(model, ErlangEngine.getInstance().getModel());
}
use of org.erlide.engine.model.root.IErlElementLocator in project erlide_eclipse by erlang.
the class IErlElementTest method isStructureKnown.
// boolean isReadOnly();
// Empty method
// boolean isStructureKnown() throws ErlModelException;
@Test
public void isStructureKnown() throws Exception {
((ErlProject) project).setSourceDirs(project.getProperties().getSourceDirs());
// this sets structureKnown to false
final boolean structureKnown = project.isStructureKnown();
project.open(null);
final boolean structureKnown2 = project.isStructureKnown();
final boolean structureKnown3 = module.isStructureKnown();
module.open(null);
final boolean structureKnown4 = module.isStructureKnown();
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
final IErlModule otpFile = model.findModuleFromProject(project, "file.erl", null, IErlElementLocator.Scope.PROJECT_ONLY);
final IErlExternal external = (IErlExternal) otpFile.getParent();
final boolean structureKnown5 = external.isStructureKnown();
final IErlModule module2 = ErlideTestUtils.createModule(project, "yy.erl", "-module(yy).\n% comment\n% same\nf(x) -> y.\n% last");
final boolean structureKnown6 = module2.isStructureKnown();
module2.open(null);
final boolean structureKnown7 = module2.isStructureKnown();
assertFalse(structureKnown);
assertTrue(structureKnown2);
assertFalse(structureKnown3);
assertTrue(structureKnown4);
assertTrue(structureKnown5);
assertFalse(structureKnown6);
assertTrue(structureKnown7);
}
Aggregations