public int GetProperty(uint itemid, int propid, out object pvar) { if (itemid == _nodes.RootNode.ItemId && propid == (int)__VSHPROPID.VSHPROPID_ProjectDir) { return(GetPropertyReturn(itemid, propid, "", out pvar, VSConstants.S_OK)); } // Display node before regular projects, but after "Solution Items". if (itemid == _nodes.RootNode.ItemId && propid == (int)__VSHPROPID.VSHPROPID_SortPriority) { return(GetPropertyReturn(itemid, propid, -1, out pvar, VSConstants.S_OK)); } NodeViewModel node = _nodes.GetNode(itemid); if (node == null) { return(GetPropertyReturn(itemid, propid, null, out pvar, VSConstants.E_NOTIMPL)); } switch (propid) { case (int)__VSHPROPID.VSHPROPID_ParentHierarchyItemid: case (int)__VSHPROPID.VSHPROPID_ParentHierarchy: return(GetPropertyReturn(itemid, propid, null, out pvar, VSConstants.E_FAIL)); case (int)__VSHPROPID.VSHPROPID_IconImgList: return(GetPropertyReturn(itemid, propid, (int)ImageListPtr, out pvar, VSConstants.S_OK)); default: int hresult = node.GetProperty(propid, out pvar); return(GetPropertyReturn(itemid, propid, pvar, out pvar, hresult)); } }
public int GetProperty(uint itemid, int propid, out object pvar) { if (itemid == _nodes.RootNode.ItemId && propid == (int)__VSHPROPID.VSHPROPID_ProjectDir) { return(GetPropertyReturn(itemid, propid, "", out pvar, VSConstants.S_OK)); } // Display node before regular projects, but after "Solution Items". if (itemid == _nodes.RootNode.ItemId && propid == (int)__VSHPROPID.VSHPROPID_SortPriority) { return(GetPropertyReturn(itemid, propid, -1, out pvar, VSConstants.S_OK)); } // Returning "true" for VSHPROPID_HasEnumerationSideEffects tells (some?) consumers that // they should not enumerate all elements of the hierarchy. This helps with slowdown in // Visual Studio stepping C++ code when 1) Source Explorer contains a large number of elements // (hundred of thousands) and 2) the PDB of the debuggee process contains paths that don't match // paths on the debugger machine. When both these conditions are verified, the VsDebug package // enumerates all items of the hierarchy and calls "GetMkDocument" on each element, which // can takes seconds because of the sheer number of elements. // By returning "true", we tell the VsDebug package to not bother enumerating our elements. if (itemid == _nodes.RootNode.ItemId && propid == (int)__VSHPROPID.VSHPROPID_HasEnumerationSideEffects) { return(GetPropertyReturn(itemid, propid, true, out pvar, VSConstants.S_OK)); } NodeViewModel node = _nodes.GetNode(itemid); if (node == null) { return(GetPropertyReturn(itemid, propid, null, out pvar, VSConstants.E_NOTIMPL)); } switch (propid) { case (int)__VSHPROPID.VSHPROPID_ParentHierarchyItemid: case (int)__VSHPROPID.VSHPROPID_ParentHierarchy: return(GetPropertyReturn(itemid, propid, null, out pvar, VSConstants.E_FAIL)); case (int)__VSHPROPID.VSHPROPID_IconImgList: return(GetPropertyReturn(itemid, propid, (int)ImageListPtr, out pvar, VSConstants.S_OK)); case (int)__VSHPROPID.VSHPROPID_FirstVisibleChild: case (int)__VSHPROPID.VSHPROPID_FirstChild: // Dynamically load children (if they are not loaded yet) var directoryNode = node as DirectoryNodeViewModel; if (directoryNode != null) { LoadDirectoryNodeChildren(directoryNode); } goto default; default: int hresult = node.GetProperty(propid, out pvar); return(GetPropertyReturn(itemid, propid, pvar, out pvar, hresult)); } }