// this is very odd return behavior trying to keep everyone happy
// can we remove it from the model now? we know it contains no relationship endpoints...
AsmManager model = world.getModelAsAsmManager();
if (world.isMinimalModel() && model != null && !classType.isAspect()) {
AspectJElementHierarchy hierarchy = (AspectJElementHierarchy) model.getHierarchy();
String pkgname = classType.getResolvedTypeX().getPackageName();
String tname = classType.getResolvedTypeX().getSimpleBaseName();
IProgramElement typeElement = hierarchy.findElementForType(pkgname, tname);
if (typeElement != null && hasInnerType(typeElement)) {
// Cannot remove it right now (has inner type), schedule it
// for possible deletion later if all inner types are
// removed
candidatesForRemoval.add(typeElement);
}
if (typeElement != null && !hasInnerType(typeElement)) {
IProgramElement parent = typeElement.getParent();
// parent may have children: PACKAGE DECL, IMPORT-REFERENCE, TYPE_DECL
if (parent != null) {
// if it was the only type we should probably remove
// the others too.
parent.removeChild(typeElement);
if (parent.getKind().isSourceFile()) {
removeSourceFileIfNoMoreTypeDeclarationsInside(hierarchy, typeElement, parent);
} else {
hierarchy.forget(null, typeElement);
// At this point, the child has been removed. We
// should now check if the parent is in our
// 'candidatesForRemoval' set. If it is then that
// means we were going to remove it but it had a
// child. Now we can check if it still has a child -