Partilhar via


IVsHierarchy Interface

Definition

Provides hierarchy management for VSPackages that implement project hierarchies.

public interface class IVsHierarchy
public interface class IVsHierarchy
__interface IVsHierarchy
[System.Runtime.InteropServices.ComConversionLoss]
[System.Runtime.InteropServices.Guid("59B2D1D0-5DB0-4F9F-9609-13F0168516D6")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsHierarchy
[System.Runtime.InteropServices.ComConversionLoss]
[System.Runtime.InteropServices.Guid("59B2D1D0-5DB0-4F9F-9609-13F0168516D6")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsHierarchy
[<System.Runtime.InteropServices.ComConversionLoss>]
[<System.Runtime.InteropServices.Guid("59B2D1D0-5DB0-4F9F-9609-13F0168516D6")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsHierarchy = interface
[<System.Runtime.InteropServices.ComConversionLoss>]
[<System.Runtime.InteropServices.Guid("59B2D1D0-5DB0-4F9F-9609-13F0168516D6")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsHierarchy = interface
Public Interface IVsHierarchy
Derived
Attributes

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.

Methods

AdviseHierarchyEvents(IVsHierarchyEvents, UInt32)

Establishes client notification of hierarchy events without the hierarchy implementing IConnectionPointContainer.

Close()

Closes and cleans up a hierarchy once the environment determines that it is no longer used.

GetCanonicalName(UInt32, String)

Returns a unique, string name for an item in the hierarchy. Used for workspace persistence, such as remembering window positions.

GetGuidProperty(UInt32, Int32, Guid)

Gets properties whose values are GUIDs.

GetNestedHierarchy(UInt32, Guid, IntPtr, UInt32)

Makes it possible for a node of a given hierarchy to be a shortcut to the middle of another hierarchy.

GetProperty(UInt32, Int32, Object)

Gets properties of a given node or of the hierarchy.

GetSite(IServiceProvider)

Gets the service provider from which to access the services.

ParseCanonicalName(String, UInt32)

Returns the identifier of the hierarchy item, given its canonical name.

QueryClose(Int32)

Determines whether the given hierarchy can be closed.

SetGuidProperty(UInt32, Int32, Guid)

Sets properties whose values are GUIDs.

SetProperty(UInt32, Int32, Object)

Sets properties of a specific node or of the hierarchy.

SetSite(IServiceProvider)

Sets the service provider from which to access the services.

UnadviseHierarchyEvents(UInt32)

Disables client notification of hierarchy events without requiring that the hierarchy implement IConnectionPointContainer.

Unused0()

Adds new methods without recompiling or breaking binary compatibility.

Unused1()

Adds new methods without recompiling or breaking binary compatibility.

Unused2()

Adds new methods without recompiling or breaking binary compatibility.

Unused3()

Adds new methods without recompiling or breaking binary compatibility.

Unused4()

Adds new methods without recompiling or breaking binary compatibility.

Extension Methods

IsCapabilityMatch(IVsHierarchy, String)

Checks whether a given project matches the requirements prescribed in an AppliesTo expression.

EnumImportingProjects(IVsHierarchy)

Enumerates all the projects that are importing shared assets owned by the given Shared Project hierarchy.

EnumOwningProjectsOfSharedAssets(IVsHierarchy)

Enumerates all the Shared Projects that own and manage the shared assets being imported by the given project.

GetActiveProjectContext(IVsHierarchy)

Gets the active project context.

GetSharedItemsImportFullPaths(IVsHierarchy)

Gets the full paths of the shared ".projitems" files imported by the given project.

IsProjectImportingSharedAssets(IVsHierarchy)

Is the given project importing shared assets?

IsSharedAssetsProject(IVsHierarchy)

Is the given project a Shared Project?

SetActiveProjectContext(IVsHierarchy, IVsHierarchy)

Sets the active project context.

Applies to