public void SetUp() { var container = new CompositionContainer( AssemblyOf <IContentTypeSpecificService>(), AssemblyOf <IContentTypeRegistry>()); _registry = container.GetExportedValue <IContentTypeRegistry>(); }
/// <summary> /// Returns the content type specific implementation of service <typeparamref name="T"/> /// based on a file extension. /// </summary> /// <typeparam name="T">Service contract.</typeparam> /// <returns>Returns default(T) if either the content type or the service are not /// found.</returns> public static T ServiceForFileExtension <T>(this IContentTypeRegistry contentTypeRegistry, string fileExtension) { var contentType = contentTypeRegistry.ForFileExtension(fileExtension); return(contentType != null ? contentType.GetService <T>() : default(T)); }
public void Dispose() { if (this.loader == null) { return; } this.loader.Dispose(); this.loader = (Loader)null; this.textBufferFactoryProvider = (ITextBufferFactory)null; this.textEditorFactoryProvider = (ITextEditorFactory)null; this.editorCommandsProvider = (IEditorOperationsProvider)null; this.undoManagerProvider = (ITextBufferUndoManagerProvider)null; this.contentTypeRegistry = (IContentTypeRegistry)null; this.squiggleProviderFactory = (ISquiggleProviderFactory)null; this.completionBrokerMap = (ICompletionBrokerMap)null; this.undoHistoryRegistry = (IUndoHistoryRegistry)null; }
private void Initialize() { if (this.ready) { return; } if (this.loader == null) { this.loader = Loader.CreateLoader(((EditingService.CompiledCompositionEntryPoint)Delegate.CreateDelegate(typeof(EditingService.CompiledCompositionEntryPoint), Assembly.LoadFile(Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(EditingService)).Location), "Microsoft.Nautilus.Composition.dll")).EntryPoint))()); this.loader.Initialize(); } this.textBufferFactoryProvider = this.loader.GetService <ITextBufferFactory>(); this.textEditorFactoryProvider = this.loader.GetService <ITextEditorFactory>(); this.editorCommandsProvider = this.loader.GetService <IEditorOperationsProvider>(); this.undoManagerProvider = this.loader.GetService <ITextBufferUndoManagerProvider>(); this.contentTypeRegistry = this.loader.GetService <IContentTypeRegistry>(); this.squiggleProviderFactory = this.loader.GetService <ISquiggleProviderFactory>(); this.completionBrokerMap = this.loader.GetService <ICompletionBrokerMap>(); this.undoHistoryRegistry = this.loader.GetService <IUndoHistoryRegistry>(); this.contentTypeRegistry.AddContentType("text.xml", "XML", (IEnumerable <string>) new string[1] { "text" }); this.contentTypeRegistry.AddContentType("text.xaml", "XAML", (IEnumerable <string>) new string[1] { "text" }); this.contentTypeRegistry.AddContentType("text.C#", "C#", (IEnumerable <string>) new string[1] { "text" }); this.contentTypeRegistry.AddContentType("text.VB", "VB", (IEnumerable <string>) new string[1] { "text" }); this.contentTypeRegistry.AddContentType("text.JS", "JS", (IEnumerable <string>) new string[1] { "text" }); this.ready = true; }
public EngineTreeNodeProviderFactory(IContentTypeRegistry contentTypeRegistry, IServiceLocatorWrapper serviceLocator) { this.serviceLocator = serviceLocator; this.contentTypeRegistry = contentTypeRegistry; }