private IType[] getSubclasses(final IType type) { if (type.equals(fDeclaringType)) return new IType[0]; return fHierarchy.getSubclasses(type); }
private IType[] getSubclasses(final IType type) { if (type.equals(fDeclaringType)) return new IType[0]; return fHierarchy.getSubclasses(type); }
private IType[] getSubclasses(final IType type) { if (type.equals(fDeclaringType)) return new IType[0]; return fHierarchy.getSubclasses(type); }
private void addTypeAndSubtypes(IType type) { if (fResult.add(type)) { IType[] subclasses= fHierarchy.getSubclasses(type); for (int i= 0; i < subclasses.length; i++) { addTypeAndSubtypes(subclasses[i]); } } } }
private void addTypeAndSubtypes(IType type) { if (fResult.add(type)) { IType[] subclasses= fHierarchy.getSubclasses(type); for (int i= 0; i < subclasses.length; i++) { addTypeAndSubtypes(subclasses[i]); } } } }
private void addTypeAndSubtypes(IType type) { if (fResult.add(type)) { IType[] subclasses= fHierarchy.getSubclasses(type); for (int i= 0; i < subclasses.length; i++) { addTypeAndSubtypes(subclasses[i]); } } }
private void addTypeAndSubtypes(IType type, Set<IType> result, ITypeHierarchy hierarchy) { if (result.add(type)) { IType[] subclasses= hierarchy.getSubclasses(type); for (int i= 0; i < subclasses.length; i++) { addTypeAndSubtypes(subclasses[i], result, hierarchy); } } }
private Map createNamedSubclassMapping(IProgressMonitor pm) throws JavaModelException{ IType[] subclasses= getCachedTypeHierarchy(new SubProgressMonitor(pm, 1)).getSubclasses(fMethod.getDeclaringType()); Map result= new HashMap(); for (int i= 0; i < subclasses.length; i++) { IType subclass= subclasses[i]; if (subclass.isAnonymous()) continue; ICompilationUnit cu= subclass.getCompilationUnit(); if (! result.containsKey(cu)) result.put(cu, new HashSet()); ((Set)result.get(cu)).add(subclass); } return result; }
private Map<ICompilationUnit, Set<IType>> createNamedSubclassMapping(IProgressMonitor pm) throws JavaModelException{ IType[] subclasses= getCachedTypeHierarchy(new SubProgressMonitor(pm, 1)).getSubclasses(fMethod.getDeclaringType()); Map<ICompilationUnit, Set<IType>> result= new HashMap<>(); for (int i= 0; i < subclasses.length; i++) { IType subclass= subclasses[i]; if (subclass.isAnonymous()) continue; ICompilationUnit cu= subclass.getCompilationUnit(); if (! result.containsKey(cu)) result.put(cu, new HashSet<IType>()); result.get(cu).add(subclass); } return result; }
private Map<ICompilationUnit, Set<IType>> createNamedSubclassMapping(IProgressMonitor pm) throws JavaModelException{ IType[] subclasses= getCachedTypeHierarchy(new SubProgressMonitor(pm, 1)).getSubclasses(fMethod.getDeclaringType()); Map<ICompilationUnit, Set<IType>> result= new HashMap<>(); for (int i= 0; i < subclasses.length; i++) { IType subclass= subclasses[i]; if (subclass.isAnonymous()) continue; ICompilationUnit cu= subclass.getCompilationUnit(); if (! result.containsKey(cu)) result.put(cu, new HashSet<IType>()); result.get(cu).add(subclass); } return result; }
private static Set getEffectedSubTypes(final ITypeHierarchy hierarchy, final IType type) throws JavaModelException { IType[] types= null; final boolean isInterface= type.isInterface(); if (isInterface) { final Collection remove= new ArrayList(); final List list= new ArrayList(Arrays.asList(hierarchy.getSubtypes(type))); for (final Iterator iterator= list.iterator(); iterator.hasNext();) { final IType element= (IType) iterator.next(); if (element.isInterface()) remove.add(element); } list.removeAll(remove); types= (IType[]) list.toArray(new IType[list.size()]); } else types= hierarchy.getSubclasses(type); final Set result= new HashSet(); for (int index= 0; index < types.length; index++) { if (!isInterface && JdtFlags.isAbstract(types[index])) result.addAll(getEffectedSubTypes(hierarchy, types[index])); else result.add(types[index]); } return result; }
private static Set<IType> getAffectedSubTypes(final ITypeHierarchy hierarchy, final IType type) throws JavaModelException { IType[] types= null; final boolean isInterface= type.isInterface(); if (isInterface) { final Collection<IType> remove= new ArrayList<>(); final List<IType> list= new ArrayList<>(Arrays.asList(hierarchy.getSubtypes(type))); for (final Iterator<IType> iterator= list.iterator(); iterator.hasNext();) { final IType element= iterator.next(); if (element.isInterface()) remove.add(element); } list.removeAll(remove); types= list.toArray(new IType[list.size()]); } else types= hierarchy.getSubclasses(type); final Set<IType> result= new HashSet<>(); for (int index= 0; index < types.length; index++) { if (!isInterface && JdtFlags.isAbstract(types[index])) result.addAll(getAffectedSubTypes(hierarchy, types[index])); else result.add(types[index]); } return result; }
private static Set<IType> getAffectedSubTypes(final ITypeHierarchy hierarchy, final IType type) throws JavaModelException { IType[] types= null; final boolean isInterface= type.isInterface(); if (isInterface) { final Collection<IType> remove= new ArrayList<>(); final List<IType> list= new ArrayList<>(Arrays.asList(hierarchy.getSubtypes(type))); for (final Iterator<IType> iterator= list.iterator(); iterator.hasNext();) { final IType element= iterator.next(); if (element.isInterface()) remove.add(element); } list.removeAll(remove); types= list.toArray(new IType[list.size()]); } else types= hierarchy.getSubclasses(type); final Set<IType> result= new HashSet<>(); for (int index= 0; index < types.length; index++) { if (!isInterface && JdtFlags.isAbstract(types[index])) result.addAll(getAffectedSubTypes(hierarchy, types[index])); else result.add(types[index]); } return result; }
private IType[] getAbstractDestinations(IProgressMonitor monitor) throws JavaModelException { IType[] allDirectSubclasses= getHierarchyOfDeclaringClass(monitor).getSubclasses(getDeclaringType()); List<IType> result= new ArrayList<>(allDirectSubclasses.length); for (int index= 0; index < allDirectSubclasses.length; index++) { IType subclass= allDirectSubclasses[index]; if (subclass.exists() && !subclass.isBinary() && !subclass.isReadOnly() && subclass.getCompilationUnit() != null && subclass.isStructureKnown()) result.add(subclass); } return result.toArray(new IType[result.size()]); }
private IType[] getAbstractDestinations(IProgressMonitor monitor) throws JavaModelException { IType[] allDirectSubclasses= getHierarchyOfDeclaringClass(monitor).getSubclasses(getDeclaringType()); List result= new ArrayList(allDirectSubclasses.length); for (int index= 0; index < allDirectSubclasses.length; index++) { IType subclass= allDirectSubclasses[index]; if (subclass.exists() && !subclass.isBinary() && !subclass.isReadOnly() && subclass.getCompilationUnit() != null && subclass.isStructureKnown()) result.add(subclass); } return (IType[]) result.toArray(new IType[result.size()]); }
private IType[] getAbstractDestinations(IProgressMonitor monitor) throws JavaModelException { IType[] allDirectSubclasses= getHierarchyOfDeclaringClass(monitor).getSubclasses(getDeclaringType()); List<IType> result= new ArrayList<>(allDirectSubclasses.length); for (int index= 0; index < allDirectSubclasses.length; index++) { IType subclass= allDirectSubclasses[index]; if (subclass.exists() && !subclass.isBinary() && !subclass.isReadOnly() && subclass.getCompilationUnit() != null && subclass.isStructureKnown()) result.add(subclass); } return result.toArray(new IType[result.size()]); }
private void addValidSubClasses(IType res, Set vals, Set checkedTypes) { try { //check to see if we have already checked the hiearchy if (checkedTypes.contains(res)) return; //should we add itself? if (isInnerOrAnonymousClass(res)) 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) { //ignore } }
final Map rewrites= new HashMap(2); rewrites.put(source, sourceRewriter); IType[] types= getHierarchyOfDeclaringClass(new SubProgressMonitor(monitor, 1)).getSubclasses(getDeclaringType()); final Set result= new HashSet(types.length + 1); for (int index= 0; index < types.length; index++)
final Map<ICompilationUnit, CompilationUnitRewrite> rewrites= new HashMap<>(2); rewrites.put(source, sourceRewriter); IType[] types= getHierarchyOfDeclaringClass(new SubProgressMonitor(monitor, 1)).getSubclasses(getDeclaringType()); final Set<ICompilationUnit> result= new HashSet<>(types.length + 1); for (int index= 0; index < types.length; index++) {
final Map<ICompilationUnit, CompilationUnitRewrite> rewrites= new HashMap<>(2); rewrites.put(source, sourceRewriter); IType[] types= getHierarchyOfDeclaringClass(new SubProgressMonitor(monitor, 1)).getSubclasses(getDeclaringType()); final Set<ICompilationUnit> result= new HashSet<>(types.length + 1); for (int index= 0; index < types.length; index++) {