Examples of IErlModel


Examples of org.erlide.engine.model.IErlModel

                        .getService(OpenService.class)
                        .getExternalModuleTree(backend, externalIncludes, pathVars);
            }
        }
        setChildren(null);
        final IErlModel model = ErlangEngine.getInstance().getModel();
        if (externalModuleTree != null && !externalModuleTree.isEmpty()) {
            addExternalEntries(pm, externalModuleTree, model, "modules", null, false);
            cache.putExternalTree(externalModules, project, externalModuleTree);
        }
        if (externalIncludeTree != null && !externalIncludeTree.isEmpty()
View Full Code Here

Examples of org.erlide.engine.model.IErlModel

    protected IStructureComparator createStructureComparator(final Object element,
            final IDocument document0,
            final ISharedDocumentAdapter sharedDocumentAdapter,
            final IProgressMonitor monitor) throws CoreException {
        IErlModule module = null;
        final IErlModel model = ErlangEngine.getInstance().getModel();
        String s = "";
        IDocument document = document0;
        if (element instanceof ResourceNode) {
            final ResourceNode rn = (ResourceNode) element;
            final IResource r = rn.getResource();
            if (r instanceof IFile) {
                final IFile f = (IFile) r;
                final IErlElement e = model.findElement(r);
                if (e instanceof IErlModule) {
                    module = (IErlModule) e;
                }
                if (document == null) {
                    try {
                        s = readString(f.getContents());
                        document = new Document(s);
                    } catch (final CoreException e1) {
                    }
                }
            }
        } else if (document == null && element instanceof IStreamContentAccessor) {
            try {
                final InputStream contents = ((IStreamContentAccessor) element)
                        .getContents();
                try {
                    s = readString(contents);
                } finally {
                    try {
                        contents.close();
                    } catch (final IOException e) {
                    }
                }
                document = new Document(s);
            } catch (final CoreException ex) {
            }
        } else if (document != null) {
            s = document.get();
        }
        if (module == null) {
            String name = "comptemp";
            if (element instanceof ITypedElement) {
                final ITypedElement typedElement = (ITypedElement) element;
                name = typedElement.getName();
            }
            module = model.getModuleFromText(model, name, s, s);
        }
        ErlNode root = null;
        if (element != null && document != null) {
            try {
                module.open(null);
View Full Code Here

Examples of org.erlide.engine.model.IErlModel

    // 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

Examples of org.erlide.engine.model.IErlModel

                    + "version could be found. Can't build.";
            MarkerUtils.createProblemMarker(project, null, message, 0,
                    IMarker.SEVERITY_ERROR);
            throw new BackendException(message);
        }
        final IErlModel model = ErlangEngine.getInstance().getModel();
        backend.addProjectPath(model.findProject(project));

        final Map<RpcFuture, IResource> results = new HashMap<RpcFuture, IResource>();
        for (final BuildResource bres : resourcesToBuild) {
            notifier.checkCancel();
            final IResource resource = bres.getResource();
            MarkerUtils.deleteMarkers(resource);
            if ("erl".equals(resource.getFileExtension())) {
                final String outputDir = erlProject.getProperties().getOutputDir()
                        .toString();
                final RpcFuture f = helper.startCompileErl(project, bres, outputDir,
                        backend.getOtpRpc(), compilerOptions, kind == BuildKind.FULL);
                if (f != null) {
                    results.put(f, resource);
                }
            } else if ("yrl".equals(resource.getFileExtension())) {
                final RpcFuture f = helper.startCompileYrl(project, resource,
                        backend.getOtpRpc(), compilerOptions);
                if (f != null) {
                    results.put(f, resource);
                }
            } else {
                ErlLogger.warn("Don't know how to compile: %s", resource.getName());
            }
        }

        final List<Entry<RpcFuture, IResource>> done = Lists.newArrayList();
        final List<Entry<RpcFuture, IResource>> waiting = Lists.newArrayList(results
                .entrySet());

        // TODO should use some kind of notification!
        while (!waiting.isEmpty()) {
            for (final Entry<RpcFuture, IResource> result : waiting) {
                notifier.checkCancel();
                OtpErlangObject r;
                try {
                    r = result.getKey().get(100, TimeUnit.MILLISECONDS);
                } catch (final Exception e) {
                    r = null;
                }
                if (r != null) {
                    final IResource resource = result.getValue();

                    helper.completeCompile(project, resource, r, backend.getOtpRpc(),
                            compilerOptions);
                    // notifier.compiled(resource.getLocation().toPortableString());

                    done.add(result);
                }
            }
            waiting.removeAll(done);
            done.clear();
        }
        helper.refreshOutputDir(project);

        try {
            helper.checkForClashes(backend.getOtpRpc(), project);
        } catch (final Exception e) {
        }
        backend.removeProjectPath(model.findProject(project));

    }
View Full Code Here

Examples of org.erlide.engine.model.IErlModel

        }
        final Object[] dialogResult = dialog.getResult();
        if (dialogResult == null || dialogResult.length == 0) {
            return result;
        }
        final IErlModel model = ErlangEngine.getInstance().getModel();
        for (final Object o : dialogResult) {
            if (o instanceof IFile) {
                final IFile file = (IFile) o;
                result.add(model.findModule(file));
            }
        }
        return result;
    }
View Full Code Here

Examples of org.erlide.engine.model.IErlModel

     *
     */
    public ErlangFileContentProvider() {
        ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
                IResourceChangeEvent.POST_CHANGE);
        final IErlModel mdl = ErlangEngine.getInstance().getModel();
        mdl.addModelChangeListener(this);
    }
View Full Code Here

Examples of org.erlide.engine.model.IErlModel

        if (externalModulePath == null) {
            return null;
        }
        IErlModule module;
        try {
            final IErlModel model = ErlangEngine.getInstance().getModel();
            module = ErlangEngine.getInstance().getModelUtilService()
                    .getModuleFromExternalModulePath(model, externalModulePath);
        } catch (final ErlModelException e1) {
            return null;
        }
View Full Code Here

Examples of org.erlide.engine.model.IErlModel

                    db = new ParserDB();
                    // out = new PrintStream(
                    // new File("/home/qvladum/parserDB.txt"));
                    out = System.out;

                    final IErlModel model = ErlangEngine.getInstance().getModel();
                    final Collection<SourcePathProvider> sourcePathProviders = SourcePathUtils
                            .getSourcePathProviders();
                    final long time = System.currentTimeMillis();
                    db.run(model, sourcePathProviders, false);
                    System.out.println(" took " + (System.currentTimeMillis() - time)
View Full Code Here

Examples of org.erlide.engine.model.IErlModel

        if (isProjectPreferencePage()) {
            openWorkspacePreferences(null);
        } else {
            final List<IProject> erlProjects = new ArrayList<IProject>();
            final Set<IProject> projectsWithSpecifics = new HashSet<IProject>();
            final IErlModel model = ErlangEngine.getInstance().getModel();
            try {
                for (final IErlProject ep : model.getErlangProjects()) {
                    final IProject p = ep.getWorkspaceProject();
                    if (hasProjectSpecificOptions(p)) {
                        projectsWithSpecifics.add(p);
                    }
                    erlProjects.add(p);
View Full Code Here

Examples of org.erlide.engine.model.IErlModel

    static public ErlSearchScope getProjectsScope(final Collection<IProject> projects,
            final boolean addExternals, final boolean addOtp) throws CoreException {
        final ErlSearchScope result = new ErlSearchScope();
        final Set<String> externalModulePaths = new HashSet<String>();
        final IErlModel model = ErlangEngine.getInstance().getModel();
        for (final IProject project : projects) {
            SearchCoreUtil.addProjectToScope(project, result);
            if (NatureUtil.hasErlangNature(project)) {
                final IErlProject erlProject = model.getErlangProject(project);
                addExternalModules(erlProject, result, externalModulePaths, addExternals,
                        addOtp);
            }
        }
        return result;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.