Examples of ITypeHierarchy


Examples of org.eclipse.jdt.core.ITypeHierarchy

    return list;
  }

  private static boolean hierarchyContainsComponent(final IType type) throws JavaModelException {
    Assert.isNotNull(type);
    final ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null);
    if (hierarchy != null) {
      final IType[] supertypes = hierarchy.getAllSupertypes(type);
      for (final IType iType : supertypes) {
        if (iType.getFullyQualifiedName().equals(TypeHelper.COMPONENT)) {
          return true;
        }
      }
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

        return;
      if (!isAbstractClass(res))
        vals.add(res)//since it is a set, dupes will not be added
     

      ITypeHierarchy hierarchy = res.newTypeHierarchy(getJavaProject(), null);     
      IType[] subclasses = hierarchy.getSubclasses(res);
      checkedTypes.add(res);
      for (int i=0;i<subclasses.length;i++){
        addValidSubClasses(subclasses[i], vals, checkedTypes);
      }
    } catch (JavaModelException e) {
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

    IType type = getTypeForValue(jp, value);
    if (type != null){     
      //ensure that it is not abstract or anonymous
      if (!isInnerOrAnonymousClass(type) && !isAbstractClass(type)){
        //now verify that it meets the criteria
        ITypeHierarchy hierarchy;
        try {
          hierarchy = type.newTypeHierarchy(jp, null);
        } catch (JavaModelException e) {
          return false;
        }
           
        //check that all interfaces
        List<String> interfaceNames = getInterfaceNames();
        for (Iterator<String> it=interfaceNames.iterator();it.hasNext();){
          //check that all interfaces are satisfied by type
          IType interfase = getTypeForValue(jp, it.next());
          if (interfase == null){
            addNewValidationMessage(Messages.JavaClassType_not_found);
            return false;
          }
          else if (! containsType(hierarchy.getAllSupertypes(type), interfase)){
            addNewValidationMessage(Messages.JavaClassType_not_found);
            return false;
          }
        }
        //interfaces have been satisfied now check the superclass if specified       
        IType superClass = getSuperClass(jp);
        if (superClass != null && superClass.equals(type))
          return true;
        else if (superClass != null && !containsType(hierarchy.getAllSuperclasses(type), superClass )){
          addNewValidationMessage(Messages.JavaClassType_not_found);
          return false;
        }
        return true;
//        List results = getTypes();
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

    List descriptorResults = new ArrayList();
    try {
      IType type = javaProject.findType(typeQualifiedName.getQualifier() + "." + typeQualifiedName.getLocalName()); //$NON-NLS-1$
      // type must exist
      if(type != null) {
        ITypeHierarchy hierarchy = type.newTypeHierarchy(null);
        IType[] supers = hierarchy.getAllSuperclasses(type);
 
        IMethod[] methods = type.getMethods();
        // iterate the bean's methods
        for (int i = 0; i < methods.length; i++)
          acceptMethod(getMethodResults, isMethodResults, setMethodResults, methods[i]);
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

            if (instanceOf.equals(type.getFullyQualifiedName()))
            {
                return true;
            }

            final ITypeHierarchy typeHierarchy =
                type.newSupertypeHierarchy(new NullProgressMonitor());
           
            final IType[] supers = typeHierarchy.getAllSupertypes(type);
            for (int i = 0; i < supers.length; i++)
            {
                if (instanceOf.equals(supers[i].getFullyQualifiedName()))
                {
                    return true;
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

    protected void calculate() {
      assert source instanceof TypeMetric : "The calculation is set on Type";
      TypeMetric metricElement = (TypeMetric) source;

      IType iType = (IType) metricElement.getJavaElement();
      ITypeHierarchy hierarchy = metricElement.getHierarchy();
      IType[] supers = hierarchy.getAllSuperclasses(iType);
     
      int overridden = 0;
      try {
        IMethod[] myMethods = iType.getMethods();
        List<IMethod> counted = new ArrayList<IMethod>();
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

    protected void calculate() {
      assert source instanceof TypeMetric : "The calculation must be set on Type";
      TypeMetric metricElement = (TypeMetric) source;
      IType iType = (IType) metricElement.getJavaElement();

      ITypeHierarchy hierarchy = metricElement.getHierarchy();
     
      IType[] supers = hierarchy.getAllSuperclasses(iType);
      IType[] subs = hierarchy.getSubtypes(iType);
      values[0].setValue(supers.length);
      values[1].setValue(subs.length);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

    public static IType[] getAllSuperTypes(IType type, IProgressMonitor pm) throws JavaModelException {
        //workaround for bugs 23644 and 23656
        try{
            pm.beginTask("", 3); //$NON-NLS-1$
            ITypeHierarchy hierarchy= type.newSupertypeHierarchy(new SubProgressMonitor(pm, 1));
           
            IProgressMonitor subPm= new SubProgressMonitor(pm, 2);
            List<IType> typeList= Arrays.asList(hierarchy.getAllSupertypes(type));
            subPm.beginTask("", typeList.size()); //$NON-NLS-1$
            Set<IType> types= new HashSet<IType>(typeList);
            for (Iterator iter= typeList.iterator(); iter.hasNext();) {
                IType superType= (IType)iter.next();
                IType[] superTypes= getAllSuperTypes(superType, new SubProgressMonitor(subPm, 1));
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

          subTypesList.add(baseType.getFullyQualifiedName());
          // prepare sub-types
          IType[] subTypes;
          {
            m_monitor.subTask(baseType.getFullyQualifiedName());
            ITypeHierarchy th = baseType.newTypeHierarchy(javaProject, new NullProgressMonitor());
            subTypes = th.getAllSubtypes(baseType);
            m_monitor.worked(1);
          }
          //
          for (int subTypeIndex = 0; subTypeIndex < subTypes.length; subTypeIndex++) {
            subTypesList.add(subTypes[subTypeIndex].getFullyQualifiedName());
View Full Code Here

Examples of org.eclipse.jdt.core.ITypeHierarchy

  /**
   * @return single "impl" type for given RemoteService type, or <code>null</code>.
   */
  public static IType getServiceImplType(IType serviceType, IProgressMonitor pm)
      throws JavaModelException {
    ITypeHierarchy hierarchy = serviceType.newTypeHierarchy(pm);
    IType[] subtypes = hierarchy.getAllSubtypes(serviceType);
    return subtypes.length == 1 ? subtypes[0] : null;
  }
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.