protected override void Do( object context, CommandFactoryManager <OperationContext> commandFactory, object commandData, OperationContext operationContext, EditorViewController controller, IDisplayContext displayContext, TextPosition position) { // Figure out which command we'll be passing the operation to. HierarchicalPath key; if (!displayContext.Caret.Selection.IsEmpty) { // If we have a selection, then we use the Delete Selection command. key = DeleteSelectionCommandFactory.Key; } else if (position.IsBeginningOfBuffer(controller.DisplayContext)) { // If we are the beginning of the buffer, then we can't delete anything. return; } else if (position.CharacterPosition == 0) { // If we are at the beginning of the line, then we are combining paragraphs. key = JoinPreviousParagraphCommandFactory.Key; } else { // Delete the next character only. key = DeleteLeftWordCommandFactory.Key; } // Execute the command and pass the results to calling method. var nextCommand = new CommandFactoryReference(key); commandFactory.Do(context, nextCommand); }