diff --git a/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/Contracts/ExecutionPlanGraph.cs b/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/Contracts/ExecutionPlanGraph.cs index 9be8160b..d5f6702a 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/Contracts/ExecutionPlanGraph.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/Contracts/ExecutionPlanGraph.cs @@ -87,9 +87,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan /// public int DisplayOrder { get; set; } /// - /// Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip + /// Flag to show property at the bottom of tooltip. Generally done for for properties with longer value. /// - public bool IsLongString { get; set; } + public bool PositionAtBottom { get; set; } + /// + /// Value to be displayed in UI like tooltips and properties View + /// + /// + public string DisplayValue { get; set; } } public class NestedExecutionPlanGraphProperty : ExecutionPlanGraphPropertyBase diff --git a/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/ShowPlanGraph/PropertyValue.cs b/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/ShowPlanGraph/PropertyValue.cs index 703791ac..f5d1f69e 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/ShowPlanGraph/PropertyValue.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/ShowPlanGraph/PropertyValue.cs @@ -49,6 +49,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph } } + public bool ShowInTooltip + { + get + { + return this.showInTooltip; + } + } + public bool IsLongString { get @@ -189,6 +197,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph if (showInToolTipAttribute != null) { this.isLongString = showInToolTipAttribute.LongString; + this.showInTooltip = showInToolTipAttribute.Value; + } else + { + this.showInTooltip = false; } } @@ -203,6 +215,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph private PropertyDescriptor baseProperty; private bool isLongString; private bool initialized; + private bool showInTooltip; #endregion diff --git a/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/ShowPlanGraphUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/ShowPlanGraphUtils.cs index 56f9092f..43d59f43 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/ShowPlanGraphUtils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ShowPlan/ShowPlanGraphUtils.cs @@ -8,6 +8,8 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph; +using Microsoft.SqlTools.Utility; +using System.Diagnostics; namespace Microsoft.SqlTools.ServiceLayer.ShowPlan { @@ -70,9 +72,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan { Name = prop.DisplayName, Value = propertyValue, - ShowInTooltip = prop.IsBrowsable, + ShowInTooltip = prop.ShowInTooltip, DisplayOrder = prop.DisplayOrder, - IsLongString = prop.IsLongString, + PositionAtBottom = prop.IsLongString, + DisplayValue = GetPropertyDisplayValue(prop) }); } else @@ -82,9 +85,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ShowPlan { Name = prop.DisplayName, Value = propertyValue, - ShowInTooltip = prop.IsBrowsable, + ShowInTooltip = prop.ShowInTooltip, DisplayOrder = prop.DisplayOrder, - IsLongString = prop.IsLongString, + PositionAtBottom = prop.IsLongString, + DisplayValue = GetPropertyDisplayValue(prop) }); } @@ -122,5 +126,27 @@ GO */ "; } + + private static string GetPropertyDisplayValue(PropertyValue property) + { + try + { + // Get the property value. + object propertyValue = property.GetValue(property.Value); + + if (propertyValue == null) + { + return String.Empty; + } + + // Convert the property value to the text. + return property.Converter.ConvertToString(propertyValue).Trim(); + } + catch (Exception e) + { + Logger.Write(TraceEventType.Error, e.ToString()); + return String.Empty; + } + } } }