/// <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.CollectionLiteralExp == null)) { ICollectionLiteralExp collectionLiteralExpCasted = item.As <ICollectionLiteralExp>(); if ((collectionLiteralExpCasted != null)) { this._parent.CollectionLiteralExp = collectionLiteralExpCasted; 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) { ICollectionLiteralExp oldCollectionLiteralExp = ModelHelper.CastAs <ICollectionLiteralExp>(oldParent); ICollectionLiteralExp newCollectionLiteralExp = ModelHelper.CastAs <ICollectionLiteralExp>(newParent); if ((oldCollectionLiteralExp != null)) { oldCollectionLiteralExp.Part.Remove(this); } if ((newCollectionLiteralExp != null)) { newCollectionLiteralExp.Part.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldCollectionLiteralExp, newCollectionLiteralExp); this.OnCollectionLiteralExpChanged(e); this.OnPropertyChanged("CollectionLiteralExp", e); }
/// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public KindProxy(ICollectionLiteralExp modelElement) : base(modelElement) { }