/// <summary>
        /// Initializes a new instance of the CodeOutlineCache class.
        /// </summary>
        /// <param name="control">The SourceOutlinerControl.</param>
        /// <param name="dte">A DTE object exposing the Visual Studio automation object model.</param>
        public CodeOutlineCache(SourceOutlinerControl control, EnvDTE.DTE dte)
        {
            Debug.Assert(control != null);
            Debug.Assert(dte != null);

            _control = control;
            _dte = dte;

            // Initialize the events.
            AdviseCodeModelEvents();
        }
        /// <summary>
        /// Initializes a new instance of the CodeOutlineFileManager class.
        /// </summary>
        /// <param name="control">The outline control object.</param>
        /// <param name="dte">A DTE object exposing the Visual Studio automation object model.</param>
        /// <param name="d">The source file Document.</param>
        /// <param name="toolWindow">The tool window for the package.</param>
        public CodeOutlineFileManager(SourceOutlinerControl control, EnvDTE.DTE dte, 
            Document d, SourceOutlineToolWindow toolWindow)
        {
            _control = control;
            _dte = dte;
            _sourceOutlineToolWindow = toolWindow;
            _viewType = ViewType.TreeView;
            _searchCriteria = new SearchCriteria(CodeElementType.All);
            _currentFilterText = "";
            _currentDocument = d;

            _codeTreeView = new System.Windows.Forms.TreeView();
            _codeFilterView = new System.Windows.Forms.TreeView();

            //
            // _codeTreeView
            //
            _codeTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
            _codeTreeView.HideSelection = false;
            _codeTreeView.Location = new System.Drawing.Point(0, 45);
            _codeTreeView.Name = "codeTreeView";
            _codeTreeView.ShowNodeToolTips = true;
            _codeTreeView.Size = new System.Drawing.Size(352, 294);
            _codeTreeView.TabIndex = 2;

            //
            // _codeFilterView
            //
            _codeFilterView.Dock = System.Windows.Forms.DockStyle.Fill;
            _codeFilterView.HideSelection = false;
            _codeFilterView.Location = new System.Drawing.Point(0, 45);
            _codeFilterView.Name = "codeFilterView";
            _codeFilterView.ShowNodeToolTips = true;
            _codeFilterView.Size = new System.Drawing.Size(352, 294);
            _codeFilterView.TabIndex = 3;
            _codeFilterView.Visible = false;
            _codeFilterView.ShowLines = false;
            _codeFilterView.ShowRootLines = false;
            _codeFilterView.FullRowSelect = true;
        }
        /// <summary>
        /// Initializes a new instance of the SourceOutlineToolWindow class.
        /// </summary>
        public SourceOutlineToolWindow()
            : base(null)
        {
            this.Caption = Resources.ToolWindowTitle;

            // Set the image that will appear on the tab of the window frame
            // when docked with another window.
            // The resource ID correspond to the one defined in the resx file,
            // while the Index is the offset in the bitmap strip. Each image in
            // the strip is 16x16.
            this.BitmapResourceID = 301;
            this.BitmapIndex = 1;

            _control = new SourceOutlinerControl();

            // Populate the filter dropdown in the combo box with the
            // list of possible code elements to be displayed.
            foreach (string name in Enum.GetNames(typeof(CodeElementType)))
            {
                _control.filterToolStripCombo.Items.Add(name);
            }
            _control.filterToolStripCombo.SelectedIndex = 0;

            // Wire up the event handlers for the UI.
            _control.filterToolStripCombo.SelectedIndexChanged += new EventHandler(this.toolStripComboBox_SelectedIndexChanged);
            _control.filterStringTextBox.TextChanged += new EventHandler(filterStringTextBox_TextChanged);
            _control.filterStringTextBox.KeyDown += new KeyEventHandler(filterStringTextBox_KeyDown);
            _control.filterStringTextBox.KeyPress += new KeyPressEventHandler(filterStringTextBox_KeyPress);
            _control.filterStringTextBox.MouseDown += new MouseEventHandler(filterStringTextBox_MouseDown);
            _control.filterStringTextBox.Enter += new EventHandler(filterStringTextBox_Enter);
            _control.filterStringTextBox.Leave += new EventHandler(filterStringTextBox_Leave);
            _control.clearFilterButton.Click += new EventHandler(clearFilterButton_Click);
        }