Package org.erlide.engine.model.root

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


    public void getSourceRange() throws Exception {
        module = createModule(project, "sourcerange.erl",
                "-module(sourcerange). -include(\"yy.hrl\"). f(A) ->  lists:reverse(A). ");
        module.open(null);

        final IErlElement element = module.getElementAt(0);
        final ISourceReference sourceReference = (ISourceReference) element;
        final ISourceRange sourceRange = sourceReference.getSourceRange();
        assertEquals(0, sourceRange.getOffset());

        final IErlElement element2 = module.getElementAt(25);
        final ISourceReference sourceReference2 = (ISourceReference) element2;
        final ISourceRange sourceRange2 = sourceReference2.getSourceRange();
        assertEquals(22, sourceRange2.getOffset());
    }
View Full Code Here


    // public int getLineEnd();
    @Test
    public void getLineX() throws Exception {
        module.open(null);

        final IErlElement element = module.getElementAtLine(0);
        final ISourceReference sourceReference = (ISourceReference) element;
        assertEquals(0, sourceReference.getLineStart());
        assertEquals(0, sourceReference.getLineEnd());

        final IErlElement element2 = module.getElementAtLine(1);
        final ISourceReference sourceReference2 = (ISourceReference) element2;
        assertEquals(1, sourceReference2.getLineStart());
        assertEquals(1, sourceReference2.getLineEnd());
    }
View Full Code Here

    public static IEditorPart isOpenInEditor(final Object inputElement) {
        final Collection<IEditorPart> allErlangEditors = EditorUtility
                .getAllErlangEditors();
        for (final IEditorPart editorPart : allErlangEditors) {
            if (inputElement instanceof IErlElement) {
                final IErlElement element = (IErlElement) inputElement;
                final IErlModule module = ErlangEngine.getInstance()
                        .getModelUtilService().getModule(element);
                final AbstractErlangEditor editor = (AbstractErlangEditor) editorPart;
                if (module.equals(editor.getModule())) {
                    return editorPart;
View Full Code Here

            if (parentElement instanceof IErlModule) {
                return erlangFileContentProvider.getChildren(parentElement);
            }
            if (parentElement instanceof IErlElement) {
                if (parentElement instanceof IErlElement) {
                    final IErlElement ErlElement = (IErlElement) parentElement;
                    ErlElement.open(null);
                }
                final IErlElement parent = (IErlElement) parentElement;
                final Collection<IErlElement> children = parent.getChildrenOfKind(
                        ErlElementKind.EXTERNAL_ROOT, ErlElementKind.EXTERNAL_APP,
                        ErlElementKind.EXTERNAL_FOLDER);
                return children.toArray();
            }
        } catch (final ErlModelException e) {
View Full Code Here

    }

    @Override
    public Object getParent(final Object element) {
        if (element instanceof IErlElement) {
            final IErlElement elt = (IErlElement) element;
            IErlElement parent = elt.getParent();
            final String filePath = elt.getFilePath();
            if (parent == ErlangEngine.getInstance().getModel() && filePath != null) {
                parent = elt.getParent();
            }
            if (parent instanceof IErlModule) {
View Full Code Here

                // we know these have children
                return true;
            }
            final Stopwatch clock = Stopwatch.createStarted();
            if (element instanceof IErlElement) {
                final IErlElement ErlElement = (IErlElement) element;
                try {
                    ErlElement.open(null);
                } catch (final ErlModelException e) {
                }
            }
            final IErlElement parent = (IErlElement) element;
            final boolean result = parent.hasChildrenOfKind(ErlElementKind.EXTERNAL_ROOT,
                    ErlElementKind.EXTERNAL_APP, ErlElementKind.EXTERNAL_FOLDER,
                    ErlElementKind.MODULE);
            if (clock.elapsed(TimeUnit.MILLISECONDS) > 100) {
                ErlLogger.debug("TIME open " + element.getClass() + " " + element + "  "
                        + clock.elapsed(TimeUnit.MILLISECONDS) + " ms");
View Full Code Here

                    .findFunction(model, project, moduleE, eres.getMod(), eres.getPath(),
                            new ErlangFunction(eres.getFun(), eres.getArity()),
                            IErlElementLocator.Scope.PROJECT_ONLY);
            assertNotNull(function);

            final IErlElement module = model.findModuleFromProject(project,
                    function.getModuleName(), eres.getPath(),
                    IErlElementLocator.Scope.PROJECT_ONLY);
            // then
            // the function should be returned and the module, in External Files
            assertNotNull(module);
View Full Code Here

      _and = false;
    } else {
      _and = (offset != (-1));
    }
    if (_and) {
      final IErlElement e = module.getElementAt(offset);
      boolean _and_1 = false;
      boolean _tripleNotEquals_1 = (e != null);
      if (!_tripleNotEquals_1) {
        _and_1 = false;
      } else {
        boolean _or = false;
        ErlElementKind _kind = e.getKind();
        boolean _equals = Objects.equal(_kind, ErlElementKind.TYPESPEC);
        if (_equals) {
          _or = true;
        } else {
          ErlElementKind _kind_1 = e.getKind();
          boolean _equals_1 = Objects.equal(_kind_1, ErlElementKind.RECORD_DEF);
          _or = _equals_1;
        }
        _and_1 = _or;
      }
View Full Code Here

    boolean _tripleNotEquals = (module != null);
    if (_tripleNotEquals) {
      String _moduleName = module.getModuleName();
      moduleName = _moduleName;
      if ((offset != (-1))) {
        final IErlElement e = module.getElementAt(offset);
        OpenUtils _openUtils = new OpenUtils();
        boolean _isTypeDefOrRecordDef = _openUtils.isTypeDefOrRecordDef(res, e);
        if (_isTypeDefOrRecordDef) {
          String _fun = res.getFun();
          return new TypeRefPattern(moduleName, _fun, limitTo);
View Full Code Here

 
  protected static ErlangSearchPattern _getSearchPatternFromOpenResultAndLimitTo(final VariableOpenResult res, final IErlModule module, final int offset, final LimitTo limitTo, final boolean matchAnyFunctionDefinition) throws ErlModelException {
    boolean _tripleNotEquals = (module != null);
    if (_tripleNotEquals) {
      if ((offset != (-1))) {
        final IErlElement e = module.getElementAt(offset);
        if ((e instanceof IErlFunctionClause)) {
          String _functionName = ((IErlFunctionClause)e).getFunctionName();
          int _arity = ((IErlFunctionClause)e).getArity();
          String _head = ((IErlFunctionClause)e).getHead();
          String _name = res.getName();
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.