public static ITextCommand Execute(string command, TextArea textArea, TextDocument document) { if (string.IsNullOrWhiteSpace(command)) { return(null); } if (!TemplateEngine.TextCommands.ContainsKey(command)) { return(null); } ITextCommand textCommand = (ITextCommand)Activator.CreateInstance(TemplateEngine.TextCommands[command]); if (textCommand == null) { return(null); } textCommand.Execute(textArea, document); return(textCommand); }