Esempio n. 1
0
        /// <summary>
        /// Closes the document
        /// </summary>
        public virtual void Close()
        {
            if (IsClosed)
            {
                return;
            }

            IsClosed = true;
            _textDocumentFactoryService.TextDocumentDisposed -= OnTextDocumentDisposed;

            DocumentClosing?.Invoke(this, null);

            if (EditorTree != null)
            {
                _editorTree.Dispose(); // this will also remove event handlers
                _editorTree = null;
            }

            if (DocumentClosing != null)
            {
                foreach (EventHandler <EventArgs> eh in DocumentClosing.GetInvocationList())
                {
                    Debug.Fail(String.Format(CultureInfo.CurrentCulture, "There are still listeners in the EditorDocument.OnDocumentClosing event list: {0}", eh.Target));
                    DocumentClosing -= eh;
                }
            }

            ServiceManager.RemoveService <REditorDocument>(TextBuffer);
            TextBuffer = null;
        }
Esempio n. 2
0
 protected void RaiseDocumentClosingEvent(EnvDTE.Document document) => DocumentClosing?.Invoke(document);
Esempio n. 3
0
 private void OnDocumentClosing(DocumentContent documentContent)
 {
     DocumentClosing?.Invoke(documentContent);
 }