// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; using ICSharpCode.SharpDevelop.Dom.Refactoring; namespace ICSharpCode.SharpDevelop.Dom { /// /// A class containing static actions that should be overridden by the /// application using ICSharpCode.SharpDevelop.Dom. /// public static class HostCallback { /// /// Show an error message. (string message, Exception ex) /// public static Action ShowError = delegate(string message, Exception ex) { LoggingService.Error(message, ex); throw new Exception(message, ex); }; public static Action ShowMessage = delegate(string message) { LoggingService.Info(message); }; /// /// Get the current project content. /// public static Func GetCurrentProjectContent = delegate { throw new NotImplementedException("GetCurrentProjectContent was not implemented by the host."); }; /// /// Rename the member (first argument) to the new name (second argument). /// Returns true on success, false on failure. /// public static Func RenameMember = delegate { return false; }; /// /// Show error loading code-completion information. /// The arguments are: string fileName, string include, string message /// public static Action ShowAssemblyLoadError = delegate {}; internal static void ShowAssemblyLoadErrorInternal(string fileName, string include, string message) { LoggingService.Warn("Error loading code-completion information for " + include + " from " + fileName + ":\r\n" + message + "\r\n"); ShowAssemblyLoadError(fileName, include, message); } /// /// Initialize the code generator options of the passed CodeGenerator. /// Invoked exactly once for each created instance of a class derived from CodeGenerator. /// public static Action InitializeCodeGeneratorOptions = delegate {}; } }