internal override void Execute() { if (AsChild) { if (ExistedOperator.Child != null) { InsertedOperator.Next = ExistedOperator.Child; ExistedOperator.Child.Previous = InsertedOperator; ExistedOperator.Child.Parent = null; } ExistedOperator.Child = InsertedOperator; InsertedOperator.Parent = ExistedOperator; InsertedOperator.SetParent(ExistedOperator); } else { if (ExistedOperator.Next != null) { ExistedOperator.Next.Previous = InsertedOperator; InsertedOperator.Next = ExistedOperator.Next; } ExistedOperator.Next = InsertedOperator; InsertedOperator.Previous = ExistedOperator; InsertedOperator.SetParent(ExistedOperator.FindParent()); } InsertedOperator.Tree.NotifyObservers(this); }
internal override void Execute() { ExistedOperator.ManageLinks(); if (ExistedOperator is Comment comment) { comment.TextBody.NotifyObservers(EObserverHint.CommentSaving); } if (ExistedOperator.Child != null) { ExistedOperator.Child.Parent = InsertedOperator; InsertedOperator.Child = ExistedOperator.Child; InsertedOperator.Child.SetParent(InsertedOperator, true); } if (ExistedOperator.Next != null) { ExistedOperator.Next.Previous = InsertedOperator; InsertedOperator.Next = ExistedOperator.Next; } ExistedOperator.Next = InsertedOperator; InsertedOperator.Previous = ExistedOperator; InsertedOperator.SetParent(ExistedOperator.FindParent()); if (ExistedOperator.Parent != null) { ExistedOperator.Parent.Child = InsertedOperator; InsertedOperator.Parent = ExistedOperator.Parent; InsertedOperator.Previous = null; InsertedOperator.Parent = null; InsertedOperator.Next = null; } else { ExistedOperator.Previous.Next = InsertedOperator; InsertedOperator.Previous = ExistedOperator.Previous; ExistedOperator.Next = null; ExistedOperator.Previous = null; } ExistedOperator.SetParent(null); ExistedOperator.Tree.NotifyObservers(this); }
internal override void Execute() { if (ExistedOperator.Previous != null) { ExistedOperator.Previous.Next = InsertedOperator; InsertedOperator.Previous = ExistedOperator.Previous; ExistedOperator.Previous = InsertedOperator; InsertedOperator.Next = ExistedOperator; } else { InsertedOperator.Next = ExistedOperator.Parent?.Child; ExistedOperator.Parent.Child = InsertedOperator; ExistedOperator.Previous = InsertedOperator; InsertedOperator.Parent = ExistedOperator.Parent; ExistedOperator.Parent = null; } InsertedOperator.SetParent(ExistedOperator.FindParent()); InsertedOperator.Tree.NotifyObservers(this); }