internal void DisposeDocument() { DetachExtensionChain(); RemoveAnnotations(typeof(System.Object)); if (window is SdiWorkspaceWindow) { ((SdiWorkspaceWindow)window).DetachFromPathedDocument(); } window.Closed -= OnClosed; window.ActiveViewContentChanged -= OnActiveViewContentChanged; if (IdeApp.Workspace != null) { IdeApp.Workspace.ItemRemovedFromSolution -= OnEntryRemoved; } // Unsubscribe project events if (window.ViewContent.Project != null) { window.ViewContent.Project.Modified -= HandleProjectModified; } window.ViewsChanged += HandleViewsChanged; window = null; parsedDocument = null; singleFileContext = null; provider = null; views = null; viewsRO = null; }
void OnClosed(object s, EventArgs a) { isClosed = true; // TypeSystemService.DomRegistered -= UpdateRegisteredDom; CancelParseTimeout(); ClearTasks(); TypeSystemService.RemoveSkippedfile(FileName); if (window is SdiWorkspaceWindow) { ((SdiWorkspaceWindow)window).DetachFromPathedDocument(); } window.Closed -= OnClosed; window.ActiveViewContentChanged -= OnActiveViewContentChanged; if (IdeApp.Workspace != null) { IdeApp.Workspace.ItemRemovedFromSolution -= OnEntryRemoved; } // Unsubscribe project events if (window.ViewContent.Project != null) { window.ViewContent.Project.Modified -= HandleProjectModified; } try { OnClosed(a); } catch (Exception ex) { LoggingService.LogError("Exception while calling OnClosed.", ex); } while (editorExtension != null) { try { editorExtension.Dispose(); } catch (Exception ex) { LoggingService.LogError("Exception while disposing extension:" + editorExtension, ex); } editorExtension = editorExtension.Next as TextEditorExtension; } editorExtension = null; // Parse the file when the document is closed. In this way if the document // is closed without saving the changes, the saved compilation unit // information will be restored /* if (currentParseFile != null) { * TypeSystemService.QueueParseJob (dom, delegate (string name, IProgressMonitor monitor) { * TypeSystemService.Parse (curentParseProject, currentParseFile); * }, FileName); * } * if (isFileDom) { * TypeSystemService.RemoveFileDom (FileName); * dom = null; * }*/ parsedDocument = null; provider = null; Counters.OpenDocuments--; }