コード例 #1
0
        internal override int IncludeInProject(bool includeChildren)
        {
            if (Parent.ItemNode != null && Parent.ItemNode.IsExcluded)
            {
                // if our parent is excluded it needs to first be included
                int hr = Parent.IncludeInProject(false);
                if (ErrorHandler.Failed(hr))
                {
                    return(hr);
                }
            }

            if (!ProjectMgr.QueryEditProjectFile(false) ||
                !ProjectMgr.QueryFolderAdd(Parent, Url))
            {
                return(VSConstants.E_FAIL);
            }

            ResetNodeProperties();
            ItemNode = ProjectMgr.CreateMsBuildFileItem(
                CommonUtils.GetRelativeDirectoryPath(ProjectMgr.ProjectHome, Url),
                ProjectFileConstants.Folder
                );
            IsVisible = true;

            if (includeChildren)
            {
                for (var child = FirstChild; child != null; child = child.NextSibling)
                {
                    // we automatically include all children below us too
                    int hr = child.IncludeInProject(includeChildren);
                    if (ErrorHandler.Failed(hr))
                    {
                        return(hr);
                    }
                }
            }
            ProjectMgr.ReDrawNode(this, UIHierarchyElement.Icon);
            ProjectMgr.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, 0);
            // PERFORMANCE: call it once only! // ((IVsUIShell)GetService(typeof(SVsUIShell))).RefreshPropertyBrowser(0);

            // On include, the folder should be added to source control.
            this.ProjectMgr.Tracker.OnFolderAdded(this.Url, VSADDDIRECTORYFLAGS.VSADDDIRECTORYFLAGS_NoFlags);

            return(VSConstants.S_OK);
        }
コード例 #2
0
        internal override int IncludeInProject(bool includeChildren)
        {
            if (Parent.ItemNode != null && Parent.ItemNode.IsExcluded)
            {
                // if our parent is excluded it needs to first be included
                int hr = Parent.IncludeInProject(false);
                if (ErrorHandler.Failed(hr))
                {
                    return(hr);
                }
            }

            if (!ProjectMgr.QueryEditProjectFile(false) ||
                !ProjectMgr.QueryFolderAdd(Parent, Url))
            {
                return(VSConstants.E_FAIL);
            }

            ResetNodeProperties();
            ItemNode = ProjectMgr.CreateMsBuildFileItem(
                CommonUtils.GetRelativeDirectoryPath(ProjectMgr.ProjectHome, Url),
                ProjectFileConstants.Folder
                );
            IsVisible = true;

            if (includeChildren)
            {
                for (var child = FirstChild; child != null; child = child.NextSibling)
                {
                    // we automatically include all children below us too
                    int hr = child.IncludeInProject(includeChildren);
                    if (ErrorHandler.Failed(hr))
                    {
                        return(hr);
                    }
                }
            }
            ProjectMgr.ReDrawNode(this, UIHierarchyElement.Icon);
            ProjectMgr.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, 0);
            return(VSConstants.S_OK);
        }