Package org.erlide.engine.model.root

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


    @Before
    public void initialClean() throws CoreException, IOException {
        setUpProject("builders");

        final IErlProject p2 = getExistingProject("builders");
        prj = p2.getResource().getProject();

        final IResource ebin = prj.findMember("ebin");
        if (ebin != null) {
            ebin.delete(true, null);
        } else {
View Full Code Here


        final IResource beam0 = prj.findMember(targetBeamPath);
        assertThat("beam existed before test", beam0, nullValue());

        final ErlangBuilder builder = ErlangBuilderFactory.get(builderTool);
        final BuildNotifier notifier = new BuildNotifier(null, prj);
        final IErlProject erlProject = ErlangEngine.getInstance().getModel()
                .getErlangProject(prj);

        builder.build(BuildKind.FULL, erlProject, notifier);
        prj.refreshLocal(IResource.DEPTH_INFINITE, null);
        waitJobsToFinish(ResourcesPlugin.FAMILY_MANUAL_REFRESH);
View Full Code Here

    }

    private void testClean(final BuilderTool builderTool) throws CoreException {
        final ErlangBuilder builder = ErlangBuilderFactory.get(builderTool);
        final BuildNotifier notifier = new BuildNotifier(null, prj);
        final IErlProject erlProject = ErlangEngine.getInstance().getModel()
                .getErlangProject(prj);

        builder.clean(erlProject, notifier);
        prj.refreshLocal(IResource.DEPTH_INFINITE, null);
        waitJobsToFinish(ResourcesPlugin.FAMILY_MANUAL_REFRESH);
View Full Code Here

    @Override
    public void run() {
        final ModelUtilService svc = ErlangEngine.getInstance().getModelUtilService();

        final String name = getQuickFix().getArgs().get(0);
        final IErlProject project = svc.getProject(module);

        final Iterator<IPath> iterator = project.getProperties().getIncludeDirs()
                .iterator();
        final IPath inc;
        if (!iterator.hasNext()) {
            inc = module.getResource().getParent().getProjectRelativePath();
        } else {
            inc = iterator.next();
            // if there are multiple include dirs, let user move file manually
        }
        final IProject wproject = project.getWorkspaceProject();
        final IFolder folder = wproject.getFolder(inc);
        final IFile header = folder.getFile(name);
        try {
            final EmptyInputStream source = new EmptyInputStream();
            try {
View Full Code Here

        dialyzePrepareFromSelection(true, SEL.PROJECT);
    }

    @Test
    public void dialyzeMarkerOnFile() throws Exception {
        IErlProject erlProject = null;
        try {
            // given
            // an erlang module in an erlang project
            final String projectName = "testproject";
            erlProject = createTmpErlProject(projectName);
            final String moduleName = "test.erl";
            final IErlModule erlModule = createModule(erlProject, moduleName,
                    "-module(test).\n-export([f/0]).\n-f() ->\n    atom_to_list(\"hej\").\n");
            IMarker[] markers = erlProject.getWorkspaceProject().findMarkers(
                    DialyzerMarkerUtils.DIALYZE_WARNING_MARKER, true,
                    IResource.DEPTH_INFINITE);
            assertEquals(0, markers.length);
            // when
            // putting a dialyzer warning on it
            final int lineNumber = 3;
            final String message = "test message";
            final IErlElementLocator model = ErlangEngine.getInstance().getModel();
            DialyzerMarkerUtils.addDialyzerWarningMarker(model, erlModule.getResource()
                    .getLocation().toPortableString(), lineNumber, message);
            // then
            // there should be a marker with proper file name and the proper
            // line number
            markers = erlProject.getWorkspaceProject().findMarkers(
                    DialyzerMarkerUtils.DIALYZE_WARNING_MARKER, true,
                    IResource.DEPTH_INFINITE);
            assertEquals(1, markers.length);
            final IMarker marker = markers[0];
            assertEquals(moduleName, marker.getResource().getName());
View Full Code Here

    // TODO this never worked??? @Test
    public void dialyzeWithExternalInclude() throws Exception {
        // http://www.assembla.com/spaces/erlide/tickets/608-dialyzer---navigate-to-external-includes-from-markers
        File externalFile = null;
        IErlProject erlProject = null;
        File externalIncludesFile = null;
        final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        try {
            // given
            // an erlang project and an external file not in any project
            final String projectName = "testproject";
            erlProject = createTmpErlProject(projectName);
            final String externalFileName = "external.hrl";
            externalFile = createTmpFile(externalFileName,
                    "f([_ | _]=L) ->\n    atom_to_list(L).\n");
            externalIncludesFile = createTmpFile("external_includes",
                    externalFile.getAbsolutePath());
            erlProject.getProperties().setExternalIncludesFile(
                    externalIncludesFile.getAbsolutePath());
            DialyzerMarkerUtils.removeDialyzerMarkersFor(root);
            // when
            // putting dialyzer warning markers on the external file
            final String message = "test message";
View Full Code Here

    }

    private void dialyzePrepareFromSelection(final boolean sources, final SEL select)
            throws Exception {
        // http://www.assembla.com/spaces/erlide/tickets/607-dialyzer---only-dialyze-on-selection
        IErlProject erlProject = null;
        try {
            // given
            // a project with two erlang modules, one of them selected
            final String projectName = "testproject";
            erlProject = createTmpErlProject(projectName);
View Full Code Here

    // }

    @Test
    public void dialyzeBinaryOnProjectWithErrorFile() throws Exception {
        // http://www.assembla.com/spaces/erlide/tickets/616-dialyzer-�-crash-on-binary-analysis-and-files-with-errors
        IErlProject erlProject = null;
        try {
            // given
            // a project with two erlang modules, one of them with an erlang
            // error, preventing it from generating a beam-file
            final String projectName = "testproject";
            erlProject = createTmpErlProject(projectName);
            assertNotNull(erlProject);
            final IErlModule a = createModule(erlProject, "a.erl",
                    "-module(a).\n-export([t/0]).\nt() ->\n    p(a).\np(L) ->\n    lists:reverse(L).\n");
            assertNotNull(a);
            final IErlModule b = createModule(erlProject, "b.erl",
                    "-module(b).\n-export([t/0]).\nt() ->\n    p(a).\np(L) ->\n    fel som tusan.\n");
            assertNotNull(b);
            invokeBuilderOn(erlProject);
            // when
            // collecting files to dialyze
            final Set<IErlModule> modules = DialyzerUtils.collectModulesFromResource(
                    ErlangEngine.getInstance().getModel(), erlProject.getResource());
            final Set<IErlProject> projects = Sets.newHashSet();
            projects.add(erlProject);
            final List<String> names = new ArrayList<String>();
            final List<IPath> includeDirs = new ArrayList<IPath>();
            final List<String> files = new ArrayList<String>();
View Full Code Here

    }

    @Override
    public Set<ISourceUnit> getDirectDependentModules() throws ErlModelException {
        final Set<ISourceUnit> result = new HashSet<ISourceUnit>();
        final IErlProject project = modelUtilService.getProject(this);
        for (final IErlModule module : project.getModules()) {
            final boolean wasOpen = module.isOpen();
            if (!wasOpen) {
                module.open(null);
            }
            final Collection<ErlangIncludeFile> incs = module.getIncludeFiles();
View Full Code Here

    }

    @Override
    public Set<ISourceUnit> getAllDependentModules() throws CoreException {
        final Set<ISourceUnit> result = new HashSet<ISourceUnit>();
        final IErlProject project = modelUtilService.getProject(this);
        for (final IErlModule module : project.getModules()) {
            final Collection<IErlModule> allIncludedFiles = ErlangEngine.getInstance()
                    .getModelFindService().findAllIncludedFiles(module);
            if (allIncludedFiles.contains(this)) {
                result.add(module);
            }
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.