public override IEnumerable <IModelChange> Invert() { var child = new CompositionPropertyChange { AffectedElement = AffectedElement, OldValue = NewValue, NewValue = OldValue, Feature = Feature }; var composition = (ICompositionInsertion)(Origin.Invert().First()); yield return(composition.ConvertIntoMove(child)); }
private static IModelChange CreatePropertyChange(BubbledChangeEventArgs e) { var reference = e.Feature as IReference; var valChange = e.OriginalEventArgs as ValueChangedEventArgs; if (reference != null) { if (reference.IsContainment) { var change = new CompositionPropertyChange { AffectedElement = e.Element, Feature = e.Feature, OldValue = valChange.OldValue as IModelElement, NewValue = valChange.NewValue as IModelElement }; if (change.DeletedElement == null || change.DeletedElement.Parent == null) { return(change); } else { throw new NotImplementedException(); } } else { return(new AssociationPropertyChange { AffectedElement = e.Element, Feature = e.Feature, OldValue = valChange.OldValue as IModelElement, NewValue = valChange.NewValue as IModelElement }); } } else { return(new AttributePropertyChange { AffectedElement = e.Element, Feature = e.Feature, OldValue = valChange.OldValue != null?e.Feature.Type.Serialize(valChange.OldValue) : null, NewValue = valChange.NewValue != null?e.Feature.Type.Serialize(valChange.NewValue) : null }); } }
/// <summary> /// Creates a new instance /// </summary> public CompositionPropertyChangeReferencedElementsCollection(CompositionPropertyChange parent) { this._parent = parent; }
/// <summary> /// Creates a new instance /// </summary> public CompositionPropertyChangeChildrenCollection(CompositionPropertyChange parent) { this._parent = parent; }