コード例 #1
0
 public MethodWrapper findMethodWrapper(IMethod method, Object[] methodWrappers) {
   MethodWrapper thirdLevelMethodWrapper = null;
   for (int i = 0; i < methodWrappers.length; i++) {
     if (method.equals(((MethodWrapper) methodWrappers[i]).getMember())) {
       thirdLevelMethodWrapper = (MethodWrapper) methodWrappers[i];
       break;
     }
   }
   return thirdLevelMethodWrapper;
 }
コード例 #2
0
    private IType getDefiningType(Object element) throws JavaModelException {
      int kind = ((IJavaElement) element).getElementType();

      if (kind != IJavaElement.METHOD
          && kind != IJavaElement.FIELD
          && kind != IJavaElement.INITIALIZER) {
        return null;
      }
      IType declaringType = ((IMember) element).getDeclaringType();
      if (kind != IJavaElement.METHOD) {
        return declaringType;
      }
      ITypeHierarchy hierarchy = getSuperTypeHierarchy(declaringType);
      if (hierarchy == null) {
        return declaringType;
      }
      IMethod method = (IMethod) element;
      MethodOverrideTester tester = new MethodOverrideTester(declaringType, hierarchy);
      IMethod res = tester.findDeclaringMethod(method, true);
      if (res == null || method.equals(res)) {
        return declaringType;
      }
      return res.getDeclaringType();
    }