Package org.erlide.engine.model.root

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


        creator = new ProjectCreator(name, location, new IProject[] {}, info, context,
                null);
        prj = creator.createProject();
        assertThat(prj, is(not(nullValue())));

        final IErlProject erlPrj = ErlangEngine.getInstance().getModel().findProject(prj);
        assertThat(erlPrj, is(not(nullValue())));

        final ErlangProjectProperties props = erlPrj.getProperties();
        assertThat(props.getSourceDirs(),
                contains((IPath) new Path("src"), (IPath) new Path("foz")));

        final IResource r = prj.findMember(ProjectConfigType.REBAR.getConfigName());
        assertThat(r, is(not(nullValue())));
View Full Code Here


    }

    // String getExternalIncludesString();
    @Test
    public void getExternalIncludesString() throws Exception {
        final IErlProject aProject = project2;
        final String externalIncludesString = aProject.getProperties()
                .getExternalIncludes();
        try {
            final String s = "/tjo";
            ((ErlProject) aProject).setExternalIncludesFile(s);
            assertEquals(s, aProject.getProperties().getExternalIncludes());
        } finally {
            ((ErlProject) aProject).setExternalIncludesFile(externalIncludesString);
        }
    }
View Full Code Here

    // void setIncludeDirs(Collection<IPath> includeDirs)
    // throws BackingStoreException;
    @Test
    public void setIncludeDirs() throws Exception {
        File externalFile = null;
        final IErlProject aProject = project2;
        final Collection<IPath> includeDirs = aProject.getProperties().getIncludeDirs();
        try {
            // given
            // an erlang project and an external file not in any project
            final String externalFileName = "external.hrl";
            externalFile = createTmpFile(externalFileName, "-define(E, hej).\n");
            final String absolutePath = externalFile.getAbsolutePath();
            final List<IPath> newIncludeDirs = Lists.newArrayList(includeDirs);
            aProject.open(null);
            final Collection<IErlModule> otpIncludes = aProject.getExternalIncludes();
            final IPath absoluteDir = new Path(absolutePath).removeLastSegments(1);
            newIncludeDirs.add(absoluteDir);
            ((ErlProject) aProject).setIncludeDirs(newIncludeDirs);
            aProject.open(null);
            // when
            // fetching all external includes
            final Collection<IErlModule> externalIncludes = aProject
                    .getExternalIncludes();
            // then
            // the external file should be returned
            final Set<IErlModule> otpSet = Sets.newHashSet(otpIncludes);
            final Set<IErlModule> externalSet = Sets.newHashSet(externalIncludes);
View Full Code Here

    // void setSourceDirs(Collection<IPath> sourceDirs)
    // throws BackingStoreException;
    @Test
    public void setSourceDirs() throws Exception {
        final IErlProject aProject = project;
        final Collection<IPath> sourceDirs = aProject.getProperties().getSourceDirs();
        try {
            // given
            // an Erlang project and a module
            final IPath srcxPath = new Path("srcx");
            final List<IPath> srcxDirs = Lists.newArrayList(srcxPath);
            aProject.open(null);
            // when
            // setting source dirs so the module is on source path
            final Collection<IErlModule> modules = aProject.getModules();
            ((ErlProject) aProject).setSourceDirs(srcxDirs);
            aProject.open(null);
            final Collection<IErlModule> srcxModules = aProject.getModules();
            ((ErlProject) aProject).setSourceDirs(sourceDirs);
            aProject.open(null);
            final Collection<IErlModule> modulesAgain = aProject.getModules();
            // then
            // the it should be returned, but not otherwise
            assertEquals(0, srcxModules.size());
            assertTrue(modules.size() > 0);
            assertEquals(module, modules.iterator().next());
View Full Code Here

    }

    // RuntimeInfo getRuntimeInfo();
    @Test
    public void getRuntimeInfo() throws Exception {
        final IErlProject aProject = project2;
        final RuntimeInfo info = aProject.getRuntimeInfo();
        // final String expected = ResourcesPlugin.getWorkspace().getRoot()
        // .getLocation().toString();
        assertNotNull(info);
        // The working dir might be relative to the project and can also be "."
        // We need to convert it to a canonical absolute path in order to be
View Full Code Here

    }

    // RuntimeVersion getRuntimeVersion();
    @Test
    public void getRuntimeVersion() throws Exception {
        final IErlProject aProject = project2;
        final RuntimeVersion version = aProject.getRuntimeVersion();
        assertNotNull(version);
        final int majorVersion = version.getMajor();
        assertTrue(majorVersion >= 12);
    }
View Full Code Here

    }

    // TODO check more properties than source dirs property
    @Test
    public void setProperties() throws Exception {
        final IErlProject aProject = project2;
        final Collection<IPath> sourceDirs = aProject.getProperties().getSourceDirs();
        try {
            final ErlangProjectProperties properties = aProject.getProperties();
            final IPath srcx = new Path("srcx");
            properties.setSourceDirs(Lists.newArrayList(srcx));
            aProject.setProperties(properties);
            final Collection<IPath> sourceDirs2 = aProject.getProperties()
                    .getSourceDirs();
            assertEquals(1, sourceDirs2.size());
            assertEquals(srcx, sourceDirs2.iterator().next());
        } finally {
            ((ErlProject) aProject).setSourceDirs(sourceDirs);
View Full Code Here

            aProject.setDescription(description, null);
        }
    }

    public void getProjectReferences_closedProject() throws Exception {
        final IErlProject erlProject = project2;
        final IProject aProject = erlProject.getWorkspaceProject();
        try {
            aProject.close(null);
            erlProject.getReferencedProjects();
        } finally {
            if (!aProject.isOpen()) {
                aProject.open(null);
            }
        }
View Full Code Here

    @Before
    public void setup() throws Exception {
        // We set up projects here, it's quite costly
        final String name1 = "testproject1";
        final IErlProject erlProject1 = createProject(name1, getTmpPath(name1));
        final String name2 = "testproject2";
        final IErlProject erlProject2 = createProject(name2, getTmpPath(name2));
        projects = new IErlProject[] { erlProject1, erlProject2 };
    }
View Full Code Here

    @Test
    public void findIncludeFile() throws Exception {
        // given
        // a project with a module and an include including file.hrl
        final IErlProject project = projects[0];
        final String includeName = "a.hrl";
        final IErlModule include = createModule(
                project,
                includeName,
                "-include_lib(\"kernel/include/file.hrl\").\n-record(rec1, {field, another=def}).\n-define(MACRO(A), lists:reverse(A)).\n");
View Full Code Here

TOP

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

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.