Examples of PsiMethod


Examples of com.intellij.psi.PsiMethod

      builder.append(' ');
      builder.append(methodName);
      builder.append("()");
      builder.append("{ return this.").append(fieldName).append("; }");

      PsiMethod getterMethod = elementFactory.createMethodFromText(builder.toString(), psiClass);
      return prepareMethod(manager, getterMethod, psiClass, psiField);
    } finally {
      StringBuilderSpinAllocator.dispose(builder);
    }
  }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

    if (!hasMethodByName(classMethods, METHOD_NAME)) {
      Project project = psiClass.getProject();
      PsiManager manager = psiClass.getContainingFile().getManager();
      PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();

      PsiMethod toStringMethod = prepareMethod(manager, createToStringMethod(psiClass, elementFactory), psiClass, psiAnnotation);
      target.add((Psi) toStringMethod);

      Collection<PsiField> toStringFields = filterFieldsByModifiers(psiClass.getFields(), PsiModifier.STATIC);
      UserMapKeys.addReadUsageFor(toStringFields);
    } else {
View Full Code Here

Examples of com.intellij.psi.PsiMethod

  @NotNull
  public static PsiMethod createMethod(@NotNull PsiClass psiClass, @NotNull String methodText, @NotNull PsiElement navigationTarget) {
    PsiManager manager = psiClass.getContainingFile().getManager();
    PsiElementFactory elementFactory = JavaPsiFacade.getInstance(psiClass.getProject()).getElementFactory();

    PsiMethod method = elementFactory.createMethodFromText(methodText, psiClass);

    LightMethod lightMethod = new MyLightMethod(manager, method, psiClass);
    lightMethod.setNavigationElement(navigationTarget);
    return lightMethod;
  }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

    final String type2Text = type2.getCanonicalText();
    return type1Text.equals(type2Text);
  }

  public static boolean methodMatches(@NotNull Pair<PsiMethod, PsiSubstitutor> firstPair, @NotNull Pair<PsiMethod, PsiSubstitutor> secondPair) {
    final PsiMethod firstMethod = firstPair.getFirst();
    final PsiMethod secondMethod = secondPair.getFirst();
    if (!firstMethod.getName().equals(secondMethod.getName())) {
      return false;
    }

    PsiParameterList firstMethodParameterList = firstMethod.getParameterList();
    PsiParameterList secondMethodParameterList = secondMethod.getParameterList();
    if (firstMethodParameterList.getParametersCount() != secondMethodParameterList.getParametersCount()) {
      return false;
    }

    PsiParameter[] firstMethodParameterListParameters = firstMethodParameterList.getParameters();
View Full Code Here

Examples of com.intellij.psi.PsiMethod

    final PsiReference[] references = createReferences(value, value.getXmlAttributeValue(), convertContext);
    final ArrayList<BeanProperty> list = new ArrayList<BeanProperty>(references.length);
    for (final PsiReference reference : references) {
      final PsiElement resolve = reference.resolve();
      if (resolve instanceof PsiMethod) { // can be non-PsiMethod via ParamNameCustomConverter
        final PsiMethod method = (PsiMethod)resolve;
        final BeanProperty beanProperty = BeanProperty.createBeanProperty(method);
        ContainerUtil.addIfNotNull(beanProperty, list);
      }
    }
    return list;
View Full Code Here

Examples of com.intellij.psi.PsiMethod

    @Nullable
    @Override
    public PsiElement resolve() {
      for (BeanPropertyPathReference[] reference : allReferences) {
        for (BeanPropertyPathReference pathReference : reference) {
          final PsiMethod resolve = pathReference.resolve();
          if (resolve != null) {
            return resolve;
          }
        }
      }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

          final PsiClass actionClass = action.searchActionClass();
          if (actionClass == null) {
            continue;
          }

          final PsiMethod actionMethod = action.searchActionMethod();
          items.add(new GotoRelatedItem(actionMethod != null ? actionMethod : actionClass));
        }

        return true;
      }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

      @Override
      public GrReferenceExpression compute() {
        final GrExpression ref = stepDefinition.getInvokedExpression();
        if (!(ref instanceof GrReferenceExpression)) return null;

        final PsiMethod method = stepDefinition.resolveMethod();
        if (method == null) return null;

        final PsiClass containingClass = method.getContainingClass();
        if (containingClass == null) return null;

        final String qName = containingClass.getQualifiedName();
        if (qName == null) return null;
View Full Code Here

Examples of com.intellij.psi.PsiMethod

      }
    });
  }

  public static boolean isHook(GrMethodCall methodCall) {
    PsiMethod method = methodCall.resolveMethod();
    if (method instanceof PsiMirrorElement) {
      final PsiElement prototype = ((PsiMirrorElement)method).getPrototype();
      if (!(prototype instanceof PsiMethod)) return false;

      method = (PsiMethod)prototype;
    }

    if (method == null) return false;

    if (!ArrayUtil.contains(method.getName(), HOOKS)) return false;

    PsiClass containingClass = method.getContainingClass();
    if (containingClass == null) return false;

    return GrCucumberCommonClassNames.isHookClassName(containingClass.getQualifiedName());
  }
View Full Code Here

Examples of com.intellij.psi.PsiMethod

* Date: 7/27/12
*/
public class CucumberJavaMethodUsageSearcher extends QueryExecutorBase<PsiReference, MethodReferencesSearch.SearchParameters> {
  @Override
  public void processQuery(@NotNull final MethodReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
    final PsiMethod method = p.getMethod();

    final String regexp = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      @Override
      public String compute() {
        final PsiAnnotation stepAnnotation = CucumberJavaUtil.getCucumberStepAnnotation(method);
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.