private static string[] GetExtenderNames(ObjectExtenders extensionMgr, string catID, object extendee) { if (extensionMgr == null) { return(new string[0]); } try { Object obj = extensionMgr.GetExtenderNames(catID, extendee); if (obj == null || Convert.IsDBNull(obj)) { return(new string[0]); } if (obj is Array && typeof(string).IsAssignableFrom(obj.GetType().GetElementType())) { return((string[])((Array)obj)); } } catch { return(new string[0]); } return(new string[0]); }
public LibraryProjectExtenderProvider(ObjectExtenders extenders) { this.extenders = extenders; cookies = CategoryIds .Select(catId => this.extenders.RegisterExtenderProvider(catId, ExtenderName, this)) .ToArray(); }
public BrowseObjectExtenderProvider(IServiceProvider serviceProvider, string extenderCategory) { this.serviceProvider = serviceProvider; this.objectExtenders = (ObjectExtenders)serviceProvider.GetService(typeof(ObjectExtenders)); this.extenderCategory = extenderCategory; this.providerCookie = this.objectExtenders.RegisterExtenderProvider(extenderCategory, BrowseObjectExtenderProvider.ExtenderName, this); }
public BrowseObjectExtenderProvider(IAsyncServiceProvider2 serviceProvider, ObjectExtenders objectExtenders, string extenderCategory) { this.serviceProvider = serviceProvider; this.objectExtenders = objectExtenders; this.extenderCategory = extenderCategory; this.providerCookie = this.objectExtenders.RegisterExtenderProvider(extenderCategory, BrowseObjectExtenderProvider.ExtenderName, this); }
/// <summary> /// This is overridden to initialize the package /// </summary> /// <remarks>This method is called right after the package is sited, so /// this is the place where you can put all the initialization code /// that relies on services provided by Visual Studio.</remarks> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); SandcastleBuilderPackage.Instance = this; // Register the project factory this.RegisterProjectFactory(new SandcastleBuilderProjectFactory(this)); // Register the SHFB file editor factories base.RegisterEditorFactory(new ContentLayoutEditorFactory()); base.RegisterEditorFactory(new ResourceItemEditorFactory()); base.RegisterEditorFactory(new SiteMapEditorFactory()); base.RegisterEditorFactory(new TokenEditorFactory()); // Create the update solution event listener for build completed events buildCompletedListener = new BuildCompletedEventListener(this); ObjectExtenders objectExtenders = (ObjectExtenders)GetService(typeof(ObjectExtenders)); _singleFileGeneratorNodeExtenderProvider = new SingleFileGeneratorNodeExtenderProvider(); string extenderCatId = typeof(SandcastleBuilderFileNodeProperties).GUID.ToString("B"); string extenderName = SingleFileGeneratorNodeExtenderProvider.Name; string localizedName = extenderName; _singleFileGeneratorNodeExtenderCookie = objectExtenders.RegisterExtenderProvider(extenderCatId, extenderName, _singleFileGeneratorNodeExtenderProvider, localizedName); }
private static string[] GetContextualCatIDs(ObjectExtenders extensionMgr) { string[] catIds = null; try { Object obj = extensionMgr.GetContextualExtenderCATIDs(); #if DEBUG string vType = obj.GetType().FullName; #endif if (obj.GetType().IsArray) { Array catIDArray = (Array)obj; if (typeof(string).IsAssignableFrom(catIDArray.GetType().GetElementType())) { catIds = (string[])catIDArray; } } } catch { } return(catIds); }
private static Hashtable GetExtenders(ObjectExtenders extensionMgr, string catID, object extendee, Hashtable ht) { if (extensionMgr == null) { return(null); } if (ht == null) { ht = new Hashtable(); } object pDisp = extendee; // generate the extender name list. string[] extenderNames = GetExtenderNames(extensionMgr, catID, pDisp); for (int i = 0; i < extenderNames.Length; i++) { try { object pDispExtender = extensionMgr.GetExtender(catID, extenderNames[i], pDisp); if (pDispExtender != null) { // we've got one, so add it to our list ht.Add(extenderNames[i], pDispExtender); } } catch { } } return(ht); }
private async Task RegisterExtenderProviderAsync(string catId) { await JoinableTaskFactory.SwitchToMainThreadAsync(DisposalToken); const string name = AutoT4ExtenderProvider.Name; _objectExtenders = _objectExtenders ?? await GetServiceAsync(typeof(ObjectExtenders)) as ObjectExtenders; Assumes.Present(_objectExtenders); _extenderProvider = _extenderProvider ?? new AutoT4ExtenderProvider(_dte); _extenderProviderCookies.Add(_objectExtenders.RegisterExtenderProvider(catId, name, _extenderProvider)); }
private void RegisterExtenderProvider(string catId) { const string name = AutoT4ExtenderProvider.Name; _objectExtenders = _objectExtenders ?? GetService(typeof(ObjectExtenders)) as ObjectExtenders; if (_objectExtenders == null) { return; } _extenderProvider = _extenderProvider ?? new AutoT4ExtenderProvider(_dte, this); _extenderProviderCookies.Add(_objectExtenders.RegisterExtenderProvider(catId, name, _extenderProvider)); }
//void RegisterExtenderProvider() //{ // var provider = new PropertyExtenderProvider(_dte, this); // string name = PropertyExtenderProvider.ExtenderName; // RegisterExtenderProvider(VSConstants.CATID.CSharpFileProperties_string, name, provider); // RegisterExtenderProvider(VSConstants.CATID.VBFileProperties_string, name, provider); //} //void RegisterExtenderProvider(string extenderCatId, string name, IExtenderProvider extenderProvider) //{ // int cookie = _dte.ObjectExtenders.RegisterExtenderProvider(extenderCatId, name, extenderProvider); // _registerExtenderProviders.Add(cookie, extenderProvider); //} void RegisterExtenderProvider() { this._extensionManager = this.GetService(typeof(ObjectExtenders)) as ObjectExtenders; if (this._extensionManager == null) { throw new InvalidOperationException("Failed to resolve the extension manager."); } this._rebuildTTPropertyExtenderProviderCookie = this._extensionManager.RegisterExtenderProvider( RebuildTTExtenderProvider.SupportedExtenderCATID, RebuildTTExtenderProvider.SupportedExtenderName, new RebuildTTExtenderProvider()); }
//===================================================================== /// <inheritdoc /> protected override void Dispose(bool disposing) { if (disposing) { ObjectExtenders objectExtenders = (ObjectExtenders)GetService(typeof(ObjectExtenders)); objectExtenders.UnregisterExtenderProvider(_singleFileGeneratorNodeExtenderCookie); SandcastleBuilderPackage.Instance = null; if (buildCompletedListener != null) { buildCompletedListener.Dispose(); buildCompletedListener = null; } } base.Dispose(disposing); }
private void RegisterExtenderProvider(string catId) { const string name = AutoT4ExtenderProvider.Name; _objectExtenders = _objectExtenders ?? GetService(typeof(ObjectExtenders)) as ObjectExtenders; if (_objectExtenders == null) return; _extenderProvider = _extenderProvider ?? new AutoT4ExtenderProvider(_dte); _extenderProviderCookies.Add(_objectExtenders.RegisterExtenderProvider(catId, name, _extenderProvider)); }
private static Hashtable GetExtenders(ObjectExtenders extensionMgr, string catID, object extendee, Hashtable ht) { if (extensionMgr == null) { return null; } if (ht == null) { ht = new Hashtable(); } object pDisp = extendee; // generate the extender name list. string[] extenderNames = GetExtenderNames(extensionMgr, catID, pDisp); for (int i = 0; i < extenderNames.Length; i++) { try { object pDispExtender = extensionMgr.GetExtender(catID, extenderNames[i], pDisp); if (pDispExtender != null) { // we've got one, so add it to our list ht.Add(extenderNames[i], pDispExtender); } } catch { } } return ht; }
private static string[] GetExtenderNames(ObjectExtenders extensionMgr, string catID, object extendee) { if (extensionMgr == null) { return new string[0]; } try { Object obj = extensionMgr.GetExtenderNames(catID, extendee); if (obj == null || Convert.IsDBNull(obj)) { return new string[0]; } if (obj is Array && typeof(string).IsAssignableFrom(obj.GetType().GetElementType())) { return(string[])((Array)obj); } } catch { return new string[0]; } return new string[0]; }
private static string[] GetContextualCatIDs(ObjectExtenders extensionMgr) { string[] catIds = null; try { Object obj = extensionMgr.GetContextualExtenderCATIDs(); #if DEBUG string vType = obj.GetType().FullName; #endif if (obj.GetType().IsArray) { Array catIDArray = (Array)obj; if (typeof(string).IsAssignableFrom(catIDArray.GetType().GetElementType())) { catIds = (string[])catIDArray; } } } catch { } return catIds; }
internal AutomationExtenderManager(ObjectExtenders oe) { this.extensionMgr = oe; }
public object get_Extender(string extenderName) { ObjectExtenders extenderService = (ObjectExtenders)ProjectMgr.GetService(typeof(ObjectExtenders)); return(extenderService.GetExtender(ExtenderCATID, extenderName, this)); }