/// <summary> /// Occurs when a solution is closing. /// </summary> /// <param name="fCancel">true to cancel the close, otherwise false.</param> private void solnEvents_QueryCloseSolution(ref bool fCancel) { _isSlnClosing = true; _control.HideTrees(); _swallowSelectedIndexChanged_toolStripComboBox = true; _control.filterToolStripCombo.SelectedIndex = 0; _swallowTextChanged_filterStringTextBox = true; _control.filterStringTextBox.Text = "<Filter>"; _control.Enabled = false; }
/// <summary> /// Loads a document into display TreeViews, updates the cache, and /// rebuilds the file manager that represents the document. /// </summary> /// <param name="d">The Document to load.</param> /// <param name="tw">The tool window associated with the cache.</param> /// <remarks> /// If the document is in the cache, it is reused. /// </remarks> public void AddDocumentToCache(Document d, SourceOutlinerToolWindow tw) { Debug.Assert(d != null); _toolWindow = tw; if (d == _document) { return; } if (_document != null) { // Unregister events for the previous document. tw.UnRegisterTreeEvents(_fileManager.TreeView, _fileManager.FilterView); _control.RemoveTreeFromControls(_fileManager.TreeView); _control.RemoveTreeFromControls(_fileManager.FilterView); } _document = d; _fileManager = new CodeOutlineFileManager(_control, _dte, d, tw); tw.RegisterTreeEvents(_fileManager.TreeView, _fileManager.FilterView); // Load the control. _control.AddTreeToControls(_fileManager.TreeView); _control.AddTreeToControls(_fileManager.FilterView); _fileManager.State = CodeOutlineFileManager.OutlineFileManagerState.StartLoadingCodeModel; _fileManager.HideTrees(); _control.HideTrees(); _control.TreeView = _fileManager.TreeView; _control.FilterView = _fileManager.FilterView; // Re-display the last CodeElementType selected for this document. tw.SelectedType = _fileManager.ElementFilter; // Re-display the last filter text entered for this document, but only if the file is loaded. if (_fileManager.State == CodeOutlineFileManager.OutlineFileManagerState.DoneLoadingCodeModel) { _fileManager.ReApplyText(); tw.SelectedFilterText = _fileManager.FilterText; } else { _control.Reset(); } }