Browse Source

Fixed SD2-374: Compiler warnings during debugging.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@337 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
d6bdc87bc2
  1. 5
      src/Main/Base/Project/Src/Commands/BuildCommands.cs
  2. 23
      src/Main/Base/Project/Src/Commands/DebugCommands.cs
  3. 15
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
  4. 29
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/ErrorDrawer.cs
  5. 12
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/Gui/MenuCommand.cs

5
src/Main/Base/Project/Src/Commands/BuildCommands.cs

@ -24,13 +24,16 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
ICSharpCode.SharpDevelop.Commands.SaveAllFiles.SaveAll(); ICSharpCode.SharpDevelop.Commands.SaveAllFiles.SaveAll();
} }
public static int LastErrorCount;
public static void ShowResults(CompilerResults results) public static void ShowResults(CompilerResults results)
{ {
if (results != null) { if (results != null) {
foreach (CompilerError error in results.Errors) { foreach (CompilerError error in results.Errors) {
TaskService.Add(new Task(error)); TaskService.Add(new Task(error));
} }
if (results.Errors.Count > 0) { LastErrorCount = results.Errors.Count;
if (LastErrorCount > 0) {
WorkbenchSingleton.Workbench.GetPad(typeof(ErrorList)).BringPadToFront(); WorkbenchSingleton.Workbench.GetPad(typeof(ErrorList)).BringPadToFront();
} }
} }

23
src/Main/Base/Project/Src/Commands/DebugCommands.cs

@ -16,13 +16,12 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
Debug.Assert(ProjectService.OpenSolution != null); Debug.Assert(ProjectService.OpenSolution != null);
// if (ProjectService.OpenSolution.IsDirty) {
// new
// }
new Build().Run(); new Build().Run();
IProject startupProject = ProjectService.OpenSolution.StartupProject; if (Build.LastErrorCount == 0) {
if (startupProject != null) { IProject startupProject = ProjectService.OpenSolution.StartupProject;
startupProject.Start(true); if (startupProject != null) {
startupProject.Start(true);
}
} }
} }
} }
@ -31,14 +30,12 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
Debug.Assert(ProjectService.OpenSolution != null); Debug.Assert(ProjectService.OpenSolution != null);
// if (ProjectService.OpenSolution.IsDirty) {
// ProjectService.OpenSolution.Build();
// }
new Build().Run(); new Build().Run();
IProject startupProject = ProjectService.OpenSolution.StartupProject; if (Build.LastErrorCount == 0) {
if (startupProject != null) { IProject startupProject = ProjectService.OpenSolution.StartupProject;
startupProject.Start(false); if (startupProject != null) {
startupProject.Start(false);
}
} }
} }
} }

15
src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

@ -71,8 +71,8 @@ namespace ICSharpCode.Core
get { get {
if (currentDebugger == null) { if (currentDebugger == null) {
currentDebugger = GetCompatibleDebugger(); currentDebugger = GetCompatibleDebugger();
currentDebugger.DebugStarted += new EventHandler(DebugStarted); currentDebugger.DebugStarted += new EventHandler(OnDebugStarted);
currentDebugger.DebugStopped += new EventHandler(DebugStopped); currentDebugger.DebugStopped += new EventHandler(OnDebugStopped);
} }
return currentDebugger; return currentDebugger;
} }
@ -96,18 +96,25 @@ namespace ICSharpCode.Core
} }
} }
static void DebugStarted(object sender, EventArgs e) public static event EventHandler DebugStarted;
public static event EventHandler DebugStopped;
static void OnDebugStarted(object sender, EventArgs e)
{ {
oldLayoutConfiguration = LayoutConfiguration.CurrentLayoutName; oldLayoutConfiguration = LayoutConfiguration.CurrentLayoutName;
LayoutConfiguration.CurrentLayoutName = "Debug"; LayoutConfiguration.CurrentLayoutName = "Debug";
ClearDebugMessages(); ClearDebugMessages();
if (DebugStarted != null)
DebugStarted(null, e);
} }
static void DebugStopped(object sender, EventArgs e) static void OnDebugStopped(object sender, EventArgs e)
{ {
CurrentLineBookmark.Remove(); CurrentLineBookmark.Remove();
LayoutConfiguration.CurrentLayoutName = oldLayoutConfiguration; LayoutConfiguration.CurrentLayoutName = oldLayoutConfiguration;
if (DebugStopped != null)
DebugStopped(null, e);
} }

29
src/Main/Base/Project/Src/TextEditor/Gui/Editor/ErrorDrawer.cs

@ -7,7 +7,6 @@
using System; using System;
using System.IO; using System.IO;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Text; using System.Drawing.Text;
@ -45,7 +44,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
/// </summary> /// </summary>
public class ErrorDrawer : IDisposable public class ErrorDrawer : IDisposable
{ {
ArrayList errors = new ArrayList();
TextEditorControl textEditor; TextEditorControl textEditor;
public ErrorDrawer(TextEditorControl textEditor) public ErrorDrawer(TextEditorControl textEditor)
@ -56,21 +54,43 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
TaskService.Removed += new TaskEventHandler(OnRemoved); TaskService.Removed += new TaskEventHandler(OnRemoved);
TaskService.Cleared += new EventHandler(OnCleared); TaskService.Cleared += new EventHandler(OnCleared);
textEditor.FileNameChanged += new EventHandler(SetErrors); textEditor.FileNameChanged += new EventHandler(SetErrors);
DebuggerService.CurrentDebugger.DebugStarted += OnDebugStarted;
DebuggerService.CurrentDebugger.DebugStopped += OnDebugStopped;
} }
bool isDisposed;
/// <summary> /// <summary>
/// Deregisters the event handlers so the error drawer (and associated TextEditorControl) /// Deregisters the event handlers so the error drawer (and associated TextEditorControl)
/// can be garbage collected. /// can be garbage collected.
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
if (isDisposed)
return;
isDisposed = true;
TaskService.Added -= new TaskEventHandler(OnAdded); TaskService.Added -= new TaskEventHandler(OnAdded);
TaskService.Removed -= new TaskEventHandler(OnRemoved); TaskService.Removed -= new TaskEventHandler(OnRemoved);
TaskService.Cleared -= new EventHandler(OnCleared); TaskService.Cleared -= new EventHandler(OnCleared);
textEditor.FileNameChanged -= new EventHandler(SetErrors); textEditor.FileNameChanged -= new EventHandler(SetErrors);
DebuggerService.CurrentDebugger.DebugStarted -= OnDebugStarted;
DebuggerService.CurrentDebugger.DebugStopped -= OnDebugStopped;
ClearErrors(); ClearErrors();
} }
void OnDebugStarted(object sender, EventArgs e)
{
ClearErrors();
}
void OnDebugStopped(object sender, EventArgs e)
{
foreach (Task task in TaskService.Tasks) {
AddTask(task, false);
}
textEditor.Refresh();
}
void OnAdded(object sender, TaskEventArgs e) void OnAdded(object sender, TaskEventArgs e)
{ {
AddTask(e.Task, true); AddTask(e.Task, true);
@ -120,7 +140,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
return false; return false;
if (task.TaskType != TaskType.Warning && task.TaskType != TaskType.Error) if (task.TaskType != TaskType.Warning && task.TaskType != TaskType.Error)
return false; return false;
return string.Equals(Path.GetFullPath(task.FileName), Path.GetFullPath(textEditor.FileName), StringComparison.CurrentCultureIgnoreCase); return FileUtility.IsEqualFileName(task.FileName, textEditor.FileName);
} }
void AddTask(Task task, bool refresh) void AddTask(Task task, bool refresh)
@ -143,6 +163,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
int startOffset = offset;//Math.Min(textEditor.Document.TextLength, TextUtilities.FindWordStart(textEditor.Document, offset)); int startOffset = offset;//Math.Min(textEditor.Document.TextLength, TextUtilities.FindWordStart(textEditor.Document, offset));
int endOffset = Math.Max(1, TextUtilities.FindWordEnd(textEditor.Document, offset)); int endOffset = Math.Max(1, TextUtilities.FindWordEnd(textEditor.Document, offset));
textEditor.Document.MarkerStrategy.AddMarker(new VisualError(startOffset, endOffset - startOffset + 1, task)); textEditor.Document.MarkerStrategy.AddMarker(new VisualError(startOffset, endOffset - startOffset + 1, task));
if (refresh) {
textEditor.Refresh();
}
} }
} }

12
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/Gui/MenuCommand.cs

@ -109,9 +109,10 @@ namespace ICSharpCode.Core
protected override void OnClick(System.EventArgs e) protected override void OnClick(System.EventArgs e)
{ {
base.OnClick(e); base.OnClick(e);
if (GetVisible() && Enabled) { if (codon != null) {
if (codon != null) { if (GetVisible() && Enabled) {
Command.Run(); ICommand cmd = Command;
if (cmd != null) cmd.Run();
} }
} }
} }
@ -140,7 +141,10 @@ namespace ICSharpCode.Core
bool GetVisible() bool GetVisible()
{ {
return codon.GetFailedAction(caller) != ConditionFailedAction.Exclude; if (codon == null)
return true;
else
return codon.GetFailedAction(caller) != ConditionFailedAction.Exclude;
} }
public virtual void UpdateStatus() public virtual void UpdateStatus()

Loading…
Cancel
Save