/** * Returns the fully qualified type name associated with the given member. * * @param member * @return fully qualified type name */ protected String getTypeName(IApiMember member) throws CoreException { switch (member.getType()) { case IApiElement.TYPE: { IApiType type = (IApiType) member; if (type.isAnonymous()) { return getTypeName(member.getEnclosingType()); } else if (type.isLocal()) { return getTypeName(member.getEnclosingType()); } return member.getName(); } default: { return getTypeName(member.getEnclosingType()); } } }
/** * Returns the unqualified type name associated with the given member. * * @param member * @return unqualified type name */ protected String getSimpleTypeName(IApiMember member) throws CoreException { switch (member.getType()) { case IApiElement.TYPE: { IApiType type = (IApiType) member; if (type.isAnonymous()) { return getSimpleTypeName(type.getEnclosingType()); } else if (type.isLocal()) { String name = getSimpleTypeName(member.getEnclosingType()); int idx = name.indexOf('$'); if (idx > -1) { return name.substring(0, idx); } return name; } return Signatures.getTypeName(Signatures.getTypeSignature(type)); } default: return getSimpleTypeName(member.getEnclosingType()); } }
/** * Returns whether all enclosing types of the given member are visible. * * @param member member * @return whether all enclosing types of the given member are visible * @throws CoreException */ protected boolean isEnclosingTypeVisible(IApiMember member) throws CoreException { IApiType type = null; if (member.getType() == IApiElement.TYPE) { type = (IApiType) member; } else { type = member.getEnclosingType(); } while (type != null) { if (((Flags.AccPublic | Flags.AccProtected) & type.getModifiers()) == 0) { // the type is private or default protection, do not retain the reference return false; } type = type.getEnclosingType(); } return true; }