public override object GetIconHandle(bool open)
{
Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");
object iconHandle = null;
if (ErrorHandler.Failed(this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconHandle, out iconHandle)))
iconHandle = null;
if (iconHandle == null)
{
if (null == imageHandler)
{
InitImageHandler();
}
// Try to get an icon from the nested hierrachy image list.
if (imageHandler.ImageList != null)
{
object imageIndexAsObject = null;
if (this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconIndex, out imageIndexAsObject) == VSConstants.S_OK &&
imageIndexAsObject != null)
{
int imageIndex = (int)imageIndexAsObject;
if (imageIndex < imageHandler.ImageList.Images.Count)
{
iconHandle = imageHandler.GetIconHandle(imageIndex);
}
}
}
if (null == iconHandle)
{
iconHandle = this.ProjectManager.ImageHandler.GetIconHandle((int)ImageName.Application);
}
}
return iconHandle;
}