public TextEditorDocumentWrapper()
        {
            //Document = (new DocumentFactory()).CreateDocument();
            //Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();

            Document = TheOneAndOnly.Document;
            
            // remove other listeners
            //RemoveAllChangedHandlers();
            if (PreviousInstance != null)
                PreviousInstance.Dispose();
            PreviousInstance = this;

            TheOneAndOnly.ResetText();
            Document.UndoStack.ClearAll();
            TheOneAndOnly.Refresh();

            Document.DocumentChanged += new DocumentEventHandler(Document_DocumentChanged);
        }
        public TextEditorDocumentWrapper()
        {
            //Document = (new DocumentFactory()).CreateDocument();
            //Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();

            Document = TheOneAndOnly.Document;

            // remove other listeners
            //RemoveAllChangedHandlers();
            if (PreviousInstance != null)
            {
                PreviousInstance.Dispose();
            }
            PreviousInstance = this;

            TheOneAndOnly.ResetText();
            Document.UndoStack.ClearAll();
            TheOneAndOnly.Refresh();

            Document.DocumentChanged += new DocumentEventHandler(Document_DocumentChanged);
        }