/// <summary>
        /// Populates the Class Explorer combobox, taking all of the defined class declarations from the current
        /// document using a regular expression.
        /// </summary>
        private void PopulateClassExplorer()
        {
            classes.Clear();
            cboClassExplorer.Items.Clear();

            MatchCollection matches = FindClasses(txtCodeEditor.Text);

            foreach (Match match in matches)
            {
                string definedClass = match.Value.Trim();

                DropDownItem item = new DropDownItem();
                item.Title = definedClass.Substring(definedClass.LastIndexOf(" ")).Trim();
                item.Position = match.Index; //Store the classes position in the code editor

                classes.Add(item);
                cboClassExplorer.Items.Add(item.Title);
            }

            // Sort them descending, alphabetically.
            classes.Sort(delegate(DropDownItem item1, DropDownItem item2)
            {
                return item1.Title.CompareTo(item2.Title);
            });
        }
        /// <summary>
        /// Adds all of the members declared in this RPGCode program to the Object Explorer.
        /// </summary>
        private void AddMembersToObjectExplorer()
        {
            MatchCollection matches = FindClassMembers(txtCodeEditor.Text);

            foreach (Match match in matches)
            {
                string variable = match.Value.Trim();

                DropDownItem item = new DropDownItem();
                item.Type = DropDownType.Var;
                item.Position = match.Index;
                item.Title = variable.Substring(variable.LastIndexOf(" ")).Trim();

                declarations.Add(item);
                cboObjectExplorer.Items.Add(item.Title);
            }
        }
        /// <summary>
        /// Adds all of the methods declared in this RPGCode program to the Object Explorer.
        /// </summary>
        private void AddMethodsToObjectExplorer()
        {
            // We need to use a different Regex when matching methods for the Object Explorer,
            // because we want to get the parameter lists.
            Regex expression = new Regex(@"^(?<range>[\w\s]*\b(method|function)[^\S\n]+(\w+::)?([~]?\w+\(.*\)\s+))",
                RegexOptions.Multiline | RegexOptions.IgnoreCase);

            foreach (Match match in expression.Matches(txtCodeEditor.Text))
            {
                string method = match.Value.Trim();

                DropDownItem item = new DropDownItem();
                item.Type = DropDownType.Method;
                item.Title = method.Substring(method.IndexOf(" ")).Trim(); //remove the word method
                item.Position = match.Index;

                declarations.Add(item);
                cboObjectExplorer.Items.Add(item.Title);
            }
        }
        /// <summary>
        /// Adds all of the globals declared in this RPGCode program to the Object Explorer.
        /// </summary>
        private void AddGlobalsToObjectExplorer()
        {
            MatchCollection matches = FindGlobalVariables(txtCodeEditor.Text);

            foreach (Match match in matches)
            {
                DropDownItem item = new DropDownItem();
                // Figure out how to access groups based on name.
                string variable = match.Groups[3].Value;

                item.Type = DropDownType.Global;
                item.Position = match.Index;
                item.Title = variable;

                declarations.Add(item);
                cboObjectExplorer.Items.Add(item.Title);
            }
        }