Beispiel #1
0
        void OnClosed(object s, EventArgs a)
        {
            ProjectDomService.DomRegistered -= UpdateRegisteredDom;
            if (parseTimeout != 0)
            {
                GLib.Source.Remove(parseTimeout);
                parseTimeout = 0;
            }
            ClearTasks();

            string  currentParseFile   = FileName;
            Project curentParseProject = Project;

            if (window is SdiWorkspaceWindow)
            {
                ((SdiWorkspaceWindow)window).DetachFromPathedDocument();
            }
            window.Closed -= OnClosed;
            window.ActiveViewContentChanged -= OnActiveViewContentChanged;
            if (IdeApp.Workspace != null)
            {
                IdeApp.Workspace.ItemRemovedFromSolution -= OnEntryRemoved;
            }

            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;
            }

            // 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)
            {
                ProjectDomService.QueueParseJob(dom, delegate(string name, IProgressMonitor monitor) {
                    ProjectDomService.Parse(curentParseProject, currentParseFile);
                }, FileName);
            }
            if (isFileDom)
            {
                ProjectDomService.RemoveFileDom(FileName);
                dom = null;
            }

            Counters.OpenDocuments--;
        }
Beispiel #2
0
        void OnClosed(object s, EventArgs a)
        {
            closed = true;
            ClearTasks();

            string  currentParseFile   = FileName;
            Project curentParseProject = Project;

            if (window is SdiWorkspaceWindow)
            {
                ((SdiWorkspaceWindow)window).DetachFromPathedDocument();
            }
            window.Closed -= OnClosed;
            window.ActiveViewContentChanged -= OnActiveViewContentChanged;
            if (IdeApp.Workspace != null)
            {
                IdeApp.Workspace.ItemRemovedFromSolution -= OnEntryRemoved;
            }

            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;
            }

            // 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)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                    // Don't access Document properties from the thread
                    ProjectDomService.Parse(curentParseProject, currentParseFile, DesktopService.GetMimeTypeForUri(currentParseFile));
                });
            }
            if (fileDom != null)
            {
                ProjectDomService.RemoveFileDom(FileName);
                fileDom = null;
            }

            Counters.OpenDocuments--;
        }