Compartilhar via


IVsRunningDocumentTable4.GetDocumentHierarchyItem Method

Definition

This is functionally identical to calling GetDocumentInfo(UInt32, UInt32, UInt32, UInt32, String, IVsHierarchy, UInt32, IntPtr) 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(UInt32) 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(UInt32, UInt32) or OnAfterAttributeChangeEx(UInt32, UInt32, IVsHierarchy, UInt32, String, IVsHierarchy, UInt32, String).

public:
 void GetDocumentHierarchyItem(System::UInt32 cookie, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ % hierarchy, [Runtime::InteropServices::Out] System::UInt32 % itemID);
void GetDocumentHierarchyItem(unsigned int cookie, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & & hierarchy, [Runtime::InteropServices::Out] unsigned int & itemID);
public void GetDocumentHierarchyItem (uint cookie, out Microsoft.VisualStudio.Shell.Interop.IVsHierarchy hierarchy, out uint itemID);
abstract member GetDocumentHierarchyItem : uint32 * IVsHierarchy * uint32 -> unit
Public Sub GetDocumentHierarchyItem (cookie As UInteger, ByRef hierarchy As IVsHierarchy, ByRef itemID As UInteger)

Parameters

cookie
UInt32

The document cookie.

hierarchy
IVsHierarchy

[out] The project hierarchy.

itemID
UInt32

[out] The item ID.

Remarks

This method must be accessed on the main thread.

Applies to