Compartir a través de


IVsRunningDocumentTable4.GetDocumentHierarchyItem Method

This is functionally identical to calling GetDocumentInfo and requesting only the document data, but this method easier to consume from managed code.

There are two pending states for a document:

RDT_PendingHierarchyInitialization: The project that owns the document hasn’t yet been loaded. This can happen only during asynchronous solution load (ASL). As individual projects are loaded, the documents owned by the projects are updated to remove the RDT_PendingHierarchyInitialization flag. By the time the solution is fully loaded, no documents are in this state.

RDT_PendingInitialization: The document data hasn’t been loaded, and the view hasn’t been created. A document in this state may or may not also have RDT_PendingHierarchyInitialization, but a document with RDT_PendingHierarchyInitialization always has RDT_PendingInitialization. Documents in this state are referred to as lazy or stub documents.

This method causes the project that owns a lazy document to be loaded immediately, rather than waiting for it to be loaded normally, so by the time the method returns, the document no longer has RDT_PendingHierarchyInitialization. It doesn’t cause the document itself to be loaded.

You should first call GetDocumentFlags and call GetDocumentHierarchyItem only if the document doesn’t have RDT_PendingInitialization among its flags. You can be notified that the document has been loaded by subscribing to running document table events and looking for the RDTA_DocumentInitialized flag in OnAfterAttributeChange or OnAfterAttributeChangeEx.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assemblies:   Microsoft.VisualStudio.Shell.Interop.12.0 (in Microsoft.VisualStudio.Shell.Interop.12.0.dll)
  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
Sub GetDocumentHierarchyItem ( _
    cookie As UInteger, _
    <OutAttribute> ByRef hierarchy As IVsHierarchy, _
    <OutAttribute> ByRef itemID As UInteger _
)
void GetDocumentHierarchyItem(
    uint cookie,
    out IVsHierarchy hierarchy,
    out uint itemID
)
void GetDocumentHierarchyItem(
    [InAttribute] unsigned int cookie, 
    [OutAttribute] IVsHierarchy^% hierarchy, 
    [OutAttribute] unsigned int% itemID
)
abstract GetDocumentHierarchyItem : 
        cookie:uint32 * 
        hierarchy:IVsHierarchy byref * 
        itemID:uint32 byref -> unit
function GetDocumentHierarchyItem(
    cookie : uint, 
    hierarchy : IVsHierarchy, 
    itemID : uint
)

Parameters

  • cookie
    Type: UInt32

    The document cookie.

  • itemID
    Type: UInt32%

    [out] The item ID.

.NET Framework Security

See Also

Reference

IVsRunningDocumentTable4 Interface

Microsoft.VisualStudio.Shell.Interop Namespace