super(project, new DartTypeHierarchyNodeDescriptor(project, null, dartClass, true));
}
@NotNull
protected final Object[] buildChildren(@NotNull final HierarchyNodeDescriptor descriptor) {
final DartClass dartClass = ((DartTypeHierarchyNodeDescriptor)descriptor).getDartClass();
if (dartClass == null) {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
final List<DartClass> supers = new ArrayList<DartClass>();
final DartType superClass = dartClass.getSuperClass();
// looks like there's no sense in jumping to Object class
if (superClass != null && !DartResolveUtil.OBJECT.equals(superClass.getName())) {
final DartClassResolveResult dartClassResolveResult = DartResolveUtil.resolveClassByType(superClass);
if (dartClassResolveResult.getDartClass() != null) {
supers.add(dartClassResolveResult.getDartClass());
}
}
List<DartClassResolveResult> implementsAndMixinsList =
DartResolveUtil.resolveClassesByTypes(DartResolveUtil.getImplementsAndMixinsList(dartClass));
for (DartClassResolveResult resolveResult : implementsAndMixinsList) {
final DartClass resolveResultDartClass = resolveResult.getDartClass();
if (resolveResultDartClass != null) {
supers.add(resolveResultDartClass);
}
}
if(supers.size() == 0) {
final DartClassResolveResult dartClassResolveResult = dartClass.getSuperClassResolvedOrObjectClass();
if(dartClassResolveResult != null) {
final DartClass superDartClass = dartClassResolveResult.getDartClass();
if (superDartClass != null && superDartClass.getName().equals(DartResolveUtil.OBJECT)) {
supers.add(superDartClass);
}
}
}