示例#1
0
 public ITypeModel getBodyType() {
   IMethod iMethod = (IMethod) tm;
   try {
     String[] parameterTypes = iMethod.getParameterTypes();
     for (String s : parameterTypes) {
       if (s.contains("java")) // $NON-NLS-1$
       {
         continue;
       }
       String returnType = s;
       if (returnType.startsWith("Q") && returnType.endsWith(";")) { // $NON-NLS-1$ //$NON-NLS-2$
         IType ownerType = (IType) iMethod.getAncestor(IJavaElement.TYPE);
         String[][] resolveType =
             ownerType.resolveType(returnType.substring(1, returnType.length() - 1));
         if (resolveType.length == 1) {
           IType findType =
               ownerType.getJavaProject().findType(resolveType[0][0] + '.' + resolveType[0][1]);
           if (findType != null && findType instanceof SourceType) {
             return new JDTType(findType);
           }
         }
       }
     }
   } catch (Exception e) {
     throw new IllegalStateException(e);
   }
   return null;
 }