/// <summary> /// Shows the tool window when the menu item is clicked. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event args.</param> private void ShowToolWindow(object sender, EventArgs e) { // Get the instance number 0 of this tool window. This window is single instance so this instance // is actually the only one. // The last flag is set to true so that if the tool window does not exists it will be created. var window = _package.FindToolWindow(typeof(SqlExplorer), 0, true) as SqlExplorer; if ((null == window) || (null == window.Frame)) { throw new NotSupportedException("Cannot create tool window"); } SqlExplorerToolbarCommands.SetWindow(window); IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); window.SearchHost.Activate(); }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(Package package) { Instance = new SqlExplorerCommand(package); SqlExplorerToolbarCommands.Init(); }