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

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


  public ClNs findOrCreateNamespaceElement() throws IncorrectOperationException {
    final ClNs ns = getNamespaceElement();
    if (ns != null) return ns;
    commitDocument();
    final ClojurePsiFactory factory = ClojurePsiFactory.getInstance(getProject());
    final ClList nsList = factory.createListFromText(ListDeclarations.NS + " " + getName());
    final PsiElement anchor = getFirstChild();
    if (anchor != null) {
      return (ClNs)addBefore(nsList, anchor);
    } else {
      return (ClNs)add (nsList);
View Full Code Here


        }
        final PsiElement parent = element.getParent();
        if (parent instanceof ClojureFile) {
          while (element != null) {
            if (element instanceof ClList) {
              ClList list = (ClList) element;
              final ClSymbol first = list.getFirstSymbol();
              if (first != null && first.getText().equals("ns")) {
                final ClSymbol snd = PsiTreeUtil.getNextSiblingOfType(first, ClSymbol.class);
                if (snd != null) {
                  stringRef.set(snd.getText());
                  return;
View Full Code Here

  @Nullable
  public static ClList findFormByName(ClojurePsiElement container, @NotNull String name) {
    for (PsiElement element : container.getChildren()) {
      if (element instanceof ClList) {
        ClList list = (ClList) element;
        final ClSymbol first = list.getFirstSymbol();
        if (first != null && name.equals(first.getNameString())) {
          return list;
        }
      }
    }
View Full Code Here

  @Nullable
  public static ClList findFormByNameSet(ClojurePsiElement container, @NotNull Set<String> names) {
    for (PsiElement element : container.getChildren()) {
      if (element instanceof ClList) {
        ClList list = (ClList) element;
        final ClSymbol first = list.getFirstSymbol();
        if (first != null && names.contains(first.getNameString())) {
          return list;
        }
      }
    }
View Full Code Here

    }
    return null;
  }

  public static ClKeywordImpl findNamespaceKeyByName(ClList ns, String keyName) {
    final ClList list = ns.findFirstChildByClass(ClList.class);
    if (list == null) return null;
    for (PsiElement element : list.getChildren()) {
      if (element instanceof ClKeywordImpl) {
        ClKeywordImpl key = (ClKeywordImpl) element;
        if (keyName.equals(key.getText())) {
          return key;
        }
View Full Code Here

    Document document = editor.getDocument();
    PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document);
    if (file == null) { return null; }

    PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
    ClList sexp = null;
    while (element != null) {
      if (element instanceof ClList) { sexp = (ClList) element; }
      element = element.getParent();
    }
    return sexp;
View Full Code Here

TOP

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

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.