Export (0) Print
Expand All

IVsHierarchy Interface

Provides hierarchy management for VSPackages that implement project hierarchies.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in microsoft.visualstudio.shell.interop.dll)

[InterfaceTypeAttribute(1)] 
[GuidAttribute(L"59B2D1D0-5DB0-4F9F-9609-13F0168516D6")] 
public interface class IVsHierarchy
/** @attribute InterfaceTypeAttribute(1) */ 
/** @attribute GuidAttribute("59B2D1D0-5DB0-4F9F-9609-13F0168516D6") */ 
public interface IVsHierarchy
InterfaceTypeAttribute(1) 
GuidAttribute("59B2D1D0-5DB0-4F9F-9609-13F0168516D6") 
public interface IVsHierarchy

The IVsHierarchy interface is a generic interface to a hierarchy of nodes. Each node, including the root node, can have arbitrary properties associated with it. Each node on the hierarchy object is identified using a cookie (VSITEMID), which indicates a particular node. This cookie is invisible to the consumer of IVsHierarchy, and is typically a pointer to some private data maintained by the hierarchy's implementation.

A VSITEMID is a DWORD uniquely identifying a node within a hierarchy. Itemids from one IVsHierarchy may not be passed to another hierarchy. Also, note that itemids have a limited lifetime, as indicated by events fired by the hierarchy, so holding on to itemids for long durations will require either the sinking of these events, or the conversion of the itemid into a canonical, persistable form.

An item in a hierarchy can be a leaf node, a container of other items, or a link into some other hierarchy using GetNestedHierarchy.

The IVsHierarchy interface is not used only for project hierarchies. For example, the Server Explorer window implements the IVsHierarchy interface to display its hierarchy, which is not a project hierarchy.

There are times when it is useful to query a hierarchy about various virtual nodes, such as the hierarchy itself or the selected nodes within the hierarchy. Where such virtual nodes are potentially of interest, one of the predefined VSITEMID values may be passed.

The environment views a project—and persists in its view of a project—as a hierarchy. A hierarchy itself is a tree of nodes in which the entire tree is a graphical representation of the project items, their relationships, and their associated properties. Each node also has a set of associated properties. Provides hierarchy management for VSPackages that implement project hierarchies. The Visual Studio environment views a project—and persists in its view of a project—as a hierarchy. A hierarchy itself is a tree of nodes in which the entire tree is a graphical representation of the project items, their relationships, and their associated properties. Each node also has a set of associated properties.

See illustrations of the implementation and/or calling of this interface in the samples Basic Edit Overview, Basic Project Sample, Figures Project Sample, Solution Extender Sample, and My C Package Sample.

Notes to Implementers Implemented by VSPackages that create their own project hierarchy.

Notes to Callers Called by the environment to get and set hierarchy properties.

Community Additions

ADD
Show:
© 2015 Microsoft