Package com.intellij.psi

Examples of com.intellij.psi.PsiElement


    return getFirstChild();
  }

  @Override
  public boolean matchesHead(final String head) {
    PsiElement myHead = getHead();
    if (myHead != null) {
      return myHead.getText().matches(head);
    }
    return false;
  }
View Full Code Here


    return (LocalizationConstruct.ConstructType) getUserData(myScopeKey);
  }

  private void cacheScopingConstruct() {
    if (myIsUpToDate) return;
    PsiElement head = getFirstChild();
    if (head instanceof Symbol) {
      cacheScopingConstruct(((Symbol) head).getSymbolName());
    } else {
      putUserData(myScopeKey, LocalizationConstruct.ConstructType.NULL);
    }
View Full Code Here

  }

  @Nullable
  @Override
  public Icon getIcon(@IconFlags int flags) {
    PsiElement openStacheElem = getFirstChild();
    if (openStacheElem == null) {
      return null;
    }

    if (openStacheElem.getNode().getElementType() == HbTokenTypes.OPEN_UNESCAPED) {
      return HbIcons.OPEN_UNESCAPED;
    }

    return HbIcons.OPEN_MUSTACHE;
  }
View Full Code Here

    super(astNode);
  }

  @Override
  public HbCloseBlockMustache getPairedElement() {
    PsiElement closeBlockElement = getParent().getLastChild();
    if (closeBlockElement instanceof HbCloseBlockMustache) {
      return (HbCloseBlockMustache)closeBlockElement;
    }

    return null;
View Full Code Here

    if (provider instanceof HbFileViewProvider) {
      if (HbConfig.isAutocompleteMustachesEnabled() && c == '}' && !previousChar.equals("}")) {
        // we may be able to complete the second brace
        PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
        PsiElement elementAt = provider.findElementAt(offset - 1, HbLanguage.class);
        ASTNode node = elementAt != null ? elementAt.getNode() : null;
        if (node != null && node.getElementType() == HbTokenTypes.INVALID) {
          // we should be looking at the beginning of a close brace.  Find its matching open brace and auto-complete based on its type
          PsiElement mustache = PsiTreeUtil.findFirstParent(elementAt, new Condition<PsiElement>() {
            @Override
            public boolean value(PsiElement psiElement) {
              return psiElement instanceof HbMustache;
            }
          });

          if (mustache != null) {
            String braceCompleter;

            if (mustache.getFirstChild().getNode().getElementType() == HbTokenTypes.OPEN_UNESCAPED) {
              // add "}}" to complete the CLOSE_UNESCAPED
              braceCompleter = "}}";
            } else {
              // add "}" to complete the CLOSE
              braceCompleter = "}";
View Full Code Here

      return;
    }

    PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());

    PsiElement elementAtCaret = provider.findElementAt(offset - 1, HbLanguage.class);

    if (elementAtCaret == null || elementAtCaret.getNode().getElementType() != HbTokenTypes.CLOSE) {
      return;
    }

    HbOpenBlockMustache openTag = HbPsiUtil.findParentOpenTagElement(elementAtCaret);
View Full Code Here

    if (!HbConfig.isFormattingEnabled()) {
      // formatting disabled; nothing to do
      return;
    }

    PsiElement elementAtCaret = provider.findElementAt(offset - 1, HbLanguage.class);
    PsiElement closeOrSimpleInverseParent = PsiTreeUtil.findFirstParent(elementAtCaret, true, new Condition<PsiElement>() {
      @Override
      public boolean value(PsiElement element) {
        return element != null
               && (element instanceof HbSimpleInverse
                   || element instanceof HbCloseBlockMustache);
View Full Code Here

      this.returnType = PsiConsultantImpl.getReturnClassFromMethod(psiMethod);
      this.qualifierAnnotations = PsiConsultantImpl.getQualifierAnnotations(psiMethod);
    }

    @Override public boolean shouldShow(UsageTarget target, Usage usage) {
      PsiElement element = ((UsageInfo2UsageAdapter) usage).getElement();

      PsiField field = PsiConsultantImpl.findField(element);
      if (field != null //
          && PsiConsultantImpl.hasAnnotation(field, CLASS_INJECT) //
          && PsiConsultantImpl.hasQuailifierAnnotations(field, qualifierAnnotations)) {
View Full Code Here

    public IsAProviderDecider(Set<String> qualifierAnnotations) {
      this.qualifierAnnotations = qualifierAnnotations;
    }

    @Override public boolean shouldShow(UsageTarget target, Usage usage) {
      PsiElement element = ((UsageInfo2UsageAdapter) usage).getElement();

      // Is it a constructor annotated w/ @Inject?
      // I don't even know how to get to the constructor!

      // Is it a @Provides method?
View Full Code Here

          startFindUsages(element, popupPosition, editor, USAGES_PAGE_SIZE);
          return false;
        }
      });
    } else {
      PsiElement element = ((PsiElementUsageTarget) usageTargets[0]).getElement();
      if (element != null) {
        startFindUsages(element, popupPosition, editor, USAGES_PAGE_SIZE);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiElement

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.