Package org.jetbrains.plugins.clojure.psi.api

Examples of org.jetbrains.plugins.clojure.psi.api.ClListLike


    final String suffix = name.substring(lastDot + 1);

    final ClListLike[] imported = PsiTreeUtil.getChildrenOfType(importClause, ClListLike.class);

    // Find or create an import member
    ClListLike importMember = null;
    if (imported == null) {
      importMember = addFreshImportToMember(importClause, prefix);
    } else {
      importMember = ContainerUtil.find(imported, new Condition<ClListLike>() {
        public boolean value(ClListLike elem) {
          return prefix.equals(elem.getHeadText());
        }
      });
      if (importMember == null) {
        importMember = addFreshImportToMember(importClause, prefix);
      }
    }

    assert importMember != null;

    // Insert a new class into it
    final PsiElement lastChild = importMember.getLastChild();
    final PsiElement newClass = createSymbolNodeFromText(suffix).getPsi();
    assert newClass != null;
    if (lastChild instanceof  LeafPsiElement) {
      importMember.addBefore(newClass, lastChild);
    } else {
      importMember.add(newClass);
    }

    return importMember;
  }
View Full Code Here


    return importMember;
  }

  private ClListLike addFreshImportToMember(ClList importClause, String prefix) {
    final ClListLike vector = createVectorFromText(prefix);
    final PsiElement lastChild = importClause.getLastChild();
    if (lastChild instanceof LeafPsiElement) {
      return (ClListLike) importClause.addBefore(vector, lastChild);
    } else {
      return (ClListLike) importClause.add(vector);
View Full Code Here

TOP

Related Classes of org.jetbrains.plugins.clojure.psi.api.ClListLike

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.