public void Initialize(IDocument document) { if (this.document == null) { this.document = document; this.textDocument = (TextDocument)document.GetService(typeof(TextDocument)); this.changeList = new CompressingTreeList<LineChangeInfo>((x, y) => x.Equals(y)); } var fileName = ((ITextEditor)document.GetService(typeof(ITextEditor))).FileName; InitializeBaseDocument(); if (watcher != null) watcher.Dispose(); if (usedProvider != null) watcher = usedProvider.WatchBaseVersionChanges(fileName, HandleBaseVersionChanges); SetupInitialFileState(fileName != currentFileName); currentFileName = fileName; if (!this.textDocument.LineTrackers.Contains(this)) { this.textDocument.LineTrackers.Add(this); this.textDocument.UndoStack.PropertyChanged += UndoStackPropertyChanged; } }
public void Initialize(IDocument document) { if (this.document == null) { this.document = document; this.textDocument = (TextDocument)document.GetService(typeof(TextDocument)); this.changeList = new CompressingTreeList <LineChangeInfo>((x, y) => x.Equals(y)); } var fileName = ((ITextEditor)document.GetService(typeof(ITextEditor))).FileName; InitializeBaseDocument(); if (watcher != null) { watcher.Dispose(); } if (usedProvider != null) { watcher = usedProvider.WatchBaseVersionChanges(fileName, HandleBaseVersionChanges); } SetupInitialFileState(fileName != currentFileName); currentFileName = fileName; if (!this.textDocument.LineTrackers.Contains(this)) { this.textDocument.LineTrackers.Add(this); this.textDocument.UndoStack.PropertyChanged += UndoStackPropertyChanged; } }