Package org.erlide.engine.model.root

Examples of org.erlide.engine.model.root.IErlElement


        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.getCorrespondingResource());
        assertNull(otpFile.getCorrespondingResource());
        assertNull(element.getCorrespondingResource());
    }
View Full Code Here


    // String getName();
    @Test
    public void getName() throws Exception {
        module.open(null);
        final IErlElement element = module.getElementAtLine(3);
        final IErlElement element2 = module.getElementAtLine(0);
        assertEquals("xx.erl", module.getName());
        assertEquals("testproject1", project.getName());
        assertEquals("f", element.getName());
        assertEquals("module", element2.getName());
    }
View Full Code Here

    // Kind getKind();
    @Test
    public void getKind() throws Exception {
        module.open(null);
        final IErlElement element = module.getElementAtLine(3);
        final IErlElement element2 = module.getElementAtLine(0);
        assertEquals(ErlElementKind.MODULE, module.getKind());
        assertEquals(ErlElementKind.PROJECT, project.getKind());
        assertEquals(ErlElementKind.FUNCTION, element.getKind());
        assertEquals(ErlElementKind.ATTRIBUTE, element2.getKind());
        assertEquals(ErlElementKind.MODEL, ErlangEngine.getInstance().getModel()
                .getKind());
    }
View Full Code Here

    // IErlElement getParent();
    @Test
    public void getParent() throws Exception {
        project.open(null);
        final IErlElement srcFolder = project.getChildNamed("src");
        module.open(null);
        final IErlElement element = module.getElementAtLine(3);
        assertEquals(project, srcFolder.getParent());
        assertEquals(srcFolder, module.getParent());
        assertEquals(module, element.getParent());
    }
View Full Code Here

        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());
    }
View Full Code Here

    public void getFilePath() throws Exception {
        final String modulePath = module.getResource().getLocation().toString();
        // final String projectPath = project.getResource().getLocation()
        // .toString();
        // final String srcFolderPath = projectPath + "/src";
        final IErlElement parent = module.getParent();
        module.open(null);
        final IErlElement element = module.getElementAtLine(3);
        assertEquals(modulePath, module.getFilePath());
        assertNull(project.getFilePath());
        assertNull(parent.getFilePath());
        assertNull(element.getFilePath());
    }
View Full Code Here

    // IErlElement getChildNamed(String s);
    @Test
    public void getChildNamed() throws Exception {
        project.open(null);
        final String src = "src";
        final IErlElement childNamed = project.getChildNamed(src);
        final IErlElement childNamed2 = project.getChildNamed("SRC");
        final IErlElement childNamed3 = project.getChildNamed("noway");
        module.open(null);
        final IErlElement childNamed4 = module.getChildNamed("module");
        final IErlElement childNamed5 = module.getChildNamed("f");
        assertEquals(src, childNamed.getName());
        assertNull(childNamed2);
        assertNull(childNamed3);
        assertNotNull(childNamed4);
        assertTrue(childNamed5.getKind() == ErlElementKind.FUNCTION);
    }
View Full Code Here

    // 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);
    }
View Full Code Here

        final int childCount = module.getChildCount();
        final String aname = "test_a";
        final IErlAttribute attribute = new ErlAttribute(module, aname, null, "test");
        module.addChild(attribute);
        final int childCount2 = module.getChildCount();
        final IErlElement childNamed = module.getChildNamed(aname);
        assertEquals(childCount + 1, childCount2);
        assertEquals(attribute, childNamed);
    }
View Full Code Here

        final String aname = "test_a";
        final IErlAttribute attribute = new ErlAttribute(module, aname, null, "test");
        module.setChildren(Lists.newArrayList(attribute));
        final int childCount = module.getChildCount();
        final List<IErlElement> children2 = module.getChildren();
        final IErlElement element = children2.iterator().next();
        assertEquals(1, childCount);
        assertFalse(children2.equals(children));
        assertEquals(attribute, element);
    }
View Full Code Here

TOP

Related Classes of org.erlide.engine.model.root.IErlElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.