/// <summary> /// Handles the exclude from project command. /// </summary> /// <returns></returns> internal override int ExcludeFromProject() { Debug.Assert(this.ProjectMgr != null, "The project item " + this.ToString() + " has not been initialised correctly. It has a null ProjectMgr"); if (!ProjectMgr.QueryEditProjectFile(false) || !ProjectMgr.Tracker.CanRemoveItems(new[] { Url }, new[] { VSQUERYREMOVEFILEFLAGS.VSQUERYREMOVEFILEFLAGS_NoFlags })) { return(VSConstants.E_FAIL); } ResetNodeProperties(); ItemNode.RemoveFromProjectFile(); if (!File.Exists(Url) || IsLinkFile) { ProjectMgr.OnItemDeleted(this); Parent.RemoveChild(this); } else { ItemNode = new AllFilesProjectElement(Url, ItemNode.ItemTypeName, ProjectMgr); if (!ProjectMgr.IsShowingAllFiles) { IsVisible = false; ProjectMgr.OnInvalidateItems(Parent); } ProjectMgr.ReDrawNode(this, UIHierarchyElement.Icon); ProjectMgr.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, 0); } ((IVsUIShell)GetService(typeof(SVsUIShell))).RefreshPropertyBrowser(0); return(VSConstants.S_OK); }
/// <summary> /// Handles the exclude from project command. /// </summary> /// <returns></returns> internal override int ExcludeFromProject() { ProjectMgr.Site.GetUIThread().MustBeCalledFromUIThread(); Debug.Assert(this.ProjectMgr != null, "The project item " + this.ToString() + " has not been initialised correctly. It has a null ProjectMgr"); if (!ProjectMgr.QueryEditProjectFile(false) || !ProjectMgr.QueryFolderRemove(Parent, Url)) { return(VSConstants.E_FAIL); } for (var child = FirstChild; child != null; child = child.NextSibling) { // we automatically exclude all children below us too int hr = child.ExcludeFromProject(); if (ErrorHandler.Failed(hr)) { return(hr); } } ResetNodeProperties(); ItemNode.RemoveFromProjectFile(); if (!Directory.Exists(CommonUtils.TrimEndSeparator(Url))) { ProjectMgr.OnItemDeleted(this); Parent.RemoveChild(this); } else { ItemNode = new AllFilesProjectElement(Url, ItemNode.ItemTypeName, ProjectMgr); if (!ProjectMgr.IsShowingAllFiles) { IsVisible = false; ProjectMgr.OnInvalidateItems(Parent); } ProjectMgr.ReDrawNode(this, UIHierarchyElement.Icon); ProjectMgr.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, 0); } // PERFORMANCE: call it once only! // ((IVsUIShell)GetService(typeof(SVsUIShell))).RefreshPropertyBrowser(0); return(VSConstants.S_OK); }
/// <summary> /// Handles the exclude from project command. /// </summary> /// <returns></returns> internal override int ExcludeFromProject() { Debug.Assert(this.ProjectMgr != null, "The project item " + this.ToString() + " has not been initialised correctly. It has a null ProjectMgr"); if (!ProjectMgr.QueryEditProjectFile(false) || !ProjectMgr.QueryFolderRemove(Parent, Url)) { return VSConstants.E_FAIL; } for (var child = FirstChild; child != null; child = child.NextSibling) { // we automatically exclude all children below us too int hr = child.ExcludeFromProject(); if (ErrorHandler.Failed(hr)) { return hr; } } ResetNodeProperties(); ItemNode.RemoveFromProjectFile(); if (!Directory.Exists(CommonUtils.TrimEndSeparator(Url))) { Parent.RemoveChild(this); ProjectMgr.OnItemDeleted(this); } else { ItemNode = new AllFilesProjectElement(Url, ItemNode.ItemTypeName, ProjectMgr); if (!ProjectMgr.IsShowingAllFiles) { IsVisible = false; ProjectMgr.OnInvalidateItems(Parent); } ProjectMgr.ReDrawNode(this, UIHierarchyElement.Icon); ProjectMgr.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, 0); } return VSConstants.S_OK; }
/// <summary> /// Handles the exclude from project command. /// </summary> /// <returns></returns> internal override int ExcludeFromProject() { Debug.Assert(this.ProjectMgr != null, "The project item " + this.ToString() + " has not been initialised correctly. It has a null ProjectMgr"); if (!ProjectMgr.QueryEditProjectFile(false) || !ProjectMgr.Tracker.CanRemoveItems(new[] { Url }, new [] { VSQUERYREMOVEFILEFLAGS.VSQUERYREMOVEFILEFLAGS_NoFlags })) { return VSConstants.E_FAIL; } ResetNodeProperties(); ItemNode.RemoveFromProjectFile(); if (!File.Exists(Url)) { Parent.RemoveChild(this); ProjectMgr.OnItemDeleted(this); } else { ItemNode = new AllFilesProjectElement(Url, ItemNode.ItemTypeName, ProjectMgr); if (!ProjectMgr.IsShowingAllFiles) { IsVisible = false; ProjectMgr.OnInvalidateItems(Parent); } ProjectMgr.ReDrawNode(this, UIHierarchyElement.Icon); ProjectMgr.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, 0); } return VSConstants.S_OK; }