示例#1
0
 /// <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;
         }
     }
 }
示例#2
0
        /// <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);
        }
示例#3
0
 /// <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)
 {
 }