Example #1
0
        private protected virtual void UndoExpandBlockList(IWriteableOperation operation)
        {
            WriteableExpandArgumentOperation ExpandArgumentOperation = (WriteableExpandArgumentOperation)operation;
            IWriteableRemoveBlockOperation   RemoveBlockOperation    = ExpandArgumentOperation.ToRemoveBlockOperation();

            ExecuteRemoveBlock(RemoveBlockOperation);
        }
Example #2
0
        /// <summary>
        /// Expands the block list.
        /// * Only expand block list of arguments
        /// * Only expand if the list is empty. In that case, add a single default argument.
        /// </summary>
        private protected virtual void ExpandBlockList(IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex> blockListInner, WriteableOperationList operationList)
        {
            if (!blockListInner.IsEmpty)
            {
                return;
            }

            if (!NodeHelper.IsCollectionWithExpand(blockListInner.Owner.Node, blockListInner.PropertyName))
            {
                return;
            }

            Node       NewItem    = NodeHelper.CreateDefaultFromType(blockListInner.InterfaceType);
            Pattern    NewPattern = NodeHelper.CreateEmptyPattern();
            Identifier NewSource  = NodeHelper.CreateEmptyIdentifier();
            IBlock     NewBlock   = NodeTreeHelperBlockList.CreateBlock(blockListInner.Owner.Node, blockListInner.PropertyName, ReplicationStatus.Normal, NewPattern, NewSource);

            Action <IWriteableOperation>     HandlerRedo = (IWriteableOperation operation) => RedoExpandBlockList(operation);
            Action <IWriteableOperation>     HandlerUndo = (IWriteableOperation operation) => UndoExpandBlockList(operation);
            WriteableExpandArgumentOperation Operation   = CreateExpandArgumentOperation(blockListInner.Owner.Node, blockListInner.PropertyName, NewBlock, NewItem, HandlerRedo, HandlerUndo, isNested: false);

            Operation.Redo();

            operationList.Add(Operation);
        }
Example #3
0
        private protected virtual void RedoExpandBlockList(IWriteableOperation operation)
        {
            WriteableExpandArgumentOperation ExpandArgumentOperation = (WriteableExpandArgumentOperation)operation;

            ExecuteInsertNewBlock(ExpandArgumentOperation);
        }