/// <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.LoopBodyOwner == null)) { IIteratorExp loopBodyOwnerCasted = item.As <IIteratorExp>(); if ((loopBodyOwnerCasted != null)) { this._parent.LoopBodyOwner = loopBodyOwnerCasted; return; } } if ((this._parent.AppliedElement == null)) { ICallExp appliedElementCasted = item.As <ICallExp>(); if ((appliedElementCasted != null)) { this._parent.AppliedElement = appliedElementCasted; return; } } if ((this._parent.ParentCall == null)) { IOperationCallExp parentCallCasted = item.As <IOperationCallExp>(); if ((parentCallCasted != null)) { this._parent.ParentCall = parentCallCasted; return; } } }
/// <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) { IIteratorExp oldLoopExp = ModelHelper.CastAs <IIteratorExp>(oldParent); IIteratorExp newLoopExp = ModelHelper.CastAs <IIteratorExp>(newParent); ValueChangedEventArgs e = new ValueChangedEventArgs(oldLoopExp, newLoopExp); this.OnLoopExpChanging(e); this.OnPropertyChanging("LoopExp", e, _loopExpReference); }
/// <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.LoopExp == null)) { IIteratorExp loopExpCasted = item.As <IIteratorExp>(); if ((loopExpCasted != null)) { this._parent.LoopExp = loopExpCasted; return; } } }
/// <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) { IIteratorExp oldLoopExp = ModelHelper.CastAs <IIteratorExp>(oldParent); IIteratorExp newLoopExp = ModelHelper.CastAs <IIteratorExp>(newParent); if ((oldLoopExp != null)) { oldLoopExp.Iterator.Remove(this); } if ((newLoopExp != null)) { newLoopExp.Iterator.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldLoopExp, newLoopExp); this.OnLoopExpChanged(e); this.OnPropertyChanged("LoopExp", e, _loopExpReference); base.OnParentChanged(newParent, oldParent); }