コード例 #1
0
 private static PsiMethod[] findMethodsBySignature(
     GrTypeDefinition grType,
     PsiMethod patternMethod,
     boolean checkBases,
     boolean includeSynthetic) {
   ArrayList<PsiMethod> result = new ArrayList<PsiMethod>();
   final MethodSignature patternSignature = patternMethod.getSignature(PsiSubstitutor.EMPTY);
   for (PsiMethod method :
       findMethodsByName(grType, patternMethod.getName(), checkBases, includeSynthetic)) {
     MethodSignature signature = getSignatureForInheritor(method, grType);
     if (patternSignature.equals(signature)) {
       result.add(method);
     }
   }
   return result.toArray(new PsiMethod[result.size()]);
 }
コード例 #2
0
  @NotNull
  protected UsageInfo[] findUsages() {
    ArrayList<EncapsulateFieldUsageInfo> array = ContainerUtil.newArrayList();
    for (FieldDescriptor fieldDescriptor : myFieldDescriptors) {
      for (final PsiReference reference : ReferencesSearch.search(fieldDescriptor.getField())) {
        final PsiElement element = reference.getElement();
        if (element == null) continue;

        final EncapsulateFieldHelper helper =
            EncapsulateFieldHelper.getHelper(element.getLanguage());
        if (helper != null) {
          EncapsulateFieldUsageInfo usageInfo =
              helper.createUsage(myDescriptor, fieldDescriptor, reference);
          if (usageInfo != null) {
            array.add(usageInfo);
          }
        }
      }
    }
    EncapsulateFieldUsageInfo[] usageInfos =
        array.toArray(new EncapsulateFieldUsageInfo[array.size()]);
    return UsageViewUtil.removeDuplicatedUsages(usageInfos);
  }