/// <summary>
 /// ChangeRule: typeof(CardinalityConstraint), FireTime=TopLevelCommit, Priority=DiagramFixupConstants.ResizeParentRulePriority;
 /// Rule to watch the CardinalityConstraint.TextChanged property so that we can
 /// update text as needed. TextChanged is triggered when the CardinalityConstraint is
 /// first added, so this is sufficient for updating.
 /// </summary>
 private static void CardinalityConstraintTextChangedRule(ElementPropertyChangedEventArgs e)
 {
     if (e.DomainProperty.Id == CardinalityConstraint.TextChangedDomainPropertyId)
     {
         CardinalityConstraint constraint = (CardinalityConstraint)e.ModelElement;
         if (!constraint.IsDeleted)
         {
             foreach (ShapeElement pel in PresentationViewsSubject.GetPresentation(constraint))
             {
                 CardinalityConstraintShape cardinalityConstraintShape = pel as CardinalityConstraintShape;
                 if (cardinalityConstraintShape != null)
                 {
                     cardinalityConstraintShape.InvalidateDisplayText();
                 }
             }
         }
     }
 }
            /// <summary>
            /// Code that handles retrieval of the text to display in CardinalityConstraintShape while editing.
            /// </summary>
            public sealed override string GetDisplayText(ShapeElement parentShape)
            {
                CardinalityConstraintShape parentCardinalityConstraintShape = parentShape as CardinalityConstraintShape;

                return((parentCardinalityConstraintShape != null) ? parentCardinalityConstraintShape.DisplayText : base.GetDisplayText(parentShape));
            }