/// <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.InitExpression == null)) { IOclExpression initExpressionCasted = item.As <IOclExpression>(); if ((initExpressionCasted != null)) { this._parent.InitExpression = initExpressionCasted; return; } } if ((this._parent.LetExp == null)) { ILetExp letExpCasted = item.As <ILetExp>(); if ((letExpCasted != null)) { this._parent.LetExp = letExpCasted; return; } } if ((this._parent.RepresentedParameter == null)) { IParameter representedParameterCasted = item.As <IParameter>(); if ((representedParameterCasted != null)) { this._parent.RepresentedParameter = representedParameterCasted; 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) { ILetExp oldLetExp = ModelHelper.CastAs <ILetExp>(oldParent); ILetExp newLetExp = ModelHelper.CastAs <ILetExp>(newParent); if ((oldLetExp != null)) { oldLetExp.Variable = null; } if ((newLetExp != null)) { newLetExp.Variable = this; } ValueChangedEventArgs e = new ValueChangedEventArgs(oldLetExp, newLetExp); this.OnLetExpChanged(e); this.OnPropertyChanged("LetExp", e); }