Package org.erlide.engine.model.root

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


    public boolean shouldCompile(final IProject project, final IResource source,
            final IResource beam) throws ErlModelException {
        boolean shouldCompile = beam == null;

        if (beam != null) {
            final IErlProject eprj = ErlangEngine.getInstance().getModel()
                    .findProject(project);
            if (eprj != null) {
                shouldCompile = shouldCompileModule(project, source, beam, shouldCompile,
                        eprj);
            }
View Full Code Here


        }
        return shouldCompile;
    }

    public void refreshOutputDir(final IProject project) throws CoreException {
        final IErlProject erlProject = ErlangEngine.getInstance().getModel()
                .getErlangProject(project);
        final IPath outputDir = erlProject.getProperties().getOutputDir();
        final IResource ebinDir = project.findMember(outputDir);
        if (ebinDir != null) {
            ebinDir.refreshLocal(IResource.DEPTH_ONE, null);
        }
    }
View Full Code Here

                final IResource br = project.findMember(erl);
                if (br != null) {
                    br.setDerived(true, null);
                    final BuildResource bbr = new BuildResource(br);
                    // br.touch() doesn't work...
                    final IErlProject erlProject = ErlangEngine.getInstance().getModel()
                            .getErlangProject(project);
                    compileErl(project, bbr, erlProject.getProperties().getOutputDir()
                            .toString(), backend, compilerOptions);
                }
            } catch (final CoreException e) {
                ErlLogger.warn(e);
            }
View Full Code Here

                    createFolders(newProjectHandle, info.getSourceDirs(), monitor);
                    createFolders(newProjectHandle, info.getIncludeDirs(), monitor);

                    createConfig(newProjectHandle, info.getConfigType(), monitor);

                    final IErlProject erlProject = ErlangEngine.getInstance().getModel()
                            .getErlangProject(newProjectHandle);
                    erlProject.setConfigType(info.getConfigType());
                    final BuilderProperties builderProperties = new BuilderProperties();
                    builderProperties.setBuilderTool(builder);
                    builderProperties.setCompileTarget(info.getBuilderData().get(
                            "compile"));
                    builderProperties.setCleanTarget(info.getBuilderData().get("clean"));

                    erlProject.setBuilderProperties(builderProperties);
                    erlProject.setProperties(info);
                    erlProject.storeAllProperties();

                } catch (final Exception e) {
                    throw new InvocationTargetException(e);
                }
            }
View Full Code Here

            final String projectName = config.getAttribute(ICoverAttributes.PROJECT, "");

            projectMBr.setText(projectName);

            if (projectName != null && projectName.length() > 0) {
                final IErlProject p = ErlangEngine
                        .getInstance()
                        .getModel()
                        .getErlangProject(
                                ResourcesPlugin.getWorkspace().getRoot()
                                        .getProject(projectName));
View Full Code Here

            @Override
            public void modifyText(final ModifyEvent e) {
                updateLaunchConfigurationDialog();
                final String projectName = projectMBr.getText();
                if (projectName != null && projectName.length() > 0) {
                    final IErlProject p = ErlangEngine
                            .getInstance()
                            .getModel()
                            .getErlangProject(
                                    ResourcesPlugin.getWorkspace().getRoot()
                                            .getProject(projectName));
View Full Code Here

    // IErlProject findProject(IProject project);
    @Test
    public void findProject() throws Exception {
        final IProject workspaceProject = project.getWorkspaceProject();
        final IProject workspaceProject2 = project2.getWorkspaceProject();
        final IErlProject findProject = model.findProject(workspaceProject);
        final IErlProject findProject2 = model.findProject(workspaceProject2);
        assertEquals(project, findProject);
        assertEquals(project2, findProject2);
    }
View Full Code Here

    // IErlModule findIncludeFromModule(IErlModule module, String includeName,
    // String includePath, Scope scope) throws ErlModelException;
    @Test
    public void findIncludeFromModule() throws Exception {
        File externalIncludeFile = null;
        final IErlProject myProject = project;
        final IProject workspaceProject = myProject.getWorkspaceProject();
        final IProject[] referencedProjects = workspaceProject.getReferencedProjects();
        final Collection<IPath> includeDirs = myProject.getProperties().getIncludeDirs();
        // given
        // a project with an external include and an internal include and a
        // referenced project with an include and an include in the same
        // directory as the module
        try {
            final String xxHrl = "xx.hrl";
            externalIncludeFile = createTmpFile(xxHrl,
                    "-record(rec2, {field, another=def}.");
            final String externalIncludePath = externalIncludeFile.getAbsolutePath();
            final IPath p = new Path(externalIncludePath).removeLastSegments(1);
            final List<IPath> newIncludeDirs = Lists.newArrayList(includeDirs);
            newIncludeDirs.add(p);
            ((ErlProject) myProject).setIncludeDirs(newIncludeDirs);
            final IErlModule include = createInclude(myProject, "yy8.hrl",
                    "-define(Y, include).\n");
            final IErlProject project1 = project2;
            final IErlModule referencedInclude = createInclude(project1, "zz8.hrl",
                    "-define(Z, referenced).\n");
            final IErlModule includeInModuleDir = createModule(myProject, "ww.hrl",
                    "-define(WW, x).\n");
            myProject.open(null);
            // when
            // looking for includes
            final String xx = "xx";
            final IErlModule x1 = model.findIncludeFromModule(module, xx, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule x2 = model.findIncludeFromModule(module, xx, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule x3 = model.findIncludeFromModule(module, xx, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final String yy = "yy8";
            final IErlModule y1 = model.findIncludeFromModule(module, yy, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule y2 = model.findIncludeFromModule(module, yy, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule y3 = model.findIncludeFromModule(module, yy, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final String zz = "zz8";
            final IErlModule z1 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule z2 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule z3 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(new IProject[] { project1
                    .getWorkspaceProject() });
            workspaceProject.setDescription(description, null);
            myProject.open(null);
            final IErlModule z4 = model.findIncludeFromModule(module, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
View Full Code Here

    // String modulePath, Scope scope) throws ErlModelException;
    @Test
    public void findModuleFromProject() throws Exception {
        File externalModuleFile = null;
        File externalsFile = null;
        final IErlProject aProject = project;
        final IProject workspaceProject = aProject.getWorkspaceProject();
        final IProject[] referencedProjects = workspaceProject.getReferencedProjects();
        final String externalModulesString = aProject.getProperties()
                .getExternalModules();
        // given
        // a project with an external module and an internal module and a
        // referenced project with a module
        try {
            final String xxErl = "xx6.erl";
            externalModuleFile = createTmpFile(xxErl, "-module(xx6).\n");
            final String externalModulePath = externalModuleFile.getAbsolutePath();
            externalsFile = createTmpFile(XX_ERLIDEX, externalModulePath);
            ((ErlProject) aProject).setExternalModulesFile(externalsFile
                    .getAbsolutePath());
            final IErlModule aModule = createModule(aProject, "yy6.erl",
                    "-module(yy6).\n");
            final IErlProject project1 = project2;
            final IErlModule referencedModule = createModule(project1, "zz6.erl",
                    "-module(zz6).\n");
            aProject.open(null);
            // when
            // looking for modules
            final String xx = "xx6";
            final IErlModule x1 = model.findModuleFromProject(aProject, xx, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule x2 = model.findModuleFromProject(aProject, xx, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule x3 = model.findModuleFromProject(aProject, xx, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final String yy = "yy6";
            final IErlModule y1 = model.findModuleFromProject(aProject, yy, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule y2 = model.findModuleFromProject(aProject, yy, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule y3 = model.findModuleFromProject(aProject, yy, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final IErlModule y4 = model.findModuleFromProject(project1, yy, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule y5 = model.findModuleFromProject(project1, yy, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule y6 = model.findModuleFromProject(project1, yy, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final String zz = "zz6";
            final IErlModule z1 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule z2 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule z3 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(new IProject[] { project1
                    .getWorkspaceProject() });
            workspaceProject.setDescription(description, null);
            aProject.open(null);
            final IErlModule z4 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
View Full Code Here

    @Test
    public void findModuleFromProject_preferProjectFile() throws Exception {
        File externalModuleFile = null;
        File externalsFile = null;
        final IErlProject aProject = project;
        final IProject workspaceProject = aProject.getWorkspaceProject();
        final IProject[] referencedProjects = workspaceProject.getReferencedProjects();
        final String externalModulesString = aProject.getProperties()
                .getExternalModules();
        // given
        // a project with an external include and a
        // referenced project with an include, both have same name
        try {
            final String zzErl = "zz9.erl";
            final String xxxContents = "-module(zz9).\n";
            externalModuleFile = createTmpFile(zzErl, xxxContents);
            final String externalModulePath = externalModuleFile.getAbsolutePath();
            externalsFile = createTmpFile(XX_ERLIDEX, externalModulePath);
            ((ErlProject) aProject).setExternalModulesFile(externalsFile
                    .getAbsolutePath());
            final IErlProject project1 = project2;
            final IErlModule referencedModule = createModule(project1, zzErl, xxxContents);
            aProject.open(null);
            // when
            // looking for module
            final String zz = "zz9";
            final IErlModule zz1 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
            final IErlModule zz2 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.ALL_PROJECTS);
            final IErlModule zz3 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.REFERENCED_PROJECTS);
            final IProjectDescription description = workspaceProject.getDescription();
            description.setReferencedProjects(new IProject[] { project1
                    .getWorkspaceProject() });
            workspaceProject.setDescription(description, null);
            aProject.open(null);
            final IErlModule zz4 = model.findModuleFromProject(aProject, zz, null,
                    IErlElementLocator.Scope.PROJECT_ONLY);
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.