public virtual object GetProperty()

in Nodejs/Product/Nodejs/SharedProject/HierarchyNode.cs [615:840]


        public virtual object GetProperty(int propId)
        {
            object result = null;
            switch ((__VSHPROPID)propId)
            {
                case __VSHPROPID.VSHPROPID_Expandable:
                    result = (this.firstChild != null);
                    break;

                case __VSHPROPID.VSHPROPID_Caption:
                    result = this.Caption;
                    break;

                case __VSHPROPID.VSHPROPID_Name:
                    result = this.GetItemName();
                    break;

                case __VSHPROPID.VSHPROPID_ExpandByDefault:
                    result = false;
                    break;

#pragma warning disable 0618, 0612
                // Project subclasses decide whether or not to support using image
                // monikers, and so we need to keep the ImageIndex overrides in case
                // they choose not to.
                case __VSHPROPID.VSHPROPID_IconImgList:
                    result = this.ProjectMgr.ImageHandler.ImageList.Handle;
                    break;
                case __VSHPROPID.VSHPROPID_OpenFolderIconIndex:
                case __VSHPROPID.VSHPROPID_IconIndex:
                    var index = this.ImageIndex;
                    if (index != NoImage)
                    {
                        result = index;
                    }
                    break;
                case __VSHPROPID.VSHPROPID_IconHandle:
                    result = GetIconHandle(false);
                    break;
                case __VSHPROPID.VSHPROPID_OpenFolderIconHandle:
                    result = GetIconHandle(true);
                    break;
#pragma warning restore 0618, 0612
                case __VSHPROPID.VSHPROPID_StateIconIndex:
                    result = (int)this.StateIconIndex;
                    break;

                case __VSHPROPID.VSHPROPID_OverlayIconIndex:
                    result = (int)this.OverlayIconIndex;
                    break;

                case __VSHPROPID.VSHPROPID_NextVisibleSibling:
                    var nextVisible = this.NextVisibleSibling;
                    result = (int)((nextVisible != null) ? nextVisible.ID : VSConstants.VSITEMID_NIL);
                    break;

                case __VSHPROPID.VSHPROPID_NextSibling:
                    result = (int)((this.nextSibling != null) ? this.nextSibling.hierarchyId : VSConstants.VSITEMID_NIL);
                    break;

                case __VSHPROPID.VSHPROPID_IsNonMemberItem:
                    result = this.IsNonMemberItem;
                    break;

                case __VSHPROPID.VSHPROPID_IsHiddenItem:
                    result = !this.IsVisible;
                    break;

                case __VSHPROPID.VSHPROPID_IsNonSearchable:
                    result = !this.IsSearchable;
                    break;

                case __VSHPROPID.VSHPROPID_FirstChild:
                    result = (int)((this.firstChild != null) ? this.firstChild.hierarchyId : VSConstants.VSITEMID_NIL);
                    break;

                case __VSHPROPID.VSHPROPID_FirstVisibleChild:
                    var firstVisible = this.FirstVisibleChild;
                    result = (int)((firstVisible != null) ? firstVisible.hierarchyId : VSConstants.VSITEMID_NIL);
                    break;

                case __VSHPROPID.VSHPROPID_Parent:
                    if (null == this.parentNode)
                    {
                        unchecked { result = new IntPtr((int)VSConstants.VSITEMID_NIL); }
                    }
                    else
                    {
                        result = new IntPtr((int)this.parentNode.hierarchyId);  // see bug 176470
                    }
                    break;

                case __VSHPROPID.VSHPROPID_Root:
                    result = Marshal.GetIUnknownForObject(this.projectMgr);
                    break;

                case __VSHPROPID.VSHPROPID_Expanded:
                    result = this.IsExpanded;
                    break;

                case __VSHPROPID.VSHPROPID_BrowseObject:
                    result = this.NodeProperties;
                    if (result != null)
                    {
                        result = new DispatchWrapper(result);
                    }

                    break;

                case __VSHPROPID.VSHPROPID_EditLabel:
                    if (this.ProjectMgr != null && !this.ProjectMgr.IsClosed && !this.ProjectMgr.IsCurrentStateASuppressCommandsMode())
                    {
                        result = GetEditLabel();
                    }
                    break;

                case __VSHPROPID.VSHPROPID_SaveName:
                    //SaveName is the name shown in the Save and the Save Changes dialog boxes.
                    result = this.GetItemName();
                    break;

                case __VSHPROPID.VSHPROPID_ExtObject:
#if DEBUG
                    try
                    {
#endif
                        result = GetAutomationObject();
#if DEBUG
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(string.Format("Failed to get automation object for node {1}: {0}", e, this));
                        throw;
                    }
#endif
                    break;
            }

            var id2 = (__VSHPROPID2)propId;
            switch (id2)
            {
                case __VSHPROPID2.VSHPROPID_IsLinkFile:
                    result = this.IsLinkFile;
                    break;

                case __VSHPROPID2.VSHPROPID_NoDefaultNestedHierSorting:
                    return true; // We are doing the sorting ourselves through VSHPROPID_FirstChild and VSHPROPID_NextSibling
                case __VSHPROPID2.VSHPROPID_CfgBrowseObjectCATID:
                case __VSHPROPID2.VSHPROPID_BrowseObjectCATID:
                    {
                        // If there is a browse object and it is a NodeProperties, then get it's CATID
                        var browseObject = this.GetProperty((int)__VSHPROPID.VSHPROPID_BrowseObject);
                        if (browseObject != null)
                        {
                            if (browseObject is DispatchWrapper)
                            {
                                browseObject = ((DispatchWrapper)browseObject).WrappedObject;
                            }
                            result = this.ProjectMgr.GetCATIDForType(browseObject.GetType()).ToString("B");
                            if (StringComparer.Ordinal.Equals(result as string, Guid.Empty.ToString("B")))
                            {
                                result = null;
                            }
                        }
                        break;
                    }
                case __VSHPROPID2.VSHPROPID_ExtObjectCATID:
                    {
                        // If there is a extensibility object and it is a NodeProperties, then get it's CATID
                        var extObject = this.GetProperty((int)__VSHPROPID.VSHPROPID_ExtObject);
                        if (extObject != null)
                        {
                            if (extObject is DispatchWrapper)
                            {
                                extObject = ((DispatchWrapper)extObject).WrappedObject;
                            }
                            result = this.ProjectMgr.GetCATIDForType(extObject.GetType()).ToString("B");
                            if (StringComparer.Ordinal.Equals(result as string, Guid.Empty.ToString("B")))
                            {
                                result = null;
                            }
                        }
                        break;
                    }
            }

            var id5 = (__VSHPROPID5)propId;
            switch (id5)
            {
                case __VSHPROPID5.VSHPROPID_ProvisionalViewingStatus:
                    result = this.ProvisionalViewingStatus;
                    break;
            }
            var id8 = (__VSHPROPID8)propId;
            switch (id8)
            {
                case __VSHPROPID8.VSHPROPID_SupportsIconMonikers:
                    result = this.SupportsIconMonikers;
                    break;

                case __VSHPROPID8.VSHPROPID_IconMonikerGuid:
                    result = GetIconMoniker(false).Guid;
                    break;

                case __VSHPROPID8.VSHPROPID_IconMonikerId:
                    result = GetIconMoniker(false).Id;
                    break;

                case __VSHPROPID8.VSHPROPID_OpenFolderIconMonikerGuid:
                    result = GetIconMoniker(true).Guid;
                    break;

                case __VSHPROPID8.VSHPROPID_OpenFolderIconMonikerId:
                    result = GetIconMoniker(true).Id;
                    break;
            }

#if DEBUG
            if (propId != LastTracedProperty)
            {
                var trailer = (result == null) ? "null" : result.ToString();
                LastTracedProperty = propId; // some basic filtering here...
            }
#endif
            return result;
        }