Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Revert "Lock view contents when debugger starts and refresh icon sinc…
Browse files Browse the repository at this point in the history
…e we don't support EnC (yet)."

This reverts commit a491d12.
  • Loading branch information
eusebiu committed Jan 29, 2011
1 parent a491d12 commit 7acf7a7
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 76 deletions.
Expand Up @@ -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; }
Expand Down
Expand Up @@ -110,8 +110,6 @@ protected virtual void OnKeyPress()
}
}

public bool IsReadOnly { get; set; }

public FileName FileName {
get {
throw new NotImplementedException();
Expand Down
Expand Up @@ -69,10 +69,6 @@ public void SelectWindow()
get { return selectWindowMethodCalled; }
}

public void UpdateActiveViewContent()
{
}

public event EventHandler ActiveViewContentChanged;

protected virtual void OnActiveViewContentChanged(EventArgs e)
Expand Down
61 changes: 8 additions & 53 deletions src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -766,59 +764,16 @@ void debugger_ProcessStarted(object sender, CollectionItemEventArgs<Process> 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<Process> e)
{
if (debugger.Processes.Count == 0) {
if (DebugStopped != null) {
DebugStopped(this, e);
SetActiveViewsReadonly(false);
}
SelectProcess(null);
} else {
Expand Down Expand Up @@ -931,17 +886,17 @@ StopAttachedProcessDialogResult ShowStopAttachedProcessDialog()
}

void process_Modules_Added(object sender, CollectionItemEventArgs<Module> e)
{
{
if (ProjectService.OpenSolution == null ||
ProjectService.OpenSolution.Projects == null ||
ProjectService.OpenSolution.Projects.Count() == 0)
return;

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) }));
}
}
}
Expand Up @@ -95,8 +95,6 @@ public void SetDocument(IDocument document)
}
}

public bool IsReadOnly { get; set; }

public FileName FileName {
get { return fileName; }
set { fileName = value; }
Expand Down
Expand Up @@ -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; }
}
Expand Down
2 changes: 0 additions & 2 deletions src/Main/Base/Project/Src/Editor/ITextEditor.cs
Expand Up @@ -24,8 +24,6 @@ public interface ITextEditorProvider : IFileDocumentProvider
/// </summary>
public interface ITextEditor : IServiceProvider
{
bool IsReadOnly { get; set; }

/// <summary>
/// Gets the primary view if split-view is active.
/// If split-view is disabled, the current ITextEditor instance is returned.
Expand Down
5 changes: 0 additions & 5 deletions src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs
Expand Up @@ -76,10 +76,5 @@ public interface IWorkbenchWindow
/// Is called when the title of this window has changed.
/// </summary>
event EventHandler TitleChanged;

/// <summary>
/// Updates the content.
/// </summary>
void UpdateActiveViewContent();
}
}
Expand Up @@ -137,7 +137,7 @@ SDWindowsFormsHost GetActiveWinFormsHost()

IViewContent oldActiveViewContent;

public void UpdateActiveViewContent()
void UpdateActiveViewContent()
{
UpdateTitleAndInfoTip();

Expand Down

0 comments on commit 7acf7a7

Please sign in to comment.