diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
index 5e33ef842e..928b15a683 100644
--- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
@@ -341,6 +341,28 @@ namespace ICSharpCode.SharpDevelop.Services
//if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
// WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent.RedrawContent();
//}
- }
+ }
+
+ ///
+ /// Gets the current value of the variable as string that can be displayed in tooltips.
+ ///
+ public string GetValueAsString(string variableName)
+ {
+ VariableCollection collection = NDebugger.LocalVariables;
+ if (collection == null)
+ return null;
+ foreach (Variable v in collection) {
+ if (v.Name == variableName) {
+ object val = v.Value;
+ if (val == null)
+ return "";
+ else if (val is string)
+ return "\"" + val.ToString() + "\"";
+ else
+ return val.ToString();
+ }
+ }
+ return null;
+ }
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
index a1524c74fe..90418aa36e 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
@@ -1,5 +1,5 @@
//
-//
+//
//
using System;
@@ -308,6 +308,7 @@ namespace DebuggerLibrary
static public Thread CurrentThread {
get {
+ if (!IsDebugging) return null;
return CurrentProcess.CurrentThread;
}
set {
@@ -317,6 +318,7 @@ namespace DebuggerLibrary
static public Thread MainThread {
get {
+ if (!IsDebugging) return null;
return CurrentProcess.MainThread;
}
set {
@@ -325,13 +327,15 @@ namespace DebuggerLibrary
}
static public SourcecodeSegment NextStatement {
- get{
+ get {
+ if (!IsDebugging) return null;
return CurrentProcess.NextStatement;
}
}
static public VariableCollection LocalVariables {
- get{
+ get {
+ if (!IsDebugging) return null;
return CurrentProcess.LocalVariables;
}
}
diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs
index 7936535f3f..dcdbbe3346 100644
--- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs
+++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs
@@ -55,9 +55,6 @@ namespace ICSharpCode.TextEditor
SelectionManager selectionManager;
Caret caret;
- ToolTip toolTip = new ToolTip();
- bool toolTipSet = false;
-
public TextEditorControl MotherTextEditorControl {
get {
return motherTextEditorControl;
@@ -296,18 +293,22 @@ namespace ICSharpCode.TextEditor
}
}
- string oldToolTip;
+
+ // static because the mouse can only be in one text area and we don't want to have
+ // tooltips of text areas from inactive tabs floating around.
+ static ToolTip toolTip;
+ static string oldToolTip;
+ bool toolTipSet;
+
public void SetToolTip(string text)
{
+ if (toolTip == null) toolTip = new ToolTip();
toolTipSet = (text != null);
if (oldToolTip == text)
return;
- ToolTip toolTip = this.toolTip;
if (text == null) {
- //Console.WriteLine("Tooltip disabled");
- toolTip.Hide(this.FindForm());
+ toolTip.Hide(this);
} else {
- //Console.WriteLine("Tooltip set to " + text);
Point p = PointToClient(Control.MousePosition);
p.Offset(3, 3);
toolTip.Show(text, this, p);
@@ -696,7 +697,6 @@ namespace ICSharpCode.TextEditor
base.Dispose(disposing);
if (disposing) {
Caret.Dispose();
- toolTip.Dispose();
}
}
diff --git a/src/Main/Base/Project/Src/Internal/Auswerter/IsProcessRunningAuswerter.cs b/src/Main/Base/Project/Src/Internal/Auswerter/IsProcessRunningAuswerter.cs
index 9101ed1609..cd4b179ab2 100644
--- a/src/Main/Base/Project/Src/Internal/Auswerter/IsProcessRunningAuswerter.cs
+++ b/src/Main/Base/Project/Src/Internal/Auswerter/IsProcessRunningAuswerter.cs
@@ -19,7 +19,7 @@ namespace ICSharpCode.Core
bool isprocessrunning = Boolean.Parse(condition.Properties["isprocessrunning"]);
string isDebugging = condition.Properties.Get("isdebugging", String.Empty);
IDebugger debugger = DebuggerService.CurrentDebugger;
- return isprocessrunning == DebuggerService.IsProcessRuning &&
+ return isprocessrunning == DebuggerService.IsProcessRunning &&
(isDebugging == String.Empty ||
DebuggerService.IsDebugging == Boolean.Parse(isDebugging)
);
diff --git a/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs b/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
index 3c1aa4b529..b31e942c7f 100644
--- a/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
+++ b/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
@@ -66,7 +66,7 @@ namespace ICSharpCode.Core
}
}
- public static bool IsProcessRuning {
+ public static bool IsProcessRunning {
get {
if (standardProcess != null) {
return isRunning;
@@ -175,7 +175,7 @@ namespace ICSharpCode.Core
public static void StartWithoutDebugging(System.Diagnostics.ProcessStartInfo psi)
{
- if (IsProcessRuning) {
+ if (IsProcessRunning) {
return;
}
try {
@@ -200,7 +200,7 @@ namespace ICSharpCode.Core
public static void Start(string fileName, string workingDirectory, string arguments)
{
- if (IsProcessRuning) {
+ if (IsProcessRunning) {
return;
}
oldLayoutConfiguration = LayoutConfiguration.CurrentLayoutName;
@@ -548,7 +548,9 @@ namespace ICSharpCode.Core
if (expression != null && expression.Length > 0) {
if (expression == oldExpression && oldLine == logicPos.Y) {
// same expression in same line -> reuse old tooltip
- textArea.SetToolTip(oldToolTip);
+ if (oldToolTip != null) {
+ textArea.SetToolTip(oldToolTip);
+ }
// SetToolTip must be called in every mousemove event,
// otherwise textArea will close the tooltip.
} else {
@@ -586,10 +588,21 @@ namespace ICSharpCode.Core
ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedNames
| ConversionFlags.ShowReturnType
| ConversionFlags.QualifiedNamesOnlyForReturnTypes;
+ StringBuilder b = new StringBuilder();
if (rr.IsParameter)
- return "parameter " + ambience.Convert(rr.Field);
+ b.Append("parameter ");
else
- return "local variable " + ambience.Convert(rr.Field);
+ b.Append("local variable ");
+ b.Append(ambience.Convert(rr.Field));
+ IDebugger debugger = CurrentDebugger;
+ if (debugger != null) {
+ string currentValue = debugger.GetValueAsString(rr.Field.Name);
+ if (currentValue != null) {
+ b.Append(" = ");
+ b.Append(currentValue);
+ }
+ }
+ return b.ToString();
} else if (result is NamespaceResolveResult) {
return "namespace " + ((NamespaceResolveResult)result).Name;
} else if (result is TypeResolveResult) {
diff --git a/src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs b/src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
index 5b58c105e9..98096dc62b 100644
--- a/src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
+++ b/src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
@@ -134,5 +134,13 @@ namespace ICSharpCode.Core
}
public event EventHandler DebugStopped;
+
+ ///
+ /// Gets the current value of the variable as string that can be displayed in tooltips.
+ ///
+ public string GetValueAsString(string variable)
+ {
+ return null;
+ }
}
}
diff --git a/src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs b/src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs
index d77cae4273..a1337a8c48 100644
--- a/src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs
+++ b/src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs
@@ -66,5 +66,10 @@ namespace ICSharpCode.Core
void StepOut();
event EventHandler DebugStopped;
+
+ ///
+ /// Gets the current value of the variable as string that can be displayed in tooltips.
+ ///
+ string GetValueAsString(string variable);
}
}