mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
introduce object type property to node (#1614)
This commit is contained in:
@@ -58,5 +58,10 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Contracts
|
|||||||
/// Error message returned from the engine for a object explorer node failure reason, if any.
|
/// Error message returned from the engine for a object explorer node failure reason, if any.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ErrorMessage { get; set; }
|
public string ErrorMessage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The object type of the node. e.g. Database, Server, Tables...
|
||||||
|
/// </summary>
|
||||||
|
public string ObjectType { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of this object as included in its node path
|
/// The name of this object as included in its node path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string NodePathName {
|
public string NodePathName
|
||||||
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(nodePathName))
|
if (string.IsNullOrEmpty(nodePathName))
|
||||||
@@ -123,10 +124,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
|||||||
/// for many nodes such as the server, the display label will be different
|
/// for many nodes such as the server, the display label will be different
|
||||||
/// to the value.
|
/// to the value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Label {
|
public string Label
|
||||||
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if(label == null)
|
if (label == null)
|
||||||
{
|
{
|
||||||
return NodeValue;
|
return NodeValue;
|
||||||
}
|
}
|
||||||
@@ -166,7 +168,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
|||||||
nodePath = null;
|
nodePath = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path identifying this node: for example a table will be at ["server", "database", "tables", "tableName"].
|
/// Path identifying this node: for example a table will be at ["server", "database", "tables", "tableName"].
|
||||||
/// This enables rapid navigation of the tree without the need for a global registry of elements.
|
/// This enables rapid navigation of the tree without the need for a global registry of elements.
|
||||||
@@ -193,7 +195,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Otherwise add this value to the beginning of the path and keep iterating up
|
// Otherwise add this value to the beginning of the path and keep iterating up
|
||||||
path = string.Format(CultureInfo.InvariantCulture,
|
path = string.Format(CultureInfo.InvariantCulture,
|
||||||
"{0}{1}{2}", node.NodePathName, string.IsNullOrEmpty(path) ? "" : PathPartSeperator.ToString(), path);
|
"{0}{1}{2}", node.NodePathName, string.IsNullOrEmpty(path) ? "" : PathPartSeperator.ToString(), path);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@@ -229,7 +231,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
|||||||
Metadata = this.ObjectMetadata,
|
Metadata = this.ObjectMetadata,
|
||||||
NodeStatus = this.NodeStatus,
|
NodeStatus = this.NodeStatus,
|
||||||
NodeSubType = this.NodeSubType,
|
NodeSubType = this.NodeSubType,
|
||||||
ErrorMessage = this.ErrorMessage
|
ErrorMessage = this.ErrorMessage,
|
||||||
|
ObjectType = this.NodeTypeId.ToString()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +293,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
|||||||
children.Add(newChild);
|
children.Add(newChild);
|
||||||
newChild.Parent = this;
|
newChild.Parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Optional context to help with lookup of children
|
/// Optional context to help with lookup of children
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -400,7 +403,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes
|
|||||||
{
|
{
|
||||||
return string.Compare(thisItem.NodeValue, otherItem.NodeValue, StringComparison.OrdinalIgnoreCase);
|
return string.Compare(thisItem.NodeValue, otherItem.NodeValue, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CompareTo(TreeNode other)
|
public int CompareTo(TreeNode other)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user