diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
index a00174ec3e..973a5bdffb 100644
--- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
@@ -121,6 +121,11 @@
DebuggerEventForm.cs
+
+
+
+
+
@@ -232,13 +237,11 @@
-
GridVisualizerWindow.xaml
Code
-
@@ -347,6 +350,7 @@
+
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ExpressionNode.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ExpressionNode.cs
index f635b3ebcc..4bfc1e50be 100644
--- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ExpressionNode.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ExpressionNode.cs
@@ -4,13 +4,14 @@
// $Revision$
//
+using Debugger.AddIn.Visualizers;
+using Debugger.AddIn.Visualizers.Utils;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows.Forms;
-
using Debugger.MetaData;
using ICSharpCode.Core;
using ICSharpCode.Core.WinForms;
@@ -76,10 +77,46 @@ namespace Debugger.AddIn.TreeModel
}
public override bool HasChildNodes {
- get {
+ get {
if (!evaluated) EvaluateExpression();
- return base.HasChildNodes;
+ return base.HasChildNodes;
+ }
+ }
+
+ /// Used to determine available VisualizerCommands
+ private DebugType expressionType;
+ /// Used to determine available VisualizerCommands
+ private bool valueIsNull = true;
+
+ private IEnumerable visualizerCommands;
+ public override IEnumerable VisualizerCommands {
+ get {
+ if (visualizerCommands == null) {
+ visualizerCommands = getAvailableVisualizerCommands();
+ }
+ return visualizerCommands;
+ }
+ }
+
+ private IEnumerable getAvailableVisualizerCommands()
+ {
+ if (!evaluated) EvaluateExpression();
+
+ if (this.expressionType == null) {
+ // no visualizers if EvaluateExpression failed
+ yield break;
+ }
+ if (this.valueIsNull) {
+ // no visualizers if evaluated value is null
+ yield break;
+ }
+ if (this.expressionType.IsPrimitive || this.expressionType.IsSystemDotObject() || this.expressionType.IsEnum()) {
+ // no visualizers for primitive types
+ yield break;
}
+ // these should be obtained from AddIn tree so that it is possible to write add-in for Debugger.AddIn with new visualizers
+ yield return new GridVisualizerCommand(this);
+ yield return new ObjectGraphVisualizerCommand(this);
}
public ExpressionNode(IImage image, string name, Expression expression)
@@ -112,7 +149,9 @@ namespace Debugger.AddIn.TreeModel
fullText = val.AsString;
}
+ this.expressionType = val.Type;
this.Type = val.Type.Name;
+ this.valueIsNull = val.IsNull;
// Note that these return enumerators so they are lazy-evaluated
if (val.IsNull) {
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/TreeNode.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/TreeNode.cs
index 972134d63f..0cfd59f866 100644
--- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/TreeNode.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/TreeNode.cs
@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Media;
+using System.Linq;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Debugging;
@@ -81,6 +82,18 @@ namespace Debugger.AddIn.TreeModel
get { return childNodes != null; }
}
+ public virtual IEnumerable VisualizerCommands {
+ get {
+ return null;
+ }
+ }
+
+ public virtual bool HasVisualizerCommands {
+ get {
+ return (VisualizerCommands != null) && (VisualizerCommands.Count() > 0);
+ }
+ }
+
public TreeNode()
{
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ExpressionNodeVisualizerCommand.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ExpressionNodeVisualizerCommand.cs
new file mode 100644
index 0000000000..0719994be9
--- /dev/null
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ExpressionNodeVisualizerCommand.cs
@@ -0,0 +1,34 @@
+//
+//
+//
+//
+// $Revision$
+//
+using Debugger.AddIn.TreeModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.SharpDevelop.Debugging;
+
+namespace Debugger.AddIn.Visualizers
+{
+ ///
+ /// Visualizer command for
+ ///
+ // probably we should not make visualizers available only to ExpressionNodes and descendants,
+ // the visualizer command should be available for any TreeNode
+ // and the VisualizerCommand itself should decide what to do with passed instance
+ public abstract class ExpressionNodeVisualizerCommand : IVisualizerCommand
+ {
+ public ExpressionNode Node { get; private set; }
+
+ public ExpressionNodeVisualizerCommand(ExpressionNode expressionNode)
+ {
+ this.Node = expressionNode;
+ }
+
+ public abstract bool CanExecute { get; }
+
+ public abstract void Execute();
+ }
+}
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/GridVisualizerCommand.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/GridVisualizerCommand.cs
new file mode 100644
index 0000000000..65718f0d09
--- /dev/null
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/GridVisualizerCommand.cs
@@ -0,0 +1,38 @@
+//
+//
+//
+//
+// $Revision$
+//
+using Debugger.AddIn.TreeModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Debugger.AddIn.Visualizers
+{
+ ///
+ /// Executes grid visualizer for a node.
+ ///
+ public class GridVisualizerCommand : ExpressionNodeVisualizerCommand
+ {
+ public GridVisualizerCommand(ExpressionNode expressionNode)
+ :base(expressionNode)
+ {
+ }
+
+ public override bool CanExecute {
+ get { return true; }
+ }
+
+ public override string ToString()
+ {
+ return "Collection visualizer";
+ }
+
+ public override void Execute()
+ {
+
+ }
+ }
+}
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ObjectGraphVisualizerCommand.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ObjectGraphVisualizerCommand.cs
new file mode 100644
index 0000000000..ec8456518d
--- /dev/null
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ObjectGraphVisualizerCommand.cs
@@ -0,0 +1,38 @@
+//
+//
+//
+//
+// $Revision$
+//
+using Debugger.AddIn.TreeModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Debugger.AddIn.Visualizers
+{
+ ///
+ /// Executes object graph visualizer for a node.
+ ///
+ public class ObjectGraphVisualizerCommand : ExpressionNodeVisualizerCommand
+ {
+ public ObjectGraphVisualizerCommand(ExpressionNode expressionNode)
+ :base(expressionNode)
+ {
+ }
+
+ public override bool CanExecute {
+ get { return true; }
+ }
+
+ public override string ToString()
+ {
+ return "Object graph visualizer";
+ }
+
+ public override void Execute()
+ {
+
+ }
+ }
+}
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/ShowGridVisualizerCommand.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ShowGridVisualizerCommand.cs
similarity index 86%
rename from src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/ShowGridVisualizerCommand.cs
rename to src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ShowGridVisualizerCommand.cs
index a8f0da22dc..0ff239a258 100644
--- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/ShowGridVisualizerCommand.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ShowGridVisualizerCommand.cs
@@ -4,10 +4,11 @@
//
// $Revision$
//
-using ICSharpCode.Core;
+using Debugger.AddIn.Visualizers.GridVisualizer;
using System;
+using ICSharpCode.Core;
-namespace Debugger.AddIn.Visualizers.GridVisualizer
+namespace Debugger.AddIn.Visualizers
{
///
/// Description of ShowGridVisualizerCommand.
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/ShowObjectGraphVisualizerCommand.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ShowObjectGraphVisualizerCommand.cs
similarity index 81%
rename from src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/ShowObjectGraphVisualizerCommand.cs
rename to src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ShowObjectGraphVisualizerCommand.cs
index e62b4a0412..0401c4fb6a 100644
--- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/ShowObjectGraphVisualizerCommand.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Commands/ShowObjectGraphVisualizerCommand.cs
@@ -4,13 +4,14 @@
//
// $Revision$
//
+using Debugger.AddIn.Visualizers.Graph;
using System;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
-namespace Debugger.AddIn.Visualizers.Graph
+namespace Debugger.AddIn.Visualizers
{
///
/// Command in the tools menu for showing the object graph visualizer.
@@ -21,8 +22,6 @@ namespace Debugger.AddIn.Visualizers.Graph
{
VisualizerWPFWindow window = new VisualizerWPFWindow();
window.Topmost = true;
- // fix non-editable TextBox bug
- //System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(window);
window.Show();
//WorkbenchSingleton.Workbench.ShowView(new DebuggerVisualizerViewContent());
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/ObjectValue.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/ObjectValue.cs
index 679330fccf..bda80c5591 100644
--- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/ObjectValue.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/GridVisualizer/ObjectValue.cs
@@ -66,7 +66,7 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer
Value permanentReference = value.GetPermanentReference();
result.PermanentReference = permanentReference;
- // cannot use GetMemberValues because memberValue does not have CodeTail anymore - we need the name of the member
+ // cannot use GetMemberValues because memberValue does not have CodeTail anymore - but we need the name of the member
/*foreach(MemberInfo memberInfo in permanentReference.Type.GetMembers(bindingFlags))
{
Value memberValue = permanentReference.GetMemberValue(memberInfo);
diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Utils/DebuggerHelpers.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Utils/DebuggerHelpers.cs
index 5f4547fb74..9b8b4831cb 100644
--- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Utils/DebuggerHelpers.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Utils/DebuggerHelpers.cs
@@ -23,6 +23,22 @@ namespace Debugger.AddIn.Visualizers.Utils
return refVal.Value;
}
+ ///
+ /// Returns true if this type is enum.
+ ///
+ public static bool IsEnum(this DebugType type)
+ {
+ return (type.BaseType != null) && (type.BaseType.FullName == "System.Enum");
+ }
+
+ ///
+ /// Returns true is this type is just System.Object.
+ ///
+ public static bool IsSystemDotObject(this DebugType type)
+ {
+ return type.FullName == "System.Object";
+ }
+
///
/// Evaluates expression and gets underlying address of object in the debuggee.
///
diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
index 5cf319fa05..76a90555a6 100644
--- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
+++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
@@ -227,6 +227,7 @@
Code
+
diff --git a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs
index 14d4b6e69e..899a99ab3e 100644
--- a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs
+++ b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerPopup.cs
@@ -27,8 +27,8 @@ namespace ICSharpCode.SharpDevelop.Debugging
this.Child = this.contentControl;
this.IsLeaf = false;
- this.contentControl.Focusable = true;
- Keyboard.Focus(this.contentControl);
+ //this.contentControl.Focusable = true;
+ //Keyboard.Focus(this.contentControl);
//this.AllowsTransparency = true;
//this.PopupAnimation = PopupAnimation.Slide;
}
diff --git a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml
index 0d9dd37711..96f4a836f4 100644
--- a/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml
+++ b/src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml
@@ -132,7 +132,7 @@