コード例 #1
0
ファイル: EditorModel.cs プロジェクト: csuffyy/AvalonStudio
        public void UnRegisterLanguageService()
        {
            ShutdownBackgroundWorkers();

            UnsavedFile unsavedFile = null;

            lock (UnsavedFiles)
            {
                unsavedFile = UnsavedFiles.BinarySearch(ProjectFile.Location);
            }

            if (unsavedFile != null)
            {
                lock (UnsavedFiles)
                {
                    UnsavedFiles.Remove(unsavedFile);
                }
            }

            if (LanguageService != null && ProjectFile != null)
            {
                LanguageService.UnregisterSourceFile(Editor, ProjectFile);
            }

            TextDocument.TextChanged -= TextDocument_TextChanged;
        }
コード例 #2
0
ファイル: CodeEditor.cs プロジェクト: liquidboy/AvalonStudio
        public void Save()
        {
            if (SourceFile != null && Document != null && IsDirty)
            {
                try
                {
                    FormatAll();
                }
                catch (Exception)
                {
                }

                if (Settings.GetSettings <EditorSettings>().RemoveTrailingWhitespaceOnSave)
                {
                    Document.TrimTrailingWhiteSpace();
                }

                File.WriteAllText(SourceFile.Location, Document.Text);
                IsDirty = false;

                lock (UnsavedFiles)
                {
                    var unsavedFile = UnsavedFiles.BinarySearch(SourceFile.Location);

                    if (unsavedFile != null)
                    {
                        UnsavedFiles.Remove(unsavedFile);
                    }
                }
            }
        }
コード例 #3
0
ファイル: CodeEditor.cs プロジェクト: liquidboy/AvalonStudio
        private void UnRegisterLanguageService()
        {
            _languageServiceDisposables?.Dispose();

            if (_scopeLineBackgroundRenderer != null)
            {
                TextArea.TextView.BackgroundRenderers.Remove(_scopeLineBackgroundRenderer);
            }

            if (_textColorizer != null)
            {
                TextArea.TextView.LineTransformers.Remove(_textColorizer);
                _textColorizer = null;
            }

            if (_diagnosticMarkersRenderer != null)
            {
                TextArea.TextView.BackgroundRenderers.Remove(_diagnosticMarkersRenderer);
                _diagnosticMarkersRenderer = null;
            }

            ShutdownBackgroundWorkers();

            UnsavedFile unsavedFile = null;

            lock (UnsavedFiles)
            {
                unsavedFile = UnsavedFiles.BinarySearch(SourceFile.Location);
            }

            if (unsavedFile != null)
            {
                lock (UnsavedFiles)
                {
                    UnsavedFiles.Remove(unsavedFile);
                }
            }

            if (LanguageService != null)
            {
                LanguageService.UnregisterSourceFile(DocumentAccessor);
            }

            Document.TextChanged -= TextDocument_TextChanged;

            TextArea.TextEntering -= TextArea_TextEntering;
            TextArea.TextEntered  -= TextArea_TextEntered;

            _intellisenseManager = null;
        }
コード例 #4
0
ファイル: EditorModel.cs プロジェクト: csuffyy/AvalonStudio
        public void Save()
        {
            if (ProjectFile != null && TextDocument != null && IsDirty)
            {
                System.IO.File.WriteAllText(ProjectFile.Location, TextDocument.Text);
                IsDirty = false;

                lock (UnsavedFiles)
                {
                    var unsavedFile = UnsavedFiles.BinarySearch(ProjectFile.Location);

                    if (unsavedFile != null)
                    {
                        UnsavedFiles.Remove(unsavedFile);
                    }
                }
            }
        }
コード例 #5
0
        public void UnRegisterLanguageService()
        {
            if (_scopeLineBackgroundRenderer != null)
            {
                TextArea.TextView.BackgroundRenderers.Remove(_scopeLineBackgroundRenderer);
            }

            if (_textColorizer != null)
            {
                TextArea.TextView.LineTransformers.Remove(_textColorizer);
                _textColorizer = null;
            }

            if (_diagnosticMarkersRenderer != null)
            {
                TextArea.TextView.BackgroundRenderers.Remove(_diagnosticMarkersRenderer);
                _diagnosticMarkersRenderer = null;
            }

            ShutdownBackgroundWorkers();

            UnsavedFile unsavedFile = null;

            lock (UnsavedFiles)
            {
                unsavedFile = UnsavedFiles.BinarySearch(SourceFile.Location);
            }

            if (unsavedFile != null)
            {
                lock (UnsavedFiles)
                {
                    UnsavedFiles.Remove(unsavedFile);
                }
            }

            if (LanguageService != null)
            {
                LanguageService.UnregisterSourceFile(this, SourceFile);
            }

            Document.TextChanged -= TextDocument_TextChanged;
        }
コード例 #6
0
        public void UnRegisterLanguageService()
        {
            foreach (var backgroundRenderer in _languageServiceBackgroundRenderers)
            {
                TextArea.TextView.BackgroundRenderers.Remove(backgroundRenderer);
            }

            _languageServiceBackgroundRenderers.Clear();

            foreach (var transformer in _languageServiceDocumentLineTransformers)
            {
                TextArea.TextView.LineTransformers.Remove(transformer);
            }

            _languageServiceDocumentLineTransformers.Clear();

            ShutdownBackgroundWorkers();

            UnsavedFile unsavedFile = null;

            lock (UnsavedFiles)
            {
                unsavedFile = UnsavedFiles.BinarySearch(SourceFile.Location);
            }

            if (unsavedFile != null)
            {
                lock (UnsavedFiles)
                {
                    UnsavedFiles.Remove(unsavedFile);
                }
            }

            if (LanguageService != null)
            {
                LanguageService.UnregisterSourceFile(this, SourceFile);
            }

            Document.TextChanged -= TextDocument_TextChanged;
        }