public IVsHierarchyItem GetActiveHierarchy() { return(asyncManager.Run(async() => { await asyncManager.SwitchToMainThread(); IVsUIHierarchy uiHier; if (ErrorHandler.Failed(hierarchyWindow.FindCommonSelectedHierarchy((uint)__VSCOMHIEROPTIONS.COMHIEROPT_RootHierarchyOnly, out uiHier))) { return null; } return hierarchyManager.GetHierarchyItem(uiHier, VSConstants.VSITEMID_ROOT); })); }
// -------------------------------------------------------------------------------------------- /// <summary> /// Finds the common selection. /// </summary> /// <param name="window">The window.</param> /// <param name="commonHier">The common hier.</param> // -------------------------------------------------------------------------------------------- public static int FindCommonSelectionRoot(this IVsUIHierarchyWindow window, out IVsUIHierarchy commonHier) { return(window.FindCommonSelectedHierarchy( (uint)__VSCOMHIEROPTIONS.COMHIEROPT_AllowHiddenRoot, out commonHier)); }