Package org.erlide.engine.model.erlang

Examples of org.erlide.engine.model.erlang.IErlModule.open()


        final IErlModule moduleA = createModule(project, "az.erl",
                "-module(az).\n-export([f/1]).\nf(A) ->\n    {A}.\n");
        final IErlModule moduleB = createModule(project, "bz.erl",
                "-module(bz).\n-export([f/0]).\nf(A) ->\n    [A].\n");
        moduleA.open(null);
        moduleB.open(null);
        // when
        // searching for the variable A from module a
        final ErlangSearchPattern pattern = new SearchPatternFactory(ErlangEngine
                .getInstance().getModelUtilService()).getSearchPattern(
                SearchFor.VARIABLE, null, "A", 0, LimitTo.ALL_OCCURRENCES, moduleA);
View Full Code Here


    private void completionTest(final IErlProject project, final String name,
            final String text, final int offset, final List<String> expected,
            final boolean inStrings) throws CoreException {
        final IDocument document = new StringDocument(text);
        final IErlModule module = createModule(project, name, text);
        module.open(null);

        final MockSourceViewer sourceViewer = new MockSourceViewer(document, offset);
        final IContentAssistProcessor p = inStrings ? new ErlStringContentAssistProcessor(
                sourceViewer, module, project, null) : new ErlContentAssistProcessor(
                sourceViewer, module, project, null);
View Full Code Here

        if (resource instanceof IFile) {
            final IFile file = (IFile) resource;
            final IErlModule m = ErlangEngine.getInstance().getModel().findModule(file);
            if (m != null) {
                try {
                    m.open(null);
                    final IErlElement e = m.getElementAtLine(lineNumber);
                    if (e instanceof IErlFunctionClause) {
                        final IErlFunctionClause clause = (IErlFunctionClause) e;
                        clauseHead = clause.getName() + clause.getHead();
                    }
View Full Code Here

        final IErlElement element = model.findElement(breakpoint.getMarker()
                .getResource());
        if (element instanceof IErlModule) {
            final IErlModule m = (IErlModule) element;
            try {
                m.open(null);
                final int lineNumber = breakpoint.getLineNumber();
                return m.getElementAtLine(lineNumber - 1);
            } catch (final Exception e) {
                ErlLogger.warn(e);
            }
View Full Code Here

    public void getImportsAsListTest() throws Exception {
        // given
        // an Erlang module with imports
        final IErlModule moduleA = createModule(project1, "ax.erl",
                "-module(ax).\n-import(lists, [reverse/1, foldl/3].\n");
        moduleA.open(null);
        // when
        // fetching imports as list of OtpErlangTuple
        final Collection<IErlElement> children = moduleA.getChildren();
        final Collection<IErlImport> imports2 = moduleA.getImports();
        final List<OtpErlangObject> imports = modelUtilService.getImportsAsList(moduleA);
View Full Code Here

        // final IErlModule moduleC =
        // createErlModule(projects[1],
        // "c.erl", "-module(c).\n-type cc() :: b:concat_thing().\n");
        final ScannerService scanner = moduleB.getScanner();
        try {
            moduleB.open(null);
            project1.open(null);
            // moduleC.open(null);
            // when
            // looking for it
            // within project
View Full Code Here

    public void findExternalFunctionModuleTest() throws Exception {
        // given
        // a module with functions and functions
        final IErlModule moduleD = createModule(project1, "d.erl",
                "-module(d).\n-export([f/0]).\nf() ->\n    ok.\ng() ->\n    ?MODULE:f().\n");
        moduleD.open(null);
        // when
        // looking for it with ?MODULE
        final IErlElementLocator model = ErlangEngine.getInstance().getModel();
        final IErlElement element1 = modelFindService.findFunction(model, project1,
                moduleD, "?MODULE", null, new ErlangFunction("f", 0),
View Full Code Here

        final IErlModule module = createModule(
                project,
                "f.erl",
                "-module(f).\n-include(\"a.hrl\").\n-export([f/0]).\n-record(rec2, {a, b}).\n"
                        + "f() ->\n    lists:reverse([1, 0]),\n    lists:reverse([1, 0], [2]).\n");
        module.open(null);
        project.open(null);
        final IErlPreprocessorDef preprocessorDef1 = modelFindService
                .findPreprocessorDef(module, "rec1", ErlElementKind.RECORD_DEF);
        final IErlPreprocessorDef preprocessorDef2 = modelFindService
                .findPreprocessorDef(include, "rec1", ErlElementKind.RECORD_DEF);
View Full Code Here

        final IErlModule module = createModule(
                project,
                "g.erl",
                "-module(g).\n-include_lib(\"kernel/include/file.hrl\").\n-export([f/0]).\n-record(rec2, {a, b}).\n"
                        + "f() ->\n    lists:reverse([1, 0]),\n    lists:reverse([1, 0], [2]).\n");
        module.open(null);
        // when
        // looking for the record
        final IErlPreprocessorDef preprocessorDef = modelFindService.findPreprocessorDef(
                module, "file_info", ErlElementKind.RECORD_DEF);
        // then
View Full Code Here

        final IErlProject project = project1;
        final IErlModule module = createModule(project, "a.erl", "-module(g).\n"
                + "-include_lib(\"kernel/include/file.hrl\").\n" + "-export([f/0]).\n"
                + "-define(A(B), '++B++').\n" + "-record(rec2, {a, b}).\n" + "f() ->\n"
                + "    lists:reverse([1, 0]),\n" + "    lists:reverse([1, 0], [2]).\n");
        module.open(null);
        final List<IErlPreprocessorDef> macroDefs = modelUtilService
                .getAllPreprocessorDefs(module, ErlElementKind.MACRO_DEF);
        final List<IErlPreprocessorDef> recordDefs = modelUtilService
                .getAllPreprocessorDefs(module, ErlElementKind.RECORD_DEF);
        assertEquals(2, macroDefs.size());
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.