Package org.erlide.engine.model.root

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


    // void removeChild(IErlElement e);
    @Test
    public void removeChild() throws Exception {
        module.open(null);
        final int childCount = module.getChildCount();
        final IErlElement element = module.getChildrenOfKind(ErlElementKind.ATTRIBUTE)
                .iterator().next();
        final IErlElement childNamed = module.getChildNamed(element.getName());
        module.removeChild(element);
        final int childCount2 = module.getChildCount();
        final IErlElement childNamed2 = module.getChildNamed(element.getName());
        assertEquals(childCount - 1, childCount2);
        assertNotNull(childNamed);
        assertNull(childNamed2);
    }
View Full Code Here


    @Test
    public void hasFunction() throws Exception {
        module.open(null);
        final List<IErlElement> childrenOfKind = module2
                .getChildrenOfKind(ErlElementKind.EXPORT);
        final IErlElement element = childrenOfKind.get(0);
        final IErlExport export = (IErlExport) element;
        assertTrue(export.hasFunction(functionA.getFunction()));
        assertTrue(export.hasFunction(functionB.getFunction()));
        assertFalse(export.hasFunction(functionC.getFunction()));
    }
View Full Code Here

        return null;
    }

    private static IEditorInput getEditorInput(final IErlElement element0) {
        IErlElement element = element0;
        final IResource resource = element.getResource();
        if (resource instanceof IFile) {
            IFile file = (IFile) resource;
            file = resolveFile(file);
            return new FileEditorInput(file);
        }
        String filePath = element.getFilePath();
        while (filePath == null) {
            final IErlElement parent = element.getParent();
            if (parent != null) {
                element = parent;
                filePath = element.getFilePath();
            } else {
                break;
View Full Code Here

    @Before
    public void set_up() throws Exception {
        final IErlModule module2 = createModule(project, "zz6.erl",
                "-module(zz6). f() -> ok.\n");
        module2.open(null);
        final IErlElement element = module2.getElementAt(1);
        final IErlAttribute attribute = (IErlAttribute) element;
        sourceRange = attribute.getSourceRange();
        final IErlElement element2 = module2.getElementAt(18);
        final IErlFunction function = (IErlFunction) element2;
        sourceRange2 = function.getSourceRange();
    }
View Full Code Here

                + "return_error(Line, Message) ->\n"
                + "    throw({error, {Line, ?MODULE, Message}}).");
        module2.open(null);
        final List<IErlElement> childrenOfKind = module2
                .getChildrenOfKind(ErlElementKind.TYPESPEC);
        final IErlElement element = childrenOfKind.get(0);
        final IErlTypespec typespec = (IErlTypespec) element;
        assertEquals("return_error", typespec.getName());
    }
View Full Code Here

    public static class ListLabelProvider extends LabelProvider {

        @Override
        public String getText(final Object element) {
            if (element instanceof IErlElement) {
                final IErlElement erlElement = (IErlElement) element;
                return erlElement.getName();
            }
            return "!" + super.getText(element);
        }
View Full Code Here

            final IErlModule module = erlangEditor.getModule();
            if (module != null) {
                final int offset1 = selection.getOffset(), offset2 = offset1
                        + selection.getLength();
                try {
                    final IErlElement e1 = module.getElementAt(offset1);
                    final IErlElement e2 = module.getElementAt(offset2);
                    if (e1 instanceof ISourceReference) {
                        final ISourceReference ref1 = (ISourceReference) e1;
                        final ISourceRange r1 = ref1.getSourceRange();
                        final int offset = r1.getOffset();
                        int length = r1.getLength();
View Full Code Here

    // IErlElement getElementAt(int position) throws ErlModelException;
    @Test
    public void getElementAt() throws Exception {
        module.open(null);
        final IErlElement element = module.getElementAt(0);
        final IErlElement element1 = module.getElementAt(14);
        final IErlElement element2 = module.getElementAt(1000);
        final IErlElement element3 = module.getElementAt(50);
        assertNotNull(element);
        assertNotNull(element1);
        assertTrue(element instanceof IErlAttribute);
        assertTrue(element1 instanceof IErlAttribute);
        assertEquals("include: \"yy.hrl\"", element1.toString());
View Full Code Here

    // IErlElement getElementAtLine(int lineNumber);
    @Test
    public void getElementAtLine() throws Exception {
        module.open(null);
        final IErlElement element = module.getElementAtLine(0);
        final IErlElement element1 = module.getElementAtLine(1);
        final IErlElement element2 = module.getElementAtLine(4);
        final IErlElement element3 = module.getElementAtLine(3);
        assertNotNull(element);
        assertNotNull(element1);
        assertTrue(element instanceof IErlAttribute);
        assertTrue(element1 instanceof IErlAttribute);
        assertEquals("include: \"yy.hrl\"", element1.toString());
View Full Code Here

            return;
        }
        final int offset = c.offset;
        String txt = null;
        editor.reconcileNow();
        final IErlElement element = editor.getElementAt(offset, false);
        final IErlMember member = (IErlMember) element;
        if (member != null) {
            final int start = member.getSourceRange().getOffset();
            if (offset >= start) {
                txt = d.get(start, offset - start);
View Full Code Here

TOP

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

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.