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 20 years ago
parent
commit
d6bdc87bc2
  1. 9
      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

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

@ -23,14 +23,17 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -23,14 +23,17 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
TaskService.Clear();
ICSharpCode.SharpDevelop.Commands.SaveAllFiles.SaveAll();
}
public static int LastErrorCount;
public static void ShowResults(CompilerResults results)
{
if (results != null) {
foreach (CompilerError error in results.Errors) {
TaskService.Add(new Task(error));
}
if (results.Errors.Count > 0) {
LastErrorCount = results.Errors.Count;
if (LastErrorCount > 0) {
WorkbenchSingleton.Workbench.GetPad(typeof(ErrorList)).BringPadToFront();
}
}
@ -80,7 +83,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -80,7 +83,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public class BuildProject : AbstractMenuCommand
{
public static void ShowResults(CompilerResults results)
{
if (results != null) {

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

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

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

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

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

@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Text;
@ -45,7 +44,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -45,7 +44,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
/// </summary>
public class ErrorDrawer : IDisposable
{
ArrayList errors = new ArrayList();
TextEditorControl textEditor;
public ErrorDrawer(TextEditorControl textEditor)
@ -56,21 +54,43 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -56,21 +54,43 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
TaskService.Removed += new TaskEventHandler(OnRemoved);
TaskService.Cleared += new EventHandler(OnCleared);
textEditor.FileNameChanged += new EventHandler(SetErrors);
DebuggerService.CurrentDebugger.DebugStarted += OnDebugStarted;
DebuggerService.CurrentDebugger.DebugStopped += OnDebugStopped;
}
bool isDisposed;
/// <summary>
/// Deregisters the event handlers so the error drawer (and associated TextEditorControl)
/// can be garbage collected.
/// </summary>
public void Dispose()
{
if (isDisposed)
return;
isDisposed = true;
TaskService.Added -= new TaskEventHandler(OnAdded);
TaskService.Removed -= new TaskEventHandler(OnRemoved);
TaskService.Cleared -= new EventHandler(OnCleared);
textEditor.FileNameChanged -= new EventHandler(SetErrors);
DebuggerService.CurrentDebugger.DebugStarted -= OnDebugStarted;
DebuggerService.CurrentDebugger.DebugStopped -= OnDebugStopped;
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)
{
AddTask(e.Task, true);
@ -120,7 +140,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -120,7 +140,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
return false;
if (task.TaskType != TaskType.Warning && task.TaskType != TaskType.Error)
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)
@ -143,6 +163,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -143,6 +163,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
int startOffset = offset;//Math.Min(textEditor.Document.TextLength, TextUtilities.FindWordStart(textEditor.Document, offset));
int endOffset = Math.Max(1, TextUtilities.FindWordEnd(textEditor.Document, offset));
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 @@ -109,9 +109,10 @@ namespace ICSharpCode.Core
protected override void OnClick(System.EventArgs e)
{
base.OnClick(e);
if (GetVisible() && Enabled) {
if (codon != null) {
Command.Run();
if (codon != null) {
if (GetVisible() && Enabled) {
ICommand cmd = Command;
if (cmd != null) cmd.Run();
}
}
}
@ -140,7 +141,10 @@ namespace ICSharpCode.Core @@ -140,7 +141,10 @@ namespace ICSharpCode.Core
bool GetVisible()
{
return codon.GetFailedAction(caller) != ConditionFailedAction.Exclude;
if (codon == null)
return true;
else
return codon.GetFailedAction(caller) != ConditionFailedAction.Exclude;
}
public virtual void UpdateStatus()

Loading…
Cancel
Save