Browse Source

add collapse all to unit tests pad

pull/14/head
Eusebiu Marcu 15 years ago
parent
commit
301352be07
  1. 2
      src/AddIns/Analysis/UnitTesting/Src/EmptyUnitTestsPad.cs
  2. 1
      src/AddIns/Analysis/UnitTesting/Src/IUnitTestsPad.cs
  3. 17
      src/AddIns/Analysis/UnitTesting/Src/UnitTestCommands.cs
  4. 11
      src/AddIns/Analysis/UnitTesting/Src/UnitTestsPad.cs
  5. 5
      src/AddIns/Analysis/UnitTesting/UnitTesting.addin
  6. 4
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowser.cs
  7. 6
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs

2
src/AddIns/Analysis/UnitTesting/Src/EmptyUnitTestsPad.cs

@ -29,5 +29,7 @@ namespace ICSharpCode.UnitTesting
{ {
return null; return null;
} }
public void CollapseAll() { }
} }
} }

1
src/AddIns/Analysis/UnitTesting/Src/IUnitTestsPad.cs

@ -13,5 +13,6 @@ namespace ICSharpCode.UnitTesting
void ResetTestResults(); void ResetTestResults();
IProject[] GetProjects(); IProject[] GetProjects();
TestProject GetTestProject(IProject project); TestProject GetTestProject(IProject project);
void CollapseAll();
} }
} }

17
src/AddIns/Analysis/UnitTesting/Src/UnitTestCommands.cs

@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
@ -99,4 +100,20 @@ namespace ICSharpCode.UnitTesting
} }
} }
} }
public class CollapseAllTestsCommand : AbstractMenuCommand
{
public override void Run()
{
if (!(this.Owner is TreeView))
return;
var treeView = (TreeView)this.Owner;
treeView.CollapseAll();
if (treeView.Nodes.Count > 0) {
treeView.Nodes[0].Expand();
}
}
}
} }

11
src/AddIns/Analysis/UnitTesting/Src/UnitTestsPad.cs

@ -120,6 +120,17 @@ namespace ICSharpCode.UnitTesting
ToolbarService.UpdateToolbar(toolStrip); ToolbarService.UpdateToolbar(toolStrip);
} }
/// <summary>
/// Collapses all nodes.
/// </summary>
public void CollapseAll()
{
if (treeView == null || treeView.Nodes == null || treeView.Nodes.Count == 0)
return;
treeView.CollapseAll();
}
/// <summary> /// <summary>
/// Called when a solution has been loaded. /// Called when a solution has been loaded.
/// </summary> /// </summary>

5
src/AddIns/Analysis/UnitTesting/UnitTesting.addin

@ -129,6 +129,11 @@
icon="Icons.16x16.Reference" icon="Icons.16x16.Reference"
tooltip="${res:NUnitPad.NUnitPadContent.ReferenceItem}" tooltip="${res:NUnitPad.NUnitPadContent.ReferenceItem}"
class="ICSharpCode.UnitTesting.AddNUnitReferenceCommand"/> class="ICSharpCode.UnitTesting.AddNUnitReferenceCommand"/>
<ToolbarItem id = "CollapseSeparator" type = "Separator"/>
<ToolbarItem id = "Collapse"
icon = "ProjectBrowser.Toolbar.Collapse"
tooltip = "${res:ProjectBrowser.Toolbar.CollapseAll}"
class = "ICSharpCode.UnitTesting.CollapseAllTestsCommand"/>
</Condition> </Condition>
</Path> </Path>

4
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowser.cs

@ -177,9 +177,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
if (this.classBrowserTreeView == null) return; if (this.classBrowserTreeView == null) return;
if (this.classBrowserTreeView.Nodes == null || this.classBrowserTreeView.Nodes.Count == 0) return; if (this.classBrowserTreeView.Nodes == null || this.classBrowserTreeView.Nodes.Count == 0) return;
foreach(TreeNode node in this.classBrowserTreeView.Nodes) { this.classBrowserTreeView.CollapseAll();
node.Collapse(false);
}
} }
void ClassBrowserTreeViewAfterSelect(object sender, TreeViewEventArgs e) void ClassBrowserTreeViewAfterSelect(object sender, TreeViewEventArgs e)

6
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs

@ -491,13 +491,11 @@ namespace ICSharpCode.SharpDevelop.Project
if (this.treeView == null) return; if (this.treeView == null) return;
if (this.treeView.Nodes == null || this.treeView.Nodes.Count == 0) return; if (this.treeView.Nodes == null || this.treeView.Nodes.Count == 0) return;
foreach(TreeNode node in this.treeView.Nodes) {
if (expand) { if (expand) {
node.ExpandAll(); this.treeView.ExpandAll();
} }
else { else {
node.Collapse(false); this.treeView.CollapseAll();
}
} }
this.treeView.Nodes[0].Expand(); this.treeView.Nodes[0].Expand();

Loading…
Cancel
Save