/// <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.Attribute == null)) { IProperty attributeCasted = item.As <IProperty>(); if ((attributeCasted != null)) { this._parent.Attribute = attributeCasted; return; } } if ((this._parent.TupleLiteralExp == null)) { ITupleLiteralExp tupleLiteralExpCasted = item.As <ITupleLiteralExp>(); if ((tupleLiteralExpCasted != null)) { this._parent.TupleLiteralExp = tupleLiteralExpCasted; return; } } if ((this._parent.Value == null)) { IOclExpression valueCasted = item.As <IOclExpression>(); if ((valueCasted != null)) { this._parent.Value = valueCasted; 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) { ITupleLiteralExp oldTupleLiteralExp = ModelHelper.CastAs <ITupleLiteralExp>(oldParent); ITupleLiteralExp newTupleLiteralExp = ModelHelper.CastAs <ITupleLiteralExp>(newParent); if ((oldTupleLiteralExp != null)) { oldTupleLiteralExp.Part.Remove(this); } if ((newTupleLiteralExp != null)) { newTupleLiteralExp.Part.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldTupleLiteralExp, newTupleLiteralExp); this.OnTupleLiteralExpChanged(e); this.OnPropertyChanged("TupleLiteralExp", e); }