Package com.intellij.psi

Examples of com.intellij.psi.PsiClass


    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


    if (!(psiElement instanceof PsiField)) {
      throw new IllegalStateException("Called with non-field element: " + psiElement);
    }

    PsiField psiField = (PsiField) psiElement;
    PsiClass injectedClass = PsiConsultantImpl.checkForLazyOrProvider(psiField);

    new ShowUsagesAction(new Decider.FieldInjectDecider(psiField)).startFindUsages(injectedClass,
        new RelativePoint(mouseEvent), PsiUtilBase.findEditor(injectedClass), MAX_USAGES);
  }
View Full Code Here

      if (modifierList != null) {
        for (PsiAnnotation psiAnnotation : modifierList.getAnnotations()) {
          if (psiAnnotation != null && psiAnnotation.getQualifiedName() != null) {
            JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(element.getProject());
            PsiClass psiClass = psiFacade.findClass(psiAnnotation.getQualifiedName(),
                GlobalSearchScope.projectScope(element.getProject()));

            if (hasAnnotation(psiClass, CLASS_QUALIFIER)) {
              qualifiedClasses.add(psiAnnotation.getQualifiedName());
            }
View Full Code Here

      return findField(element.getParent());
    }
  }

  public static PsiClass checkForLazyOrProvider(PsiField psiField) {
    PsiClass wrapperClass = PsiConsultantImpl.getClass(psiField);

    PsiType psiFieldType = psiField.getType();
    if (!(psiFieldType instanceof PsiClassType)) {
      return wrapperClass;
    }
View Full Code Here

    return getPsiClass(psiField, wrapperClass, psiFieldType);
  }

  public static PsiClass checkForLazyOrProvider(PsiParameter psiParameter) {
    PsiClass wrapperClass = PsiConsultantImpl.getClass(psiParameter);

    PsiType psiParameterType = psiParameter.getType();
    if (!(psiParameterType instanceof PsiClassType)) {
      return wrapperClass;
    }
View Full Code Here

    PsiClassType psiClassType = (PsiClassType) psiFieldType;
    Project project = psiElement.getProject();
    JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
    GlobalSearchScope globalSearchScope = GlobalSearchScope.allScope(project);

    PsiClass lazyClass = javaPsiFacade.findClass(CLASS_LAZY, globalSearchScope);
    PsiClass providerClass = javaPsiFacade.findClass(CLASS_PROVIDER, globalSearchScope);

    PsiClassType.ClassResolveResult classResolveResult = psiClassType.resolveGenerics();
    PsiClass outerClass = classResolveResult.getElement();

    // If Lazy<Foo> or Provider<Foo>, extract Foo as the interesting type.
    if (outerClass != null //
        && (outerClass.equals(lazyClass) || outerClass.equals(providerClass))) {
      PsiType genericType =
          classResolveResult.getSubstitutor().getSubstitutionMap().values().iterator().next();
      // Convert genericType to its PsiClass and store in psiClass
      wrapperClass = getClass(genericType);
    }
View Full Code Here

    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

            for (String annotation : annotations) {
              String trimmed = annotation.substring(annotation.lastIndexOf(".") + 1);
              builder.append("@").append(trimmed).append(" ");
            }

            PsiClass notLazyOrProvider = PsiConsultantImpl.checkForLazyOrProvider(value);
            return builder.append(notLazyOrProvider.getName()).toString();
          }

          @Override public PopupStep onChosen(PsiParameter selectedValue, boolean finalChoice) {
            callback.onParameterChosen(selectedValue);
            return super.onChosen(selectedValue, finalChoice);
View Full Code Here

      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

    }
  }

  private void performSearch(final SearchScope searchScope, final String subscribeClassName) {
    JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(myProject);
    PsiClass subscribePsiClass = javaPsiFacade.findClass(subscribeClassName,
        GlobalSearchScope.allScope(myProject));
    if (subscribePsiClass == null) {
      // the guava or otto library isn't available in this project so do nothing
      return;
    }
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiClass

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.