private void DisposePlugin() { pi.DeleteCommand(); this.PlugIn.DeleteCommand(); if (this.PlugIn is IWindowActivatedPlugin) { ((IWindowActivatedPlugin)this.PlugIn).UnHookWindowActivation(); } pi.Dispose(); pi = null; }
public void ConstructPlugin() { //BIDSHelperPluginBase pi; System.Type[] @params = { typeof(DTE2), typeof(AddIn) }; System.Reflection.ConstructorInfo con; con = pluginType.GetConstructor(@params); pi = (BIDSHelperPluginBase)con.Invoke(new object[] { _applicationObject, _addInInstance }); pi.AddinCore = _core; //addins.Add(ext.FullName, ext); if (pi is IWindowActivatedPlugin) { ((IWindowActivatedPlugin)pi).HookWindowActivation(); } pi.AddCommand(); }
/// <summary> /// Called when help is clicked. /// </summary> void IDTToolsOptionsPage.OnHelp() { // First check we are disabled, show info on how to enable if (this.lblCurrentlyDisabled.Visible) { MessageBox.Show("Add-Ins can be enabled or disabled using the Add-In Manager option on the Tools menu.", DefaultMessageBoxCaption); } else { // Check we have a selected item GridItem item = this.propertyGridFeatures.SelectedGridItem; if (item != null) { // Check we have a property if (item.GridItemType == GridItemType.Property) { // Show property specific help... // Get property host/collection, to get the selected property, to access the plugin, to get the url CustomClass featuresHost = propertyGridFeatures.SelectedObject as CustomClass; foreach (CustomProperty property in featuresHost) { if (property.Name == item.Label) { BIDSHelperPluginBase plugin = property.Plugin; string helpUrl = plugin.HelpUrl; if (!string.IsNullOrEmpty(helpUrl)) { OpenUrl(plugin.HelpUrl); } else { MessageBox.Show("Sorry, no help page is available for this plug-in.", DefaultMessageBoxCaption); } return; } } } } } // Default trap MessageBox.Show("Please select an individual feature to access detailed help.", DefaultMessageBoxCaption); }
/// <summary> /// Initializes a new instance of the <see cref="CustomProperty"/> class, using a <see cref="BIDSHelperPluginBase"/> instance. /// </summary> /// <param name="plugin">The BIDS Helper plugin to represent as a feature enabled property.</param> public CustomProperty(BIDSHelperPluginBase plugin) { this.Plugin = plugin; this.name = plugin.FeatureName; this.description = plugin.FeatureDescription; this.objValue = plugin.Enabled; this.type = typeof(bool); this.readOnly = false; this.visible = true; this.category = GetFeatureCategoryLabel(plugin.FeatureCategory); this.childern = new Collection <CustomProperty>(); #if DEBUG // Write out list of all plugins as we create the property collection, // used for easy spell checking System.Diagnostics.Debug.WriteLine(this.name); System.Diagnostics.Debug.WriteLine(this.description); System.Diagnostics.Debug.WriteLine(string.Empty); #endif }
//#if DENALI || SQL2014 public static Microsoft.AnalysisServices.BackEnd.DataModelingSandbox GetTabularSandboxFromBimFile(Core.BIDSHelperPluginBase plugin, bool openIfNotOpen) { UIHierarchy solExplorer = plugin.ApplicationObject.ToolWindows.SolutionExplorer; if (((System.Array)solExplorer.SelectedItems).Length != 1) { return(null); } UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); string sFileName = ""; if (hierItem.Object is ProjectItem) { sFileName = ((ProjectItem)hierItem.Object).Name.ToLower(); } if (sFileName.EndsWith(".bim")) { Microsoft.AnalysisServices.VSHost.VSHostManager host = GetVSHostManager(hierItem, openIfNotOpen); if (host == null) { return(null); } return(host.Sandbox); } else { foreach (UIHierarchyItem hierItem2 in VisualStudioHelpers.GetAllItemsFromSolutionExplorer(plugin.ApplicationObject.ToolWindows.SolutionExplorer)) { if (hierItem2.Name != null && hierItem2.Name.ToLower().EndsWith(".bim")) { Microsoft.AnalysisServices.VSHost.VSHostManager host = GetVSHostManager(hierItem2, openIfNotOpen); if (host == null) { return(null); } return(host.Sandbox); } } } return(null); }
//#endif #if !DENALI && !SQL2014 public static Microsoft.AnalysisServices.BackEnd.DataModelingSandboxAmo GetTabularSandboxAmoFromBimFile(Core.BIDSHelperPluginBase plugin, bool openIfNotOpen) { UIHierarchy solExplorer = plugin.ApplicationObject.ToolWindows.SolutionExplorer; if (((System.Array)solExplorer.SelectedItems).Length != 1) { return(null); } UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); if (!(hierItem.Object is ProjectItem)) { return(null); } string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower(); if (sFileName.EndsWith(".bim")) { Microsoft.AnalysisServices.VSHost.VSHostManager host = GetVSHostManager(hierItem, openIfNotOpen); if (host == null) { return(null); } if (!host.Sandbox.IsTabularMetadata) { return((Microsoft.AnalysisServices.BackEnd.DataModelingSandboxAmo)host.Sandbox.Impl); } } return(null); }