From 7acf7a7e42c503b49f79d58047702274427b93a0 Mon Sep 17 00:00:00 2001 From: Eusebiu Marcu Date: Sat, 29 Jan 2011 20:30:07 +0200 Subject: [PATCH] Revert "Lock view contents when debugger starts and refresh icon since we don't support EnC (yet)." This reverts commit a491d1295283e1bbc23cf5841be428b510190db3. --- .../Scripting/Test/Utils/MockTextEditor.cs | 2 - .../WixBinding/Test/Utils/MockTextEditor.cs | 2 - .../Test/Utils/MockWorkbenchWindow.cs | 4 -- .../Debugger.AddIn/Service/WindowsDebugger.cs | 61 +++---------------- .../XmlEditor/Test/Utils/MockTextEditor.cs | 2 - .../AvalonEdit/AvalonEditTextEditorAdapter.cs | 5 -- .../Base/Project/Src/Editor/ITextEditor.cs | 2 - .../Base/Project/Src/Gui/IWorkbenchWindow.cs | 5 -- .../Layouts/AvalonWorkbenchWindow.cs | 2 +- 9 files changed, 9 insertions(+), 76 deletions(-) diff --git a/src/AddIns/BackendBindings/Scripting/Test/Utils/MockTextEditor.cs b/src/AddIns/BackendBindings/Scripting/Test/Utils/MockTextEditor.cs index f2e513d1b39..c69ccde5331 100644 --- a/src/AddIns/BackendBindings/Scripting/Test/Utils/MockTextEditor.cs +++ b/src/AddIns/BackendBindings/Scripting/Test/Utils/MockTextEditor.cs @@ -62,8 +62,6 @@ protected virtual void OnKeyPress(KeyEventArgs e) } } - public bool IsReadOnly { get; set; } - public int SelectionLength { get; set; } public string SelectedText { get; set; } diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Utils/MockTextEditor.cs b/src/AddIns/BackendBindings/WixBinding/Test/Utils/MockTextEditor.cs index 329d192e112..127885a93a9 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/Utils/MockTextEditor.cs +++ b/src/AddIns/BackendBindings/WixBinding/Test/Utils/MockTextEditor.cs @@ -110,8 +110,6 @@ protected virtual void OnKeyPress() } } - public bool IsReadOnly { get; set; } - public FileName FileName { get { throw new NotImplementedException(); diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Utils/MockWorkbenchWindow.cs b/src/AddIns/BackendBindings/WixBinding/Test/Utils/MockWorkbenchWindow.cs index c014f61b480..60eef0e0cd3 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/Utils/MockWorkbenchWindow.cs +++ b/src/AddIns/BackendBindings/WixBinding/Test/Utils/MockWorkbenchWindow.cs @@ -69,10 +69,6 @@ public void SelectWindow() get { return selectWindowMethodCalled; } } - public void UpdateActiveViewContent() - { - } - public event EventHandler ActiveViewContentChanged; protected virtual void OnActiveViewContentChanged(EventArgs e) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs b/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs index 521b111a852..4ad8e6875a1 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs @@ -22,8 +22,6 @@ using ICSharpCode.NRefactory.Visitors; using ICSharpCode.SharpDevelop.Bookmarks; using ICSharpCode.SharpDevelop.Debugging; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui.OptionPanels; using ICSharpCode.SharpDevelop.Project; @@ -144,12 +142,12 @@ public void Start(ProcessStartInfo processStartInfo) if (FileUtility.IsUrl(processStartInfo.FileName)) { var project = ProjectService.OpenSolution.Preferences.StartupProject as CompilableProject; - var options = WebProjectsOptions.Instance.GetWebProjectOptions(project.Name); + var options = WebProjectsOptions.Instance.GetWebProjectOptions(project.Name); if (!CheckWebProjectStartInfo(project, options)) return; System.Diagnostics.Process defaultAppProcess = null; - if (options.Data.WebServer != WebServer.None) { + if (options.Data.WebServer != WebServer.None) { string processName = WebProjectService.WorkerProcessName; // try find the worker process directly or using the process monitor callback @@ -296,7 +294,7 @@ public void StartWithoutDebugging(ProcessStartInfo processStartInfo) { if (FileUtility.IsUrl(processStartInfo.FileName)) { var project = ProjectService.OpenSolution.Preferences.StartupProject as CompilableProject; - var options = WebProjectsOptions.Instance.GetWebProjectOptions(project.Name); + var options = WebProjectsOptions.Instance.GetWebProjectOptions(project.Name); if (!CheckWebProjectStartInfo(project, options)) return; @@ -766,59 +764,16 @@ void debugger_ProcessStarted(object sender, CollectionItemEventArgs e) if (debugger.Processes.Count == 1) { if (DebugStarted != null) { DebugStarted(this, EventArgs.Empty); - SetActiveViewsReadonly(true); } } e.Item.LogMessage += LogMessage; } - void SetActiveViewsReadonly(bool readOnly) - { - // TODO: don't forget about EnC - //if (DebuggingOptions.Instance.EnableEditAndContinue) - // return; - - if (WorkbenchSingleton.Workbench == null) - return; - - if (WorkbenchSingleton.Workbench.WorkbenchWindowCollection.Count > 0) { - foreach(var window in WorkbenchSingleton.Workbench.WorkbenchWindowCollection) { - foreach (var content in window.ViewContents) { - if (content is ITextEditorProvider) { - ((ITextEditorProvider)content).TextEditor.IsReadOnly = readOnly; - } - } - - // refresh tab icon - window.UpdateActiveViewContent(); - } - } - - // make readonly the newly opened views - if (readOnly) - WorkbenchSingleton.Workbench.ViewOpened += OnViewOpened; - else - WorkbenchSingleton.Workbench.ViewOpened -= OnViewOpened; - } - - void OnViewOpened(object sender, ViewContentEventArgs e) - { - if (!IsDebugging) - return; - - // TODO: don't forget about EnC - //if (!DebuggingOptions.Instance.EnableEditAndContinue) - if (e.Content is ITextEditorProvider) { - ((ITextEditorProvider)e.Content).TextEditor.IsReadOnly = true; - } - } - void debugger_ProcessExited(object sender, CollectionItemEventArgs e) { if (debugger.Processes.Count == 0) { if (DebugStopped != null) { DebugStopped(this, e); - SetActiveViewsReadonly(false); } SelectProcess(null); } else { @@ -931,7 +886,7 @@ StopAttachedProcessDialogResult ShowStopAttachedProcessDialog() } void process_Modules_Added(object sender, CollectionItemEventArgs e) - { + { if (ProjectService.OpenSolution == null || ProjectService.OpenSolution.Projects == null || ProjectService.OpenSolution.Projects.Count() == 0) @@ -939,9 +894,9 @@ void process_Modules_Added(object sender, CollectionItemEventArgs e) if (e == null || e.Item == null) return; - ProjectService.OpenSolution.Projects - .Where(p => e.Item.Name.IndexOf(p.Name) >= 0) - .ForEach(p => e.Item.LoadSymbolsFromDisk(new []{ Path.GetDirectoryName(p.OutputAssemblyFullPath) })); - } + ProjectService.OpenSolution.Projects + .Where(p => e.Item.Name.IndexOf(p.Name) >= 0) + .ForEach(p => e.Item.LoadSymbolsFromDisk(new []{ Path.GetDirectoryName(p.OutputAssemblyFullPath) })); + } } } diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockTextEditor.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockTextEditor.cs index 80e35cf7a45..d7ce998abc7 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockTextEditor.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockTextEditor.cs @@ -95,8 +95,6 @@ public void SetDocument(IDocument document) } } - public bool IsReadOnly { get; set; } - public FileName FileName { get { return fileName; } set { fileName = value; } diff --git a/src/Main/Base/Project/Src/Editor/AvalonEdit/AvalonEditTextEditorAdapter.cs b/src/Main/Base/Project/Src/Editor/AvalonEdit/AvalonEditTextEditorAdapter.cs index 7e13ec945b4..f32b382d752 100755 --- a/src/Main/Base/Project/Src/Editor/AvalonEdit/AvalonEditTextEditorAdapter.cs +++ b/src/Main/Base/Project/Src/Editor/AvalonEdit/AvalonEditTextEditorAdapter.cs @@ -26,11 +26,6 @@ public class AvalonEditTextEditorAdapter : ITextEditor, IWeakEventListener readonly TextEditor textEditor; AvalonEditDocumentAdapter document; - public bool IsReadOnly { - get { return textEditor.IsReadOnly; } - set { textEditor.IsReadOnly = value; } - } - public TextEditor TextEditor { get { return textEditor; } } diff --git a/src/Main/Base/Project/Src/Editor/ITextEditor.cs b/src/Main/Base/Project/Src/Editor/ITextEditor.cs index fb74738621d..56060b949a8 100644 --- a/src/Main/Base/Project/Src/Editor/ITextEditor.cs +++ b/src/Main/Base/Project/Src/Editor/ITextEditor.cs @@ -24,8 +24,6 @@ public interface ITextEditorProvider : IFileDocumentProvider /// public interface ITextEditor : IServiceProvider { - bool IsReadOnly { get; set; } - /// /// Gets the primary view if split-view is active. /// If split-view is disabled, the current ITextEditor instance is returned. diff --git a/src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs b/src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs index dcccb79756e..3218d98a350 100644 --- a/src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs +++ b/src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs @@ -76,10 +76,5 @@ public interface IWorkbenchWindow /// Is called when the title of this window has changed. /// event EventHandler TitleChanged; - - /// - /// Updates the content. - /// - void UpdateActiveViewContent(); } } diff --git a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs index 2049ce1e617..29fac481f05 100644 --- a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs +++ b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs @@ -137,7 +137,7 @@ SDWindowsFormsHost GetActiveWinFormsHost() IViewContent oldActiveViewContent; - public void UpdateActiveViewContent() + void UpdateActiveViewContent() { UpdateTitleAndInfoTip();