/// <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) { IResourceInterfaceRequiringEntity oldResourceInterfaceRequiringEntity__ResourceRequiredRole = ModelHelper.CastAs <IResourceInterfaceRequiringEntity>(oldParent); IResourceInterfaceRequiringEntity newResourceInterfaceRequiringEntity__ResourceRequiredRole = ModelHelper.CastAs <IResourceInterfaceRequiringEntity>(newParent); ValueChangedEventArgs e = new ValueChangedEventArgs(oldResourceInterfaceRequiringEntity__ResourceRequiredRole, newResourceInterfaceRequiringEntity__ResourceRequiredRole); this.OnResourceInterfaceRequiringEntity__ResourceRequiredRoleChanging(e); this.OnPropertyChanging("ResourceInterfaceRequiringEntity__ResourceRequiredRole", e, _resourceInterfaceRequiringEntity__ResourceRequiredRoleReference); }
/// <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) { IResourceInterfaceRequiringEntity oldResourceInterfaceRequiringEntity__ResourceRequiredRole = ModelHelper.CastAs <IResourceInterfaceRequiringEntity>(oldParent); IResourceInterfaceRequiringEntity newResourceInterfaceRequiringEntity__ResourceRequiredRole = ModelHelper.CastAs <IResourceInterfaceRequiringEntity>(newParent); if ((oldResourceInterfaceRequiringEntity__ResourceRequiredRole != null)) { oldResourceInterfaceRequiringEntity__ResourceRequiredRole.ResourceRequiredRoles__ResourceInterfaceRequiringEntity.Remove(this); } if ((newResourceInterfaceRequiringEntity__ResourceRequiredRole != null)) { newResourceInterfaceRequiringEntity__ResourceRequiredRole.ResourceRequiredRoles__ResourceInterfaceRequiringEntity.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldResourceInterfaceRequiringEntity__ResourceRequiredRole, newResourceInterfaceRequiringEntity__ResourceRequiredRole); this.OnResourceInterfaceRequiringEntity__ResourceRequiredRoleChanged(e); this.OnPropertyChanged("ResourceInterfaceRequiringEntity__ResourceRequiredRole", e, _resourceInterfaceRequiringEntity__ResourceRequiredRoleReference); base.OnParentChanged(newParent, oldParent); }
/// <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.RequiredResourceInterface__ResourceRequiredRole == null)) { IResourceInterface requiredResourceInterface__ResourceRequiredRoleCasted = item.As <IResourceInterface>(); if ((requiredResourceInterface__ResourceRequiredRoleCasted != null)) { this._parent.RequiredResourceInterface__ResourceRequiredRole = requiredResourceInterface__ResourceRequiredRoleCasted; return; } } if ((this._parent.ResourceInterfaceRequiringEntity__ResourceRequiredRole == null)) { IResourceInterfaceRequiringEntity resourceInterfaceRequiringEntity__ResourceRequiredRoleCasted = item.As <IResourceInterfaceRequiringEntity>(); if ((resourceInterfaceRequiringEntity__ResourceRequiredRoleCasted != null)) { this._parent.ResourceInterfaceRequiringEntity__ResourceRequiredRole = resourceInterfaceRequiringEntity__ResourceRequiredRoleCasted; return; } } }