From e5c620218d0a7ed734f5752810fc5c4aa4cfb6de Mon Sep 17 00:00:00 2001 From: James Ford Date: Sat, 14 Jan 2017 19:49:37 -0600 Subject: [PATCH 1/2] For purposes of property editing, a selected folder is now treated as an alias for having all child content items (recursively) selected. --- Tools/Pipeline/Common/PipelineController.cs | 2 +- Tools/Pipeline/MainWindow.cs | 33 ++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Tools/Pipeline/Common/PipelineController.cs b/Tools/Pipeline/Common/PipelineController.cs index f52c493a7ac..f5fb9d6c508 100644 --- a/Tools/Pipeline/Common/PipelineController.cs +++ b/Tools/Pipeline/Common/PipelineController.cs @@ -399,7 +399,7 @@ public void Build(bool rebuild) BuildCommand(commands); } - private IEnumerable GetItems(IProjectItem dir) + public IEnumerable GetItems(IProjectItem dir) { foreach (var item in _project.ContentItems) if (item.OriginalPath.StartsWith(dir.OriginalPath + "/")) diff --git a/Tools/Pipeline/MainWindow.cs b/Tools/Pipeline/MainWindow.cs index c6a4a2f0068..6c76e992bb1 100644 --- a/Tools/Pipeline/MainWindow.cs +++ b/Tools/Pipeline/MainWindow.cs @@ -210,7 +210,38 @@ public void EndTreeUpdate() public void UpdateProperties() { - propertyGridControl.SetObjects(PipelineController.Instance.SelectedItems); + // Convert selected DirectoryItems into ContentItems + + var stack = new List(); + var results = new List(); + + stack.AddRange(PipelineController.Instance.SelectedItems); + + while (stack.Count > 0) + { + var walk = stack[stack.Count - 1]; + stack.RemoveAt(stack.Count - 1); + + if (walk is ContentItem) + { + if (!results.Contains(walk)) + results.Add(walk); + + continue; + } + + if (walk is DirectoryItem) + { + var children = PipelineController.Instance.GetItems(walk); + foreach (var child in children) + { + if (!stack.Contains(child)) + stack.Add(child); + } + } + } + + propertyGridControl.SetObjects(results); } public void OutputAppend(string text) From 3d305e00e6092e5fa8581e7052ea42ec10acb3af Mon Sep 17 00:00:00 2001 From: James Ford Date: Tue, 10 Oct 2017 13:25:58 -0500 Subject: [PATCH 2/2] can now edit the project properties again --- Tools/Pipeline/MainWindow.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/Pipeline/MainWindow.cs b/Tools/Pipeline/MainWindow.cs index 6c76e992bb1..5f451f471a7 100644 --- a/Tools/Pipeline/MainWindow.cs +++ b/Tools/Pipeline/MainWindow.cs @@ -222,7 +222,7 @@ public void UpdateProperties() var walk = stack[stack.Count - 1]; stack.RemoveAt(stack.Count - 1); - if (walk is ContentItem) + if (walk is ContentItem || walk is PipelineProject) { if (!results.Contains(walk)) results.Add(walk);