Examples of PsiMethod


Examples of com.intellij.psi.PsiMethod

   */
  @Nullable @Override
  public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
    // Check methods first (includes constructors).
    if (element instanceof PsiMethod) {
      PsiMethod methodElement = (PsiMethod) element;

      // Does it have an @Provides?
      if (hasAnnotation(element, CLASS_PROVIDES)) {
        PsiTypeElement returnTypeElement = methodElement.getReturnTypeElement();
        if (returnTypeElement != null) {
          return new LineMarkerInfo<PsiElement>(element, returnTypeElement.getTextRange(), ICON,
              UPDATE_ALL, null, new ProvidesToInjectHandler(), LEFT);
        }
      }

      // Is it an @Inject-able constructor?
      if (methodElement.isConstructor() && hasAnnotation(element, CLASS_INJECT)) {
        return new LineMarkerInfo<PsiElement>(element, element.getTextRange(), ICON,
            UPDATE_ALL, null, new ConstructorInjectToInjectionPlaceHandler(), LEFT);
      }
    }

View Full Code Here

Examples of com.intellij.psi.PsiMethod

  @Override public void navigate(MouseEvent mouseEvent, PsiElement psiElement) {
    if (!(psiElement instanceof PsiMethod)) {
      throw new IllegalStateException("Called with non-method: " + psiElement);
    }

    PsiMethod psiMethod = (PsiMethod) psiElement;
    PsiClass psiClass = PsiConsultantImpl.getReturnClassFromMethod(psiMethod);

    new ShowUsagesAction(new Decider.ProvidesMethodDecider(psiMethod)).startFindUsages(psiClass,
        new RelativePoint(mouseEvent), PsiUtilBase.findEditor(psiClass), MAX_USAGES);
  }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

  @Override public void navigate(final MouseEvent mouseEvent, PsiElement psiElement) {
    if (!(psiElement instanceof PsiMethod)) {
      throw new IllegalStateException("Called with non-method: " + psiElement);
    }

    PsiMethod psiMethod = (PsiMethod) psiElement;
    if (!psiMethod.isConstructor()) {
      throw new IllegalStateException("Called with non-constructor: " + psiElement);
    }

    PsiParameter[] parameters = psiMethod.getParameterList().getParameters();
    if (parameters.length == 1) {
      showUsages(mouseEvent, parameters[0]);
    } else {
      new PickTypeAction().startPickTypes(new RelativePoint(mouseEvent), parameters,
          new PickTypeAction.Callback() {
View Full Code Here

Examples of com.intellij.psi.PsiMethod

  @Override public void navigate(MouseEvent mouseEvent, PsiElement psiElement) {
    if (!(psiElement instanceof PsiMethod)) {
      throw new IllegalStateException("Called with non-method: " + psiElement);
    }

    PsiMethod psiMethod = (PsiMethod) psiElement;
    PsiClass psiClass = PsiConsultantImpl.getClass(psiElement);

    new ShowUsagesAction(new Decider.ProvidesMethodDecider(psiMethod)).startFindUsages(psiClass,
        new RelativePoint(mouseEvent), PsiUtilBase.findEditor(psiClass), MAX_USAGES);
  }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

   */
  @Nullable @Override
  public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
    // Check methods first (includes constructors).
    if (element instanceof PsiMethod) {
      PsiMethod methodElement = (PsiMethod) element;

      // Constructor injection.
      if (methodElement.isConstructor() && PsiConsultantImpl.hasAnnotation(element, CLASS_INJECT)) {
        PsiIdentifier nameIdentifier = methodElement.getNameIdentifier();
        if (nameIdentifier != null) {
          return new LineMarkerInfo<PsiElement>(element, nameIdentifier.getTextRange(), ICON,
              UPDATE_ALL, null, new ConstructorInjectToProvidesHandler(), LEFT);
        }
      }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

          && PsiConsultantImpl.hasAnnotation(field, CLASS_INJECT) //
          && PsiConsultantImpl.hasQuailifierAnnotations(field, qualifierAnnotations)) {
        return true;
      }

      PsiMethod method = PsiConsultantImpl.findMethod(element);
      if (method != null && PsiConsultantImpl.hasAnnotation(method, CLASS_INJECT)) {
        PsiParameter[] parameters = method.getParameterList().getParameters();
        for (PsiParameter parameter : parameters) {
          PsiClass parameterClass = PsiConsultantImpl.checkForLazyOrProvider(parameter);
          if (parameterClass.equals(returnType) && PsiConsultantImpl.hasQuailifierAnnotations(
              parameter, qualifierAnnotations)) {
            return true;
View Full Code Here

Examples of com.intellij.psi.PsiMethod

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

      // Is it a @Provides method?
      PsiMethod psimethod = PsiConsultantImpl.findMethod(element);
      return psimethod != null
          // Ensure it has an @Provides.
          && PsiConsultantImpl.hasAnnotation(psimethod, CLASS_PROVIDES)

          // Check for Qualifier annotations.
View Full Code Here

Examples of com.intellij.psi.PsiMethod

  @Override
  public boolean isImplicitUsage(PsiElement psiElement) {
    if (!(psiElement instanceof PsiMethod))
      return false;

    PsiMethod method = (PsiMethod) psiElement;
    return isAnnotatedWithSubscriber(method) || isAnnotatedWithProducer(method);
  }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

    if (!candidate.getName().equals("post")) {
      return false;
    }

    for (SubscriberMetadata subscriber : subscribers) {
      PsiMethod busPostMethod = subscriber.getBusPostMethod(project);
      if (candidate.equals(busPostMethod)) {
        return true;
      }
    }
    return false;
View Full Code Here

Examples of com.intellij.psi.PsiMethod

        }
      };

  @Nullable @Override public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
    if (element instanceof PsiMethod) {
      PsiMethod psiMethod = (PsiMethod) element;
      SubscriberMetadata subscriberMetadata = SubscriberMetadata.getSubscriberMetadata(psiMethod);
      if (subscriberMetadata != null) {
        PsiTypeElement methodParameter = getMethodParameter(psiMethod);
        if (methodParameter != null) {
          return new LineMarkerInfo<PsiElement>(psiMethod, methodParameter.getTextRange(), ICON,
              Pass.UPDATE_ALL, null, SHOW_INSTANTIATIONS_AND_PRODUCERS,
              GutterIconRenderer.Alignment.LEFT);
        }
      }

      if (SubscriberMetadata.isAnnotatedWithProducer(psiMethod)) {
        return new LineMarkerInfo<PsiElement>(psiMethod, psiMethod.getTextRange(), ICON,
            Pass.UPDATE_ALL, null, SHOW_SUBSCRIBERS_FROM_PRODUCERS,
            GutterIconRenderer.Alignment.LEFT);
      }
    } else if (element instanceof PsiClass) {
      PsiClass psiClass = (PsiClass) element;
      String qualifiedName = psiClass.getQualifiedName();
      if (qualifiedName != null) {
        OttoProjectHandler ottoProjectHandler = OttoProjectHandler.get(element.getProject());
        if (ottoProjectHandler.isEventClass(qualifiedName)) {
          PsiIdentifier nameIdentifier = psiClass.getNameIdentifier();
          if (nameIdentifier != null) {
            return new LineMarkerInfo<PsiClass>(psiClass, nameIdentifier.getTextRange(), ICON,
                Pass.UPDATE_ALL, null, SHOW_ALL, GutterIconRenderer.Alignment.LEFT);
          }
        }
      }
    } else if (element instanceof PsiMethodCallExpression) {
      PsiMethodCallExpression expression = (PsiMethodCallExpression) element;
      PsiMethod psiMethod = expression.resolveMethod();
      if (psiMethod != null) {
        if (SubscriberMetadata.isBusPostMethod(psiMethod, element.getProject())) {
          PsiType[] expressionTypes = expression.getArgumentList().getExpressionTypes();
          if (expressionTypes.length > 0) {
            PsiClass eventClass = PsiConsultantImpl.getClass(expressionTypes[0]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.