Ejemplo n.º 1
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)
        {
            IInterfaceRequiringEntity oldRequiringEntity_RequiredRole = ModelHelper.CastAs <IInterfaceRequiringEntity>(oldParent);
            IInterfaceRequiringEntity newRequiringEntity_RequiredRole = ModelHelper.CastAs <IInterfaceRequiringEntity>(newParent);
            ValueChangedEventArgs     e = new ValueChangedEventArgs(oldRequiringEntity_RequiredRole, newRequiringEntity_RequiredRole);

            this.OnRequiringEntity_RequiredRoleChanging(e);
            this.OnPropertyChanging("RequiringEntity_RequiredRole", e, _requiringEntity_RequiredRoleReference);
        }
Ejemplo n.º 2
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.RequiringEntity_RequiredRole == null))
     {
         IInterfaceRequiringEntity requiringEntity_RequiredRoleCasted = item.As <IInterfaceRequiringEntity>();
         if ((requiringEntity_RequiredRoleCasted != null))
         {
             this._parent.RequiringEntity_RequiredRole = requiringEntity_RequiredRoleCasted;
             return;
         }
     }
 }
Ejemplo n.º 3
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)
        {
            IInterfaceRequiringEntity oldRequiringEntity_RequiredRole = ModelHelper.CastAs <IInterfaceRequiringEntity>(oldParent);
            IInterfaceRequiringEntity newRequiringEntity_RequiredRole = ModelHelper.CastAs <IInterfaceRequiringEntity>(newParent);

            if ((oldRequiringEntity_RequiredRole != null))
            {
                oldRequiringEntity_RequiredRole.RequiredRoles_InterfaceRequiringEntity.Remove(this);
            }
            if ((newRequiringEntity_RequiredRole != null))
            {
                newRequiringEntity_RequiredRole.RequiredRoles_InterfaceRequiringEntity.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldRequiringEntity_RequiredRole, newRequiringEntity_RequiredRole);

            this.OnRequiringEntity_RequiredRoleChanged(e);
            this.OnPropertyChanged("RequiringEntity_RequiredRole", e, _requiringEntity_RequiredRoleReference);
            base.OnParentChanged(newParent, oldParent);
        }