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()]
[GuidAttribute("59B2D1D0-5DB0-4F9F-9609-13F0168516D6")]
public interface IVsHierarchy

The IVsHierarchy type exposes the following members.

  NameDescription
Public methodAdviseHierarchyEventsEstablishes client notification of hierarchy events without the hierarchy implementing IConnectionPointContainer.
Public methodCloseCloses and cleans up a hierarchy once the environment determines that it is no longer used.
Public methodGetCanonicalNameReturns a unique, string name for an item in the hierarchy. Used for workspace persistence, such as remembering window positions.
Public methodGetGuidPropertyGets properties whose values are GUIDs.
Public methodGetNestedHierarchyMakes it possible for a node of a given hierarchy to be a shortcut to the middle of another hierarchy.
Public methodGetPropertyGets properties of a given node or of the hierarchy.
Public methodGetSiteGets the service provider from which to access the services.
Public methodParseCanonicalNameReturns the identifier of the hierarchy item, given its canonical name.
Public methodQueryCloseDetermines whether the given hierarchy can be closed.
Public methodSetGuidPropertySets properties whose values are GUIDs.
Public methodSetPropertySets properties of a specific node or of the hierarchy.
Public methodSetSiteSets the service provider from which to access the services.
Public methodUnadviseHierarchyEventsDisables client notification of hierarchy events without requiring that the hierarchy implement IConnectionPointContainer.
Public methodUnused0Adds new methods without recompiling or breaking binary compatibility.
Public methodUnused1Adds new methods without recompiling or breaking binary compatibility.
Public methodUnused2Adds new methods without recompiling or breaking binary compatibility.
Public methodUnused3Adds new methods without recompiling or breaking binary compatibility.
Public methodUnused4Adds new methods without recompiling or breaking binary compatibility.
Top

  NameDescription
Public Extension MethodIsCapabilityMatchChecks whether a given project matches the requirements prescribed in an AppliesTo expression. (Defined by PackageUtilities.)
Top

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 as a hierarchy, that is, a tree of nodes in which the nodes are project items. Each node also has a set of associated properties, and provides hierarchy management for VSPackages that implement project hierarchies.

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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft