/// <summary>
        /// Adds extension properties to the <see cref="PropertyDescriptorCollection"/> before returning it.
        /// </summary>
        /// <seealso cref="ElementTypeDescriptor{TModelElement}.GetProperties(Attribute[])"/>
        /// <seealso cref="ICustomTypeDescriptor.GetProperties(Attribute[])"/>
        public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection properties = base.GetProperties(attributes);

            ExtendableElementUtility.GetExtensionProperties(ModelElement, properties, typeof(TModelElement));
            return(properties);
        }
        /// <summary>
        /// Adds extension properties to the <see cref="PropertyDescriptorCollection"/> before returning it.
        /// </summary>
        /// <seealso cref="ElementTypeDescriptor{TModelElement}.GetProperties(Attribute[])"/>
        /// <seealso cref="ICustomTypeDescriptor.GetProperties(Attribute[])"/>
        public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection properties = base.GetProperties(attributes);
            TModelElement element = ModelElement;

            if (element != null && null != Utility.ValidateStore(element.Store))
            {
                ExtendableElementUtility.GetExtensionProperties(element, properties, typeof(TModelElement));
            }
            return(properties);
        }
        /// <summary>
        /// Adds extension properties to the <see cref="PropertyDescriptorCollection"/> before returning it.
        /// </summary>
        /// <seealso cref="ElementTypeDescriptor{TModelElement}.GetProperties(Attribute[])"/>
        /// <seealso cref="ICustomTypeDescriptor.GetProperties(Attribute[])"/>
        public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection properties   = base.GetProperties(attributes);
            TPresentationElement         shapeElement = PresentationElement;

            if (shapeElement != null && null != Utility.ValidateStore(shapeElement.Store))
            {
                properties = ExtendableElementUtility.GetExtensionProperties(shapeElement, properties, typeof(TPresentationElement));
            }
            return(properties);
        }
        /// <summary>
        /// Adds extension properties to the <see cref="PropertyDescriptorCollection"/> before returning it.
        /// </summary>
        /// <seealso cref="ElementTypeDescriptor{TModelElement}.GetProperties(Attribute[])"/>
        /// <seealso cref="ICustomTypeDescriptor.GetProperties(Attribute[])"/>
        public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection properties = base.GetProperties(attributes);

            // NOR-145: Incorporate Matt's changes to make sure the property window doesn't throw unnecessary exceptions
            TModelElement element = ModelElement;
            Store         store   = Utility.ValidateStore(element?.Store);

            if (store != null)
            {
                ExtendableElementUtility.GetExtensionProperties(ModelElement, properties, typeof(TModelElement));
            }

            return(properties);
        }
        /// <summary>
        /// Rename the model's Name property to ModelName, and add a DiagramName
        /// property for the diagram.
        /// </summary>
        public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection properties = EditorUtility.GetEditablePropertyDescriptors(base.GetProperties(attributes));

            EditorUtility.ModifyPropertyDescriptorDisplay(properties, "Name", "ModelName", ResourceStrings.DiagramPropertiesModelNameDisplayName, null, null);
            ORMDiagram diagram;
            Store      store;

            if (null != (diagram = this.PresentationElement) &&
                null != (store = Utility.ValidateStore(diagram.Store)))
            {
                properties.Add(EditorUtility.ModifyPropertyDescriptorDisplay(this.CreatePropertyDescriptor(diagram, store.DomainDataDirectory.GetDomainProperty(ORMDiagram.NameDomainPropertyId), attributes), "DiagramName", ResourceStrings.DiagramPropertiesDiagramNameDisplayName, ResourceStrings.DiagramPropertiesDiagramNameDescription, null));
                properties = ExtendableElementUtility.GetExtensionProperties(diagram, properties, typeof(TPresentationElement));
            }
            return(properties);
        }