/// <summary>At the end of a task, shut down the progress monitor</summary>
        private void StopProgressMonitor()
        {
            timer.Stop();

            /*if(progressMonitor!=null) {
             * progressMonitor.setProgress(progressMonitor.getMaximum());
             * progressMonitor.close();
             * }*/
            progressBar.SetVisible(false);
            if (glassPane != null)
            {
                glassPane.SetVisible(false);
            }
            // restore input to components
            lpThread    = null;
            parseThread = null;
        }
        /// <summary>
        /// Tokenizes the highlighted text (using a tokenizer appropriate for the
        /// selected language, and initiates the ParseThread to parse the tokenized
        /// text.
        /// </summary>
        public virtual void Parse()
        {
            if (textPane.GetText().Length == 0)
            {
                return;
            }
            // use endIndex+1 because substring subtracts 1
            string text = Sharpen.Runtime.Substring(textPane.GetText(), startIndex, endIndex + 1).Trim();

            if (parser != null && text.Length > 0)
            {
                //Tokenizer<? extends HasWord> toke = tlp.getTokenizerFactory().getTokenizer(new CharArrayReader(text.toCharArray()));
                ITokenizer <IHasWord> toke     = tlp.GetTokenizerFactory().GetTokenizer(new StringReader(text));
                IList <IHasWord>      wordList = toke.Tokenize();
                parseThread = new ParserPanel.ParseThread(this, wordList);
                parseThread.Start();
                StartProgressMonitor("Parsing", ParseTime);
            }
        }