private void BuildControllerSet() { var controllerFactories = ComponentLocatorForOrderedContentType <IControllerFactory> .ImportMany(_shell.CompositionService, TextBuffer.ContentType); if (controllerFactories != null) { foreach (var factory in controllerFactories) { _controllers.AddRange(factory.Value.GetControllers(TextView, TextBuffer)); } } }
/// <summary> /// Retrieves all services of a particular type available for the content type. /// Services are ordered in a way they should be accessed. This applies, for example, /// to command controller factories so controllers are called in a specific order. /// </summary> /// <typeparam name="T">Service type</typeparam> /// <param name="contentType">Content (file) type such as 'R' or 'Markdown'</param> /// <returns>Collection of service instances, if any</returns> public IEnumerable <Lazy <T> > GetAllOrderedServices <T>(string contentType) where T : class { var ct = _ctrs.GetContentType(contentType); return(ct != null ? ComponentLocatorForOrderedContentType <T> .ImportMany(_compositionService, ct) : Enumerable.Empty <Lazy <T> >()); }