/// <summary> /// Returns the ancestors of this BaseConfigurationType (includes this type) /// </summary> /// <param name="ancestors">The list of ancestors</param> /// <returns><see langref="false"/> if there are no loops in the inheritance graph, else <see langref="true"/></returns> protected internal bool GetAncestors(out IEnumerable <BaseConfigurationType> ancestors) { LinkedList <BaseConfigurationType> list = new LinkedList <BaseConfigurationType>(); ancestors = list; for (BaseConfigurationType ancestor = this; ancestor != null; ancestor = ancestor.BaseClass) { if (ancestors.Contains(ancestor)) { return(true); } list.AddLast(ancestor); } return(false); }
protected override void OnValueChanged(BaseConfigurationType element, InheritanceModifiers oldValue, InheritanceModifiers newValue) { if (!element.Store.InUndoRedoOrRollback) { // Raise the NameChanged event for derived classes to act upon. element.OnInheritanceModifierChanged(EventArgs.Empty); } #region Inheritance shape styling if (PresentationViewsSubject.GetPresentation(element).Count == 1) { ConfigurationShape shape = PresentationViewsSubject.GetPresentation(element)[0] as ConfigurationShape; // Set the appropriate outline style depending on the inheritance modifier switch (element.InheritanceModifier) { case InheritanceModifiers.None: shape.OutlineDashStyle = DashStyle.Solid; shape.OutlineThickness = 0.01F; break; case InheritanceModifiers.Abstract: shape.OutlineDashStyle = DashStyle.Dash; shape.OutlineThickness = 0.01F; break; case InheritanceModifiers.Sealed: shape.OutlineDashStyle = DashStyle.Solid; shape.OutlineThickness = 0.01F; break; } } #endregion // Always call the base class method. base.OnValueChanged(element, oldValue, newValue); }