예제 #1
0
        // <summary>
        // ----s open the specified Type and looks for EditorAttributes that represent
        // CategoryEditors - returns the Types of those editors, if any are found, as a list
        // </summary>
        // <param name="ownerType">Type to ---- open</param>
        // <returns>List of CategoryEditors associated with the specified type, if any.  Null otherwise.</returns>
        public static IEnumerable <Type> GetCategoryEditorTypes(Type ownerType)
        {
            List <Type> editorTypes = null;

            foreach (EditorAttribute editorAttribute in GetAttributes <EditorAttribute>(ownerType))
            {
                // A ---- attempt at using the same extensibility code
                Type editorType = ExtensibilityMetadataHelper.GetCategoryEditorType(editorAttribute, MessageLogger.Instance);
                if (editorType == null)
                {
                    continue;
                }

                if (editorTypes == null)
                {
                    editorTypes = new List <Type>();
                }

                editorTypes.Add(editorType);
            }

            return(editorTypes);
        }