public override void Load(OpenedFile file, Stream stream) { if (file != PrimaryFile) { return; } isLoading = true; try { BookmarksDetach(); codeEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(file.FileName)); if (!file.IsUntitled) { codeEditor.PrimaryTextEditor.IsReadOnly = (File.GetAttributes(file.FileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly; } codeEditor.Load(stream); // Load() causes the undo stack to think stuff changed, so re-mark the file as original if necessary if (!this.PrimaryFile.IsDirty) { codeEditor.Document.UndoStack.MarkAsOriginalFile(); } // we set the file name after loading because this will place the fold markers etc. codeEditor.FileName = FileName.Create(file.FileName); BookmarksAttach(); } finally { isLoading = false; } }