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

Examples of org.jetbrains.plugins.clojure.psi.api.symbols.ClSymbol


    }
    return null;
  }

  public String getDefinedName() {
    ClSymbol sym = getNameSymbol();
    if (sym != null) {
      String name = sym.getText();
      assert name != null;
      return name;
    }
    return "";
  }
View Full Code Here


    ClNsStub stub = getStub();
    if (stub != null) {
      return stub.getTextOffset();
    }

    final ClSymbol symbol = getNameSymbol();
    if (symbol != null) {
      return symbol.getTextRange().getStartOffset();
    }
    return super.getTextOffset();
  }
View Full Code Here

  }

  @NotNull
  protected ClList addFreshImportClause() {
    commitDocument();
    final ClSymbol first = getFirstSymbol();
    final ClSymbol nsSymbol = getNameSymbol();
    final PsiElement preamble = findGenClassPreamble();

    final PsiElement anchor = (preamble != null ? preamble :
        nsSymbol != null ? nsSymbol : first);
    assert first != null;
View Full Code Here

  }

  @NotNull
  public String getDescriptiveName(@NotNull PsiElement element) {
    if (element instanceof ClSymbol) {
      ClSymbol symbol = (ClSymbol) element;
      final String name = symbol.getText();
      return name == null ? symbol.getText() : name;
    }
    if (element instanceof ClDef) {
      ClDef def = (ClDef) element;
      return def.getPresentationText();
    }
View Full Code Here

  }

  @NotNull
  public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
    if (element instanceof ClSymbol) {
      ClSymbol symbol = (ClSymbol) element;
      final String name = symbol.getReferenceName();
      return name == null ? symbol.getText() : name;
    }
    if (element instanceof ClDef) {
      ClDef def = (ClDef) element;
      return def.getDefinedName();
    }
View Full Code Here

      if (name != null) {
        RequestResultProcessor processor = new RequestResultProcessor() {
          @Override
          public boolean processTextOccurrence(@NotNull PsiElement element, int offsetInElement, @NotNull Processor<PsiReference> consumer) {
            if (element instanceof ClSymbol) {
              ClSymbol refSymbol = (ClSymbol) element;
              for (PsiReference ref : refSymbol.getReferences()) {
                if (ref.getRangeInElement().contains(offsetInElement) &&
                    // atom may refer to definition or to the symbol in it
                    (ref.resolve() == symbolToSearch ||
                        ref.resolve() == symbolToSearch.getParent())) {
                  if (!consumer.process(ref)) return false;
View Full Code Here

    final ClList ns = getNsElement();
    final ClKeywordImpl key = ClojurePsiUtil.findNamespaceKeyByName(ns, ClojureKeywords.EXTENDS);
    if (key != null) {
      final PsiElement next = ClojurePsiUtil.getNextNonWhiteSpace(key);
      if (next instanceof ClSymbol) {
        ClSymbol symbol = (ClSymbol) next;
        final PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(symbol.getText(), GlobalSearchScope.allScope(getProject()));
        return psiClass;
      }
    }
    return null;
  }
View Full Code Here

      final PsiElement next = ClojurePsiUtil.getNextNonWhiteSpace(key);
      if (next instanceof ClVector) {
        ClVector vector = (ClVector) next;
        for (PsiElement element : vector.getChildren()) {
          if (element instanceof ClSymbol) {
            ClSymbol symbol = (ClSymbol) element;
            final PsiClass clazz = facade.findClass(symbol.getText(), scope);
            if (clazz != nullclasses.add(clazz);
          }
        }
        return classes.toArray(PsiClass.EMPTY_ARRAY);
      }
View Full Code Here

    super(node);
  }

  @Nullable
  public String getPresentableText() {
    final ClSymbol first = findChildByClass(ClSymbol.class);
    if (first == null) return null;
    final String text1 = getHeadText();
    PsiElement next = PsiTreeUtil.getNextSiblingOfType(first, ClSymbol.class);
    if (next == null) return text1;
    else return text1 + " " + next.getText();
View Full Code Here

   */
  private static boolean processUseParent(PsiScopeProcessor processor, PsiElement place, String parentHead,
                                          PsiElement first, ResolveState state, PsiElement lastParent) {
    if ((USE.equals(parentHead) || ClojureKeywords.USE.equals(parentHead)) &&
        first instanceof ClSymbol) {
      final ClSymbol symbol = (ClSymbol) first;
      final ClSyntheticNamespace namespace = NamespaceUtil.getNamespace(symbol.getNameString(), place.getProject());
      return namespace == null? true : namespace.processDeclarations(processor, state, lastParent, place);
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of org.jetbrains.plugins.clojure.psi.api.symbols.ClSymbol

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.