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

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

@ -17,8 +17,11 @@ namespace Debugger.AddIn.Visualizers @@ -17,8 +17,11 @@ namespace Debugger.AddIn.Visualizers
{
public bool IsVisualizerAvailable(DebugType type)
{
if (type.IsAtomic()) {
return false;
}
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);
}
@ -49,8 +52,7 @@ namespace Debugger.AddIn.Visualizers @@ -49,8 +52,7 @@ namespace Debugger.AddIn.Visualizers
public override void Execute()
{
if (this.Expression != null)
{
if (this.Expression != null) {
var gridVisualizerWindow = GridVisualizerWindow.EnsureShown();
gridVisualizerWindow.ShownExpression = this.Expression;
}

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

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

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

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

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

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

Loading…
Cancel
Save