/// <summary> /// Initializes a new instance of the <see cref="PropertyChildren"/> class. /// </summary> /// <param name="property">The property to handle children for.</param> /// <exception cref="System.ArgumentNullException">property is null</exception> internal PropertyChildren(InspectorProperty property) { if (property == null) { throw new ArgumentNullException("property"); } this.property = property; this.resolver = this.property.ChildResolver; this.refreshableResolver = this.resolver as IRefreshableResolver; this.pathRedirector = this.resolver as IPathRedirector; this.hasSpecialPropertyPaths = this.resolver as IHasSpecialPropertyPaths; }
/// <summary> /// Gets an <see cref="OdinPropertyResolver"/> instance for the specified property. /// </summary> /// <param name="property">The property to get an <see cref="OdinPropertyResolver"/> instance for.</param> /// <returns>An instance of <see cref="OdinPropertyResolver"/> to resolver the specified property.</returns> public override OdinPropertyResolver GetResolver(InspectorProperty property) { if (property.Tree.IsStatic && property == property.Tree.SecretRootProperty) { return(OdinPropertyResolver.Create(typeof(StaticRootPropertyResolver <>).MakeGenericType(property.ValueEntry.TypeOfValue), property)); } var queries = QueryResultsList; queries.Clear(); queries.Add(SearchIndex.GetMatches(Type.EmptyTypes)); Type typeOfValue = property.ValueEntry != null ? property.ValueEntry.TypeOfValue : null; if (typeOfValue != null) { queries.Add(SearchIndex.GetMatches(typeOfValue)); for (int i = 0; i < property.Attributes.Count; i++) { queries.Add(SearchIndex.GetMatches(typeOfValue, property.Attributes[i].GetType())); } } TypeSearchIndex.MergeQueryResultsIntoList(queries, MergedSearchResultsList); for (int i = 0; i < MergedSearchResultsList.Count; i++) { var info = MergedSearchResultsList[i]; if (GetEmptyResolverInstance(info.MatchedType).CanResolveForPropertyFilter(property)) { return(OdinPropertyResolver.Create(info.MatchedType, property)); } } return(OdinPropertyResolver.Create <EmptyPropertyResolver>(property)); }