Example #1
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.OwnerBDD == null))
     {
         IBDD ownerBDDCasted = item.As <IBDD>();
         if ((ownerBDDCasted != null))
         {
             this._parent.OwnerBDD = ownerBDDCasted;
             return;
         }
     }
     if ((this._parent.OwnerSubtreeForZero == null))
     {
         ISubtree ownerSubtreeForZeroCasted = item.As <ISubtree>();
         if ((ownerSubtreeForZeroCasted != null))
         {
             this._parent.OwnerSubtreeForZero = ownerSubtreeForZeroCasted;
             return;
         }
     }
     if ((this._parent.OwnerSubtreeForOne == null))
     {
         ISubtree ownerSubtreeForOneCasted = item.As <ISubtree>();
         if ((ownerSubtreeForOneCasted != null))
         {
             this._parent.OwnerSubtreeForOne = ownerSubtreeForOneCasted;
             return;
         }
     }
 }
Example #2
0
        /// <summary>
        /// Gets called when the parent model element of the current model element is about to change
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanging(IModelElement newParent, IModelElement oldParent)
        {
            IBDD oldOwner           = ModelHelper.CastAs <IBDD>(oldParent);
            IBDD newOwner           = ModelHelper.CastAs <IBDD>(newParent);
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldOwner, newOwner);

            this.OnOwnerChanging(e);
            this.OnPropertyChanging("Owner", e, _ownerReference);
        }
Example #3
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.Owner == null))
     {
         IBDD ownerCasted = item.As <IBDD>();
         if ((ownerCasted != null))
         {
             this._parent.Owner = ownerCasted;
             return;
         }
     }
 }
Example #4
0
        /// <summary>
        /// Gets called when the parent model element of the current model element changes
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanged(IModelElement newParent, IModelElement oldParent)
        {
            IBDD oldOwner = ModelHelper.CastAs <IBDD>(oldParent);
            IBDD newOwner = ModelHelper.CastAs <IBDD>(newParent);

            if ((oldOwner != null))
            {
                oldOwner.Ports.Remove(this);
            }
            if ((newOwner != null))
            {
                newOwner.Ports.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldOwner, newOwner);

            this.OnOwnerChanged(e);
            this.OnPropertyChanged("Owner", e, _ownerReference);
            base.OnParentChanged(newParent, oldParent);
        }