mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-21 17:24:03 -05:00
Use object names instead of labels in node paths (#600)
This commit is contained in:
committed by
Karl Burtram
parent
92456d50aa
commit
167948256c
@@ -56,6 +56,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
||||
/// Returns the custom name of the object assigned to the node. If the object doesn't have custom name, returns empty string
|
||||
/// </summary>
|
||||
public abstract string GetNodeCustomName(object smoObject, SmoQueryContext smoContext);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the object as shown in its Object Explorer node path
|
||||
/// </summary>
|
||||
public abstract string GetNodePathName(object smoObject);
|
||||
|
||||
public abstract bool CanCreateChild(TreeNode parent, object context);
|
||||
public abstract TreeNode CreateChild(TreeNode parent, object context);
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
||||
private TreeNode parent;
|
||||
private string nodePath;
|
||||
private string label;
|
||||
private string nodePathName;
|
||||
public const char PathPartSeperator = '/';
|
||||
|
||||
/// <summary>
|
||||
@@ -62,6 +63,23 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
||||
/// </summary>
|
||||
public string NodeValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of this object as included in its node path
|
||||
/// </summary>
|
||||
public string NodePathName {
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(nodePathName))
|
||||
{
|
||||
return NodeValue;
|
||||
}
|
||||
return nodePathName;
|
||||
}
|
||||
set
|
||||
{
|
||||
nodePathName = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Object metadata for smo objects
|
||||
@@ -175,7 +193,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
||||
}
|
||||
// Otherwise add this value to the beginning of the path and keep iterating up
|
||||
path = string.Format(CultureInfo.InvariantCulture,
|
||||
"{0}{1}{2}", node.NodeValue, string.IsNullOrEmpty(path) ? "" : PathPartSeperator.ToString(), path);
|
||||
"{0}{1}{2}", node.NodePathName, string.IsNullOrEmpty(path) ? "" : PathPartSeperator.ToString(), path);
|
||||
return true;
|
||||
});
|
||||
nodePath = path;
|
||||
|
||||
Reference in New Issue
Block a user