Browse Source

Object graph and collection visualizer are not shown for strings anymore.

pull/15/head
mkonicek 15 years ago
parent
commit
5c7d95490b
  1. 16
      src/AddIns/Debugger/Debugger.AddIn/Tooltips/DebuggerPopup.cs
  2. 8
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/GridVisualizerCommand.cs
  3. 6
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/ObjectGraphVisualizerCommand.cs
  4. 3
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Utils/AtomicType.cs
  5. 6
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs

16
src/AddIns/Debugger/Debugger.AddIn/Tooltips/DebuggerPopup.cs

@ -19,13 +19,13 @@ namespace Debugger.AddIn.Tooltips
/// </summary> /// </summary>
public class DebuggerPopup : Popup public class DebuggerPopup : Popup
{ {
internal DebuggerTooltipControl contentControl; internal DebuggerTooltipControl innerControl;
public DebuggerPopup(DebuggerTooltipControl parentControl, Location logicalPosition, bool showPins = true) public DebuggerPopup(DebuggerTooltipControl parentControl, Location logicalPosition, bool showPins = true)
{ {
this.contentControl = new DebuggerTooltipControl(parentControl, logicalPosition, showPins); this.innerControl = new DebuggerTooltipControl(parentControl, logicalPosition, showPins);
this.contentControl.containingPopup = this; this.innerControl.containingPopup = this;
this.Child = this.contentControl; this.Child = this.innerControl;
this.IsLeaf = false; this.IsLeaf = false;
//this.KeyDown += new KeyEventHandler(DebuggerPopup_KeyDown); //this.KeyDown += new KeyEventHandler(DebuggerPopup_KeyDown);
@ -64,8 +64,8 @@ namespace Debugger.AddIn.Tooltips
public IEnumerable<ITreeNode> ItemsSource public IEnumerable<ITreeNode> ItemsSource
{ {
get { return this.contentControl.ItemsSource; } get { return this.innerControl.ItemsSource; }
set { this.contentControl.SetItemsSource(value); } set { this.innerControl.SetItemsSource(value); }
} }
private bool isLeaf; private bool isLeaf;
@ -84,7 +84,7 @@ namespace Debugger.AddIn.Tooltips
{ {
base.OnClosed(e); base.OnClosed(e);
if (isLeaf) { if (isLeaf) {
this.contentControl.CloseOnLostFocus(); this.innerControl.CloseOnLostFocus();
} }
} }
@ -95,7 +95,7 @@ namespace Debugger.AddIn.Tooltips
public void CloseSelfAndChildren() public void CloseSelfAndChildren()
{ {
this.contentControl.CloseChildPopups(); this.innerControl.CloseChildPopups();
this.IsOpen = false; this.IsOpen = false;
} }
} }

8
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/GridVisualizerCommand.cs

@ -17,8 +17,11 @@ namespace Debugger.AddIn.Visualizers
{ {
public bool IsVisualizerAvailable(DebugType type) public bool IsVisualizerAvailable(DebugType type)
{ {
if (type.IsAtomic()) {
return false;
}
DebugType collectionType, itemType; DebugType collectionType, itemType;
// Visualizer available for IEnumerable<T> (that means also IList<T>) // Visualizer available for IEnumerable<T> (that is, also IList<T>)
return type.ResolveIEnumerableImplementation(out collectionType, out itemType); return type.ResolveIEnumerableImplementation(out collectionType, out itemType);
} }
@ -49,8 +52,7 @@ namespace Debugger.AddIn.Visualizers
public override void Execute() public override void Execute()
{ {
if (this.Expression != null) if (this.Expression != null) {
{
var gridVisualizerWindow = GridVisualizerWindow.EnsureShown(); var gridVisualizerWindow = GridVisualizerWindow.EnsureShown();
gridVisualizerWindow.ShownExpression = this.Expression; gridVisualizerWindow.ShownExpression = this.Expression;
} }

6
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/ObjectGraphVisualizerCommand.cs

@ -17,8 +17,7 @@ namespace Debugger.AddIn.Visualizers
{ {
public bool IsVisualizerAvailable(DebugType type) public bool IsVisualizerAvailable(DebugType type)
{ {
bool typeIsAtomic = type.IsPrimitive || type.IsSystemDotObject() || type.IsEnum(); return !type.IsAtomic() && !type.IsSystemDotObject();
return !typeIsAtomic;
} }
public IVisualizerCommand CreateVisualizerCommand(Expression expression) public IVisualizerCommand CreateVisualizerCommand(Expression expression)
@ -48,8 +47,7 @@ namespace Debugger.AddIn.Visualizers
public override void Execute() public override void Execute()
{ {
if (this.Expression != null) if (this.Expression != null) {
{
var objectGraphWindow = ObjectGraphWindow.EnsureShown(); var objectGraphWindow = ObjectGraphWindow.EnsureShown();
objectGraphWindow.ShownExpression = this.Expression; objectGraphWindow.ShownExpression = this.Expression;
} }

3
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Utils/AtomicType.cs

@ -20,8 +20,7 @@ namespace Debugger.AddIn.Visualizers.Utils
/// <returns>True if expression's type is atomic, False otherwise.</returns> /// <returns>True if expression's type is atomic, False otherwise.</returns>
public static bool IsAtomic(this DebugType type) public static bool IsAtomic(this DebugType type)
{ {
// class is complex, String has IsClass == true but we want to treat it like atomic return type.IsPrimitive || type.FullName == "System.String" || type.IsEnum();
return !type.IsClass || type.FullName == "System.String";
} }
/// <summary> /// <summary>

6
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs

@ -265,7 +265,9 @@ namespace ICSharpCode.AvalonEdit.AddIn
if (popup == null) { if (popup == null) {
popup = CreatePopup(); popup = CreatePopup();
} }
// if popup was only first level, hovering somewhere else closes it
if (TryCloseExistingPopup(false)) { if (TryCloseExistingPopup(false)) {
// when popup content decides to close, close the popup // when popup content decides to close, close the popup
contentToShowITooltip.Closed += (closedSender, closedArgs) => { popup.IsOpen = false; }; contentToShowITooltip.Closed += (closedSender, closedArgs) => { popup.IsOpen = false; };
popup.Child = (UIElement)args.ContentToShow; popup.Child = (UIElement)args.ContentToShow;
@ -303,13 +305,13 @@ namespace ICSharpCode.AvalonEdit.AddIn
} }
} }
bool TryCloseExistingPopup(bool mouseClick) bool TryCloseExistingPopup(bool hard)
{ {
bool canClose = true; bool canClose = true;
if (popup != null) { if (popup != null) {
var popupContentITooltip = popup.Child as ITooltip; var popupContentITooltip = popup.Child as ITooltip;
if (popupContentITooltip != null) { if (popupContentITooltip != null) {
canClose = popupContentITooltip.Close(mouseClick); canClose = popupContentITooltip.Close(hard);
} }
if (canClose) { if (canClose) {
popup.IsOpen = false; popup.IsOpen = false;

Loading…
Cancel
Save