Search in sources :

Example 26 with ErlProject

use of org.erlide.engine.internal.model.root.ErlProject in project erlide_eclipse by erlang.

the class IErlProjectTest method getExternalModulesString.

// String getExternalModulesString();
@Test
public void getExternalModulesString() throws Exception {
    final IErlProject aProject = ErlModelTestBase.projects[0];
    final String externalIncludesString = aProject.getProperties().getExternalIncludes();
    try {
        final String s = "/hej";
        ((ErlProject) aProject).setExternalModulesFile(s);
        assertEquals(s, aProject.getProperties().getExternalModules());
    } finally {
        ((ErlProject) aProject).setExternalModulesFile(externalIncludesString);
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) ErlProject(org.erlide.engine.internal.model.root.ErlProject) IErlProject(org.erlide.engine.model.root.IErlProject) Test(org.junit.Test)

Example 27 with ErlProject

use of org.erlide.engine.internal.model.root.ErlProject in project erlide_eclipse by erlang.

the class AbstractProjectConfigurationTest method setUp.

@Before
public void setUp() throws Exception {
    ErlideTestUtils.initProjects();
    final String name = "testproject3";
    project = ErlideTestUtils.createErlProject(name);
    final ErlProject p = (ErlProject) project;
    p.configurationChanged();
}
Also used : ErlProject(org.erlide.engine.internal.model.root.ErlProject) IErlProject(org.erlide.engine.model.root.IErlProject) Before(org.junit.Before)

Example 28 with ErlProject

use of org.erlide.engine.internal.model.root.ErlProject 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);
}
Also used : IErlExternal(org.erlide.engine.model.root.IErlExternal) ErlProject(org.erlide.engine.internal.model.root.ErlProject) IErlModule(org.erlide.engine.model.root.IErlModule) IErlElementLocator(org.erlide.engine.model.root.IErlElementLocator) Test(org.junit.Test)

Aggregations

ErlProject (org.erlide.engine.internal.model.root.ErlProject)28 IErlProject (org.erlide.engine.model.root.IErlProject)27 Test (org.junit.Test)25 IErlModule (org.erlide.engine.model.root.IErlModule)21 File (java.io.File)18 IPath (org.eclipse.core.runtime.IPath)12 Path (org.eclipse.core.runtime.Path)12 IErlElementLocator (org.erlide.engine.model.root.IErlElementLocator)8 IProject (org.eclipse.core.resources.IProject)6 IFile (org.eclipse.core.resources.IFile)5 IProjectDescription (org.eclipse.core.resources.IProjectDescription)5 IErlPreprocessorDef (org.erlide.engine.model.erlang.IErlPreprocessorDef)2 IFolder (org.eclipse.core.resources.IFolder)1 ErlModelCache (org.erlide.engine.internal.model.cache.ErlModelCache)1 ErlangProjectProperties (org.erlide.engine.model.root.ErlangProjectProperties)1 IErlExternal (org.erlide.engine.model.root.IErlExternal)1 IErlModel (org.erlide.engine.model.root.IErlModel)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1