Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@66 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
13 changed files with 237 additions and 43 deletions
@ -0,0 +1,131 @@
@@ -0,0 +1,131 @@
|
||||
// <file>
|
||||
// <owner name="David Srbecký" email="dsrbecky@post.cz"/>
|
||||
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows.Forms; |
||||
using System.Drawing; |
||||
using System.CodeDom.Compiler; |
||||
using System.Collections; |
||||
using System.IO; |
||||
using System.Diagnostics; |
||||
using ICSharpCode.Core; |
||||
//using ICSharpCode.Core.Services;
|
||||
using ICSharpCode.SharpDevelop.Services; |
||||
|
||||
//using ICSharpCode.Core.Properties;
|
||||
|
||||
using DebuggerLibrary; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.Pads |
||||
{ |
||||
public class ExceptionHistoryPad : AbstractPadContent |
||||
{ |
||||
ListView exceptionHistoryList; |
||||
|
||||
//
|
||||
//WindowsDebugger DebuggerService = (WindowsDebugger)((DebuggerService)ServiceManager.Services.GetService(typeof(DebuggerService))).CurrentDebugger;
|
||||
WindowsDebugger debugger; |
||||
|
||||
ColumnHeader time = new ColumnHeader(); |
||||
ColumnHeader exception = new ColumnHeader(); |
||||
ColumnHeader location = new ColumnHeader(); |
||||
|
||||
public override Control Control { |
||||
get { |
||||
return exceptionHistoryList; |
||||
} |
||||
} |
||||
|
||||
public ExceptionHistoryPad() |
||||
{ |
||||
InitializeComponents(); |
||||
} |
||||
|
||||
void InitializeComponents() |
||||
{ |
||||
debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; |
||||
exceptionHistoryList = new ListView(); |
||||
exceptionHistoryList.FullRowSelect = true; |
||||
exceptionHistoryList.AutoArrange = true; |
||||
exceptionHistoryList.Alignment = ListViewAlignment.Left; |
||||
exceptionHistoryList.View = View.Details; |
||||
exceptionHistoryList.Dock = DockStyle.Fill; |
||||
exceptionHistoryList.GridLines = false; |
||||
exceptionHistoryList.Activation = ItemActivation.OneClick; |
||||
exceptionHistoryList.Columns.AddRange(new ColumnHeader[] {time, exception, location} ); |
||||
exceptionHistoryList.ItemActivate += new EventHandler(ExceptionHistoryListItemActivate); |
||||
exception.Width = 300; |
||||
location.Width = 400; |
||||
time.Width = 80; |
||||
|
||||
NDebugger.IsDebuggingChanged += new DebuggerEventHandler(DebuggerStateChanged); |
||||
NDebugger.IsProcessRunningChanged += new DebuggerEventHandler(DebuggerStateChanged); |
||||
|
||||
RedrawContent(); |
||||
} |
||||
|
||||
public override void RedrawContent() |
||||
{ |
||||
time.Text = "Time"; |
||||
exception.Text = "Exception"; |
||||
location.Text = "Location"; |
||||
|
||||
RefreshList(); |
||||
} |
||||
|
||||
void ExceptionHistoryListItemActivate(object sender, EventArgs e) |
||||
{ |
||||
SourcecodeSegment nextStatement = ((DebuggerLibrary.Exception)(exceptionHistoryList.SelectedItems[0].Tag)).Location; |
||||
|
||||
FileService.OpenFile(nextStatement.SourceFullFilename); |
||||
IWorkbenchWindow window = FileService.GetOpenFile(nextStatement.SourceFullFilename); |
||||
if (window != null) { |
||||
IViewContent content = window.ViewContent; |
||||
|
||||
if (content is IPositionable) { |
||||
((IPositionable)content).JumpTo((int)nextStatement.StartLine - 1, (int)nextStatement.StartColumn - 1); |
||||
} |
||||
|
||||
/*if (content.Control is TextEditorControl) { |
||||
IDocument document = ((TextEditorControl)content.Control).Document; |
||||
LineSegment line = document.GetLineSegment((int)nextStatement.StartLine - 1); |
||||
int offset = line.Offset + (int)nextStatement.StartColumn; |
||||
currentLineMarker = new TextMarker(offset, (int)nextStatement.EndColumn - (int)nextStatement.StartColumn, TextMarkerType.SolidBlock, Color.Yellow); |
||||
currentLineMarkerParent = document; |
||||
currentLineMarkerParent.MarkerStrategy.TextMarker.Add(currentLineMarker); |
||||
document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea)); |
||||
document.CommitUpdate(); |
||||
}*/ |
||||
} |
||||
} |
||||
|
||||
public void DebuggerStateChanged(object sender, DebuggerEventArgs e) |
||||
{ |
||||
RefreshList(); |
||||
} |
||||
|
||||
public void RefreshList() |
||||
{ |
||||
exceptionHistoryList.BeginUpdate(); |
||||
exceptionHistoryList.Items.Clear(); |
||||
|
||||
foreach(DebuggerLibrary.Exception exception in debugger.ExceptionHistory) { |
||||
ListViewItem item = new ListViewItem(new string[] {exception.CreationTime.ToLongTimeString() , exception.Type + " - " + exception.Message, exception.Location.SourceFilename + ":" + exception.Location.StartLine + " (type=" + exception.ExceptionType.ToString() + ")"}); |
||||
item.Tag = exception; |
||||
item.ForeColor = Color.Black; |
||||
if (exception.ExceptionType == ExceptionType.DEBUG_EXCEPTION_UNHANDLED) { |
||||
item.ForeColor = Color.Red; |
||||
} |
||||
if (exception.ExceptionType == ExceptionType.DEBUG_EXCEPTION_FIRST_CHANCE || |
||||
exception.ExceptionType == ExceptionType.DEBUG_EXCEPTION_USER_FIRST_CHANCE) { |
||||
item.ForeColor = Color.Blue; |
||||
} |
||||
exceptionHistoryList.Items.Add(item); |
||||
} |
||||
|
||||
exceptionHistoryList.EndUpdate(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
// <file>
|
||||
// <owner name="David Srbecký" email="dsrbecky@post.cz"/>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Runtime.InteropServices; |
||||
using System.Threading; |
||||
|
||||
namespace DebuggerLibrary |
||||
{ |
||||
public enum ExceptionType |
||||
{ |
||||
DEBUG_EXCEPTION_FIRST_CHANCE = 1, |
||||
DEBUG_EXCEPTION_UNHANDLED = 4, |
||||
DEBUG_EXCEPTION_USER_FIRST_CHANCE = 2, |
||||
DEBUG_EXCEPTION_CATCH_HANDLER_FOUND = 3, |
||||
} |
||||
} |
Loading…
Reference in new issue