Exemple #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)
        {
            IInterfaceProvidingEntity oldProvidingEntity_ProvidedRole = ModelHelper.CastAs <IInterfaceProvidingEntity>(oldParent);
            IInterfaceProvidingEntity newProvidingEntity_ProvidedRole = ModelHelper.CastAs <IInterfaceProvidingEntity>(newParent);
            ValueChangedEventArgs     e = new ValueChangedEventArgs(oldProvidingEntity_ProvidedRole, newProvidingEntity_ProvidedRole);

            this.OnProvidingEntity_ProvidedRoleChanging(e);
            this.OnPropertyChanging("ProvidingEntity_ProvidedRole", e, _providingEntity_ProvidedRoleReference);
        }
Exemple #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.ProvidingEntity_ProvidedRole == null))
     {
         IInterfaceProvidingEntity providingEntity_ProvidedRoleCasted = item.As <IInterfaceProvidingEntity>();
         if ((providingEntity_ProvidedRoleCasted != null))
         {
             this._parent.ProvidingEntity_ProvidedRole = providingEntity_ProvidedRoleCasted;
             return;
         }
     }
 }
Exemple #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)
        {
            IInterfaceProvidingEntity oldProvidingEntity_ProvidedRole = ModelHelper.CastAs <IInterfaceProvidingEntity>(oldParent);
            IInterfaceProvidingEntity newProvidingEntity_ProvidedRole = ModelHelper.CastAs <IInterfaceProvidingEntity>(newParent);

            if ((oldProvidingEntity_ProvidedRole != null))
            {
                oldProvidingEntity_ProvidedRole.ProvidedRoles_InterfaceProvidingEntity.Remove(this);
            }
            if ((newProvidingEntity_ProvidedRole != null))
            {
                newProvidingEntity_ProvidedRole.ProvidedRoles_InterfaceProvidingEntity.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldProvidingEntity_ProvidedRole, newProvidingEntity_ProvidedRole);

            this.OnProvidingEntity_ProvidedRoleChanged(e);
            this.OnPropertyChanged("ProvidingEntity_ProvidedRole", e, _providingEntity_ProvidedRoleReference);
            base.OnParentChanged(newParent, oldParent);
        }