Compartir a través de


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)

Syntax

'Declaration
<InterfaceTypeAttribute()> _
<GuidAttribute("59B2D1D0-5DB0-4F9F-9609-13F0168516D6")> _
Public Interface IVsHierarchy
[InterfaceTypeAttribute()]
[GuidAttribute("59B2D1D0-5DB0-4F9F-9609-13F0168516D6")]
public interface IVsHierarchy
[InterfaceTypeAttribute()]
[GuidAttribute(L"59B2D1D0-5DB0-4F9F-9609-13F0168516D6")]
public interface class IVsHierarchy
[<InterfaceTypeAttribute()>]
[<GuidAttribute("59B2D1D0-5DB0-4F9F-9609-13F0168516D6")>]
type IVsHierarchy =  interface end
public interface IVsHierarchy

The IVsHierarchy type exposes the following members.

Methods

  Name Description
Public method AdviseHierarchyEvents Establishes client notification of hierarchy events without the hierarchy implementing IConnectionPointContainer.
Public method Close Closes and cleans up a hierarchy once the environment determines that it is no longer used.
Public method GetCanonicalName Returns a unique, string name for an item in the hierarchy. Used for workspace persistence, such as remembering window positions.
Public method GetGuidProperty Gets properties whose values are GUIDs.
Public method GetNestedHierarchy Makes it possible for a node of a given hierarchy to be a shortcut to the middle of another hierarchy.
Public method GetProperty Gets properties of a given node or of the hierarchy.
Public method GetSite Gets the service provider from which to access the services.
Public method ParseCanonicalName Returns the identifier of the hierarchy item, given its canonical name.
Public method QueryClose Determines whether the given hierarchy can be closed.
Public method SetGuidProperty Sets properties whose values are GUIDs.
Public method SetProperty Sets properties of a specific node or of the hierarchy.
Public method SetSite Sets the service provider from which to access the services.
Public method UnadviseHierarchyEvents Disables client notification of hierarchy events without requiring that the hierarchy implement IConnectionPointContainer.
Public method Unused0 Adds new methods without recompiling or breaking binary compatibility.
Public method Unused1 Adds new methods without recompiling or breaking binary compatibility.
Public method Unused2 Adds new methods without recompiling or breaking binary compatibility.
Public method Unused3 Adds new methods without recompiling or breaking binary compatibility.
Public method Unused4 Adds new methods without recompiling or breaking binary compatibility.

Top

Extension Methods

  Name Description
Public Extension Method IsCapabilityMatch Checks whether a given project matches the requirements prescribed in an AppliesTo expression. (Defined by PackageUtilities.)

Top

Remarks

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.

See Also

Reference

Microsoft.VisualStudio.Shell.Interop Namespace