/// <summary> /// Opens a new unsaved file. /// </summary> /// <param name="defaultName">The (unsaved) name of the to open</param> /// <param name="language">Name of the language used to choose the display binding.</param> /// <param name="content">Content of the file to create</param> public static IWorkbenchWindow NewFile(string defaultName, string language, string content) { IDisplayBinding binding = DisplayBindingService.GetBindingPerLanguageName(language); if (binding != null) { IViewContent newContent = binding.CreateContentForLanguage(language, content); if (newContent == null) { LoggingService.Warn(String.Format("Created view content was null{3}DefaultName:{0}{3}Language:{1}{3}Content:{2}", defaultName, language, content, Environment.NewLine)); return(null); } newContent.UntitledName = newContent.GetHashCode() + "/" + defaultName; DisplayBindingService.AttachSubWindows(newContent, false); WorkbenchSingleton.Workbench.ShowView(newContent); return(newContent.WorkbenchWindow); } else { throw new ApplicationException("Can't create display binding for language " + language); } }