Browse Source

Debugger tooltips are filled with real content.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@669 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
352a57c1b0
  1. 1
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
  2. 48
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs
  3. 70
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  4. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs
  5. 16
      src/Main/Base/Project/Src/Services/Debugger/DebuggerGridControl.cs
  6. 4
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
  7. 43
      src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
  8. 6
      src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

1
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj

@ -59,6 +59,7 @@ @@ -59,6 +59,7 @@
<Compile Include="Src\Pads\VariableListItems\PlaceHolderItem.cs" />
<Compile Include="Src\Pads\VariableListItems\VariableItem.cs" />
<Compile Include="Src\Pads\VariableListItems\VariableListItem.cs" />
<Compile Include="Src\Service\DynamicTreeDebuggerRow.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">

48
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using DebuggerLibrary;
using ICSharpCode.SharpDevelop.Gui.TreeGrid;
namespace ICSharpCode.SharpDevelop.Services
{
public class DynamicTreeDebuggerRow:DynamicTreeRow
{
// Columns:
// 0 = plus sign
// 1 = icon
// 2 = text
// 3 = value
Variable variable;
public Variable Variable {
get {
return variable;
}
set {
variable = value;
}
}
public DynamicTreeDebuggerRow()
{
}
public DynamicTreeDebuggerRow(Variable variable)
{
if (variable == null) throw new ArgumentNullException("variable");
this.variable = variable;
this.ChildWindowCaption = variable.Name;
this[2].Text = variable.Name;
this[3].Text = variable.ToString();
}
}
}

70
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -20,6 +20,7 @@ using System.CodeDom.Compiler; @@ -20,6 +20,7 @@ using System.CodeDom.Compiler;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.TreeGrid;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Services;
using System.Runtime.Remoting;
@ -191,36 +192,77 @@ namespace ICSharpCode.SharpDevelop.Services @@ -191,36 +192,77 @@ namespace ICSharpCode.SharpDevelop.Services
}
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// Gets variable of given name.
/// Returns null if unsuccessful.
/// </summary>
public string GetValueAsString(string variableName)
public Variable GetVariableFromName(string variableName)
{
if (debugger == null || debugger.IsRunning) return null;
VariableCollection collection = debugger.LocalVariables;
if (collection == null) {
return null;
}
object val;
if (collection == null) return null;
try {
val = collection[variableName].Value;
return collection[variableName];
} catch (DebuggerException) {
return null;
}
if (val == null) {
return "<null>";
} else if (val is string) {
return "\"" + val.ToString() + "\"";
}
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// Returns null if unsuccessful.
/// </summary>
public string GetValueAsString(string variableName)
{
Variable variable = GetVariableFromName(variableName);
if (variable == null) {
return null;
} else {
return val.ToString();
return variable.ToString();
}
}
/// <summary>
/// Gets the tooltip control that shows the value of given variable.
/// Return null if no tooltip is available.
/// </summary>
public DebuggerGridControl GetTooltipControl(string variableName)
{
Variable variable = GetVariableFromName(variableName);
if (variable == null) {
return null;
} else {
DynamicTreeDebuggerRow newRow = new DynamicTreeDebuggerRow(variable);
newRow.Expanding += TooltipControlRowExpanding;
return new DebuggerGridControl(newRow);
}
}
/// <summary>
/// Called when plus is pressed in debugger tooltip.
/// Sets the data to be show in the next level.
/// </summary>
void TooltipControlRowExpanding(object sender, EventArgs args)
{
DynamicTreeDebuggerRow row = (DynamicTreeDebuggerRow) sender;
row.ChildRows.Clear();
foreach(Variable variable in row.Variable.SubVariables) {
DynamicTreeDebuggerRow newRow = new DynamicTreeDebuggerRow(variable);
newRow.Expanding += TooltipControlRowExpanding;
row.ChildRows.Add(newRow);
}
}
public void Dispose()
{
Stop();
}
#endregion
public event System.EventHandler Initialize;

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs

@ -80,7 +80,15 @@ namespace DebuggerLibrary @@ -80,7 +80,15 @@ namespace DebuggerLibrary
public override string ToString()
{
return String.Format("Name = {0,-25} Value = {1,-30} Type = {2,-30}", Name, Value, Type);
//return String.Format("Name = {0,-25} Value = {1,-30} Type = {2,-30}", Name, Value, Type);
if (Value == null) {
return "<null>";
} else if (Value is string) {
return "\"" + Value.ToString() + "\"";
} else {
return Value.ToString();
}
}

16
src/Main/Base/Project/Src/Services/Debugger/DebuggerGridControl.cs

@ -20,10 +20,12 @@ namespace ICSharpCode.Core @@ -20,10 +20,12 @@ namespace ICSharpCode.Core
// 2 = text
// 3 = value
DynamicTreeRow row = new DynamicTreeRow();
DynamicTreeRow row;
public DebuggerGridControl(string text, string value)
public DebuggerGridControl(DynamicTreeRow row)
{
this.row = row;
BeginUpdate();
Columns.Add(new DynamicListColumn());
Columns.Add(new DynamicListColumn());
@ -37,14 +39,10 @@ namespace ICSharpCode.Core @@ -37,14 +39,10 @@ namespace ICSharpCode.Core
Columns[2].AutoSize = true;
Columns[3].AutoSize = true;
Rows.Add(row);
row.ChildWindowCaption = text;
row[2].Text = text;
row[3].Text = value;
foreach (DynamicListColumn col in Columns) {
row.ChildColumns.Add(col.Clone());
}
row.Expanding += RowExpanding;
row.Expanded += delegate { isExpanded = true; };
row.Collapsed += delegate { isExpanded = false; };
@ -93,11 +91,5 @@ namespace ICSharpCode.Core @@ -93,11 +91,5 @@ namespace ICSharpCode.Core
return !isExpanded;
}
}
void RowExpanding(object sender, EventArgs e)
{
row.ChildRows.Clear();
row.ChildRows.Add(row);
}
}
}

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

@ -351,8 +351,8 @@ namespace ICSharpCode.Core @@ -351,8 +351,8 @@ namespace ICSharpCode.Core
if (toolTipText != null) {
if (Control.ModifierKeys == Keys.Control) {
toolTipText = "expr: " + expressionResult.ToString() + "\n" + toolTipText;
} else if (debuggerCanShowValue) {
toolTipControl = new DebuggerGridControl("hello", "world");
} else if (debuggerCanShowValue && currentDebugger != null) {
toolTipControl = currentDebugger.GetTooltipControl(expressionResult.ToString().Replace("<","").Replace(">",""));
toolTipText = null;
}
}

43
src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs

@ -40,7 +40,7 @@ namespace ICSharpCode.Core @@ -40,7 +40,7 @@ namespace ICSharpCode.Core
if (attachedProcess != null) {
return;
}
try {
attachedProcess = new Process();
attachedProcess.StartInfo = processStartInfo;
@ -52,7 +52,7 @@ namespace ICSharpCode.Core @@ -52,7 +52,7 @@ namespace ICSharpCode.Core
throw new ApplicationException("Can't execute " + "\"" + processStartInfo.FileName + "\"\n");
}
}
void AttachedProcessExited(object sender, EventArgs e)
{
attachedProcess.Exited -= new EventHandler(AttachedProcessExited);
@ -60,12 +60,12 @@ namespace ICSharpCode.Core @@ -60,12 +60,12 @@ namespace ICSharpCode.Core
attachedProcess = null;
WorkbenchSingleton.SafeThreadAsyncCall(this, "OnDebugStopped", EventArgs.Empty);
}
public void StartWithoutDebugging(ProcessStartInfo processStartInfo)
{
Process.Start(processStartInfo);
}
public void Stop()
{
if (attachedProcess != null) {
@ -89,24 +89,41 @@ namespace ICSharpCode.Core @@ -89,24 +89,41 @@ namespace ICSharpCode.Core
throw new NotSupportedException();
}
// Stepping:
public void StepInto()
{
throw new NotSupportedException();
}
public void StepOver()
{
throw new NotSupportedException();
}
public void StepOut()
{
throw new NotSupportedException();
}
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary>
public string GetValueAsString(string variable)
{
return null;
}
/// <summary>
/// Gets the tooltip control that shows the value of given variable.
/// Return null if no tooltip is available.
/// </summary>
public DebuggerGridControl GetTooltipControl(string variable)
{
return null;
}
public event EventHandler DebugStarted;
protected virtual void OnDebugStarted(EventArgs e)
{
if (DebugStarted != null) {
@ -134,14 +151,6 @@ namespace ICSharpCode.Core @@ -134,14 +151,6 @@ namespace ICSharpCode.Core
}
}
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary>
public string GetValueAsString(string variable)
{
return null;
}
public void Dispose()
{
Stop();

6
src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

@ -61,6 +61,12 @@ namespace ICSharpCode.Core @@ -61,6 +61,12 @@ namespace ICSharpCode.Core
/// </summary>
string GetValueAsString(string variable);
/// <summary>
/// Gets the tooltip control that shows the value of given variable.
/// Return null if no tooltip is available.
/// </summary>
DebuggerGridControl GetTooltipControl(string variable);
/// <summary>
/// Ocurrs after the debugger has started.
/// </summary>

Loading…
Cancel
Save