/// <summary> /// Tests if the drawer can draw for the specified property. /// </summary> /// <param name="property">The property to test.</param> /// <returns><c>true</c> if the drawer can drawn the property. Otherwise <c>false</c>.</returns> public sealed override bool CanDrawProperty(InspectorProperty property) { if (property.ValueEntry != null && !this.CanDrawTypeFilter(property.ValueEntry.TypeOfValue)) { return(false); } return(property.GetAttribute <TAttribute>() != null && this.CanDrawAttributeProperty(property)); }
public static bool ShowInvalidAttributeErrorFor(InspectorProperty property, Type attribute) { if (property.ValueEntry == null) { return(false); } if (property.ValueEntry.BaseValueType == typeof(object)) { return(false); } if (property.Parent != null && property.Parent.ChildResolver is ICollectionResolver) { return(false); } if (property.GetAttribute <SuppressInvalidAttributeErrorAttribute>() != null) { return(false); } if (property.Info.TypeOfValue.IsInterface) { return(false); } var collectionResolver = property.ChildResolver as ICollectionResolver; if (collectionResolver != null) { if (collectionResolver.ElementType == typeof(object)) { return(false); } if (collectionResolver.ElementType.IsInterface) { return(false); } return(ShowInvalidAttributeErrorFor(attribute, property.ValueEntry.BaseValueType) && ShowInvalidAttributeErrorFor(attribute, collectionResolver.ElementType)); } return(ShowInvalidAttributeErrorFor(attribute, property.ValueEntry.BaseValueType)); }