コード例 #1
0
 private ITypeHierarchy createTypeHierarchy(IRubyElement element, IProgressMonitor pm)
     throws RubyModelException {
   if (element.getElementType() == IRubyElement.TYPE) {
     IType type = (IType) element;
     type = getLogicalType(type, type.getFullyQualifiedName());
     if (fIsSuperTypesOnly) {
       return type.newSupertypeHierarchy(pm);
     } else {
       return type.newTypeHierarchy(pm);
     }
   } else {
     IRegion region = RubyCore.newRegion();
     if (element.getElementType() == IRubyElement.RUBY_PROJECT) {
       // for projects only add the contained source folders
       ISourceFolderRoot[] roots = ((IRubyProject) element).getSourceFolderRoots();
       for (int i = 0; i < roots.length; i++) {
         if (!roots[i].isExternal()) {
           region.add(roots[i]);
         }
       }
     } else if (element.getElementType() == IRubyElement.SOURCE_FOLDER) {
       ISourceFolderRoot[] roots = element.getRubyProject().getSourceFolderRoots();
       String name = element.getElementName();
       for (int i = 0; i < roots.length; i++) {
         ISourceFolder pack = roots[i].getSourceFolder(name);
         if (pack.exists()) {
           region.add(pack);
         }
       }
     } else {
       region.add(element);
     }
     IRubyProject jproject = element.getRubyProject();
     return jproject.newTypeHierarchy(region, pm);
   }
 }
コード例 #2
0
 protected String createQualifiedTypeName(IType type) {
   if (type == null) return null;
   return type.getFullyQualifiedName();
 }
コード例 #3
0
 private IType getLogicalType(IType type, String name) {
   RubyElementRequestor requestor = new RubyElementRequestor(type.getRubyScript());
   IType[] types = requestor.findType(name);
   if (types == null || types.length == 0) return null;
   return new LogicalType(types);
 }