internal static HtmlIntellisenseController GetOrCreateController(IComponentModel model, ITextView textView)
 {
     HtmlIntellisenseController controller;
     if (!textView.Properties.TryGetProperty<HtmlIntellisenseController>(typeof(HtmlIntellisenseController), out controller))
     {
         var intellisenseControllerProvider = (
            from export in model.DefaultExportProvider.GetExports<IIntellisenseControllerProvider, IContentTypeMetadata>()
            from exportedContentType in export.Metadata.ContentTypes
            where exportedContentType.Equals("HTML", StringComparison.OrdinalIgnoreCase) && export.Value.GetType() == typeof(HtmlIntellisenseControllerProvider)
            select export.Value
         ).First();
         controller = new HtmlIntellisenseController((HtmlIntellisenseControllerProvider)intellisenseControllerProvider, textView);
         textView.Properties.AddProperty(typeof(HtmlIntellisenseController), controller);
     }
     return controller;
 }
コード例 #2
0
        internal static HtmlIntellisenseController GetOrCreateController(IComponentModel model, ITextView textView)
        {
            HtmlIntellisenseController controller;

            if (!textView.Properties.TryGetProperty <HtmlIntellisenseController>(typeof(HtmlIntellisenseController), out controller))
            {
                var intellisenseControllerProvider = (
                    from export in model.DefaultExportProvider.GetExports <IIntellisenseControllerProvider, IContentTypeMetadata>()
                    from exportedContentType in export.Metadata.ContentTypes
                    where exportedContentType.Equals("HTML", StringComparison.OrdinalIgnoreCase) && export.Value.GetType() == typeof(HtmlIntellisenseControllerProvider)
                    select export.Value
                    ).First();
                controller = new HtmlIntellisenseController((HtmlIntellisenseControllerProvider)intellisenseControllerProvider, textView);
                textView.Properties.AddProperty(typeof(HtmlIntellisenseController), controller);
            }
            return(controller);
        }
        public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList<ITextBuffer> subjectBuffers)
        {
            HtmlIntellisenseController controller = null;
            if (!textView.Properties.TryGetProperty<HtmlIntellisenseController>(typeof(HtmlIntellisenseController), out controller))
            {
                foreach (var buffer in subjectBuffers)
                {
                    if (buffer.Properties.ContainsProperty(typeof(PhpProjectionBuffer)))
                    { // it's one of our buffers
                        controller = new HtmlIntellisenseController(this, textView);
                        textView.Properties.AddProperty(typeof(HtmlIntellisenseController), controller);
                    }
                }
            }

            return controller;
        }
コード例 #4
0
        public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            HtmlIntellisenseController controller = null;

            if (!textView.Properties.TryGetProperty <HtmlIntellisenseController>(typeof(HtmlIntellisenseController), out controller))
            {
                foreach (var buffer in subjectBuffers)
                {
                    if (buffer.Properties.ContainsProperty(typeof(PhpProjectionBuffer)))
                    { // it's one of our buffers
                        controller = new HtmlIntellisenseController(this, textView);
                        textView.Properties.AddProperty(typeof(HtmlIntellisenseController), controller);
                    }
                }
            }

            return(controller);
        }