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. 3
      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. 101
      src/AddIns/Analysis/UnitTesting/UnitTesting.addin
  6. 4
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowser.cs
  7. 12
      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() { }
} }
} }

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

@ -12,6 +12,7 @@ namespace ICSharpCode.UnitTesting
void BringToFront(); void BringToFront();
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>

101
src/AddIns/Analysis/UnitTesting/UnitTesting.addin

@ -19,17 +19,17 @@
<Path name="/SharpDevelop/UnitTesting/TestFrameworks"> <Path name="/SharpDevelop/UnitTesting/TestFrameworks">
<TestFramework id="nunit" <TestFramework id="nunit"
class="ICSharpCode.UnitTesting.NUnitTestFramework" class="ICSharpCode.UnitTesting.NUnitTestFramework"
supportedProjects=".csproj;.vbproj;.booproj" /> supportedProjects=".csproj;.vbproj;.booproj" />
</Path> </Path>
<Path name="/SharpDevelop/Workbench/Pads"> <Path name="/SharpDevelop/Workbench/Pads">
<Pad id="UnitTestingPad" <Pad id="UnitTestingPad"
category="Tools" category="Tools"
title="${res:ICSharpCode.NUnitPad.NUnitPadContent.PadName}" title="${res:ICSharpCode.NUnitPad.NUnitPadContent.PadName}"
icon="PadIcons.NUnitTest" icon="PadIcons.NUnitTest"
class="ICSharpCode.UnitTesting.UnitTestsPad" class="ICSharpCode.UnitTesting.UnitTestsPad"
defaultPosition="Right, Hidden" /> defaultPosition="Right, Hidden" />
</Path> </Path>
<Path name="/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu"> <Path name="/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu">
@ -51,9 +51,9 @@
</Not> </Not>
</And> </And>
<MenuItem id="RunInPad" <MenuItem id="RunInPad"
label="${res:ICSharpCode.UnitTesting.RunInTestPad}" label="${res:ICSharpCode.UnitTesting.RunInTestPad}"
icon="PadIcons.NUnitTest" icon="PadIcons.NUnitTest"
class="ICSharpCode.UnitTesting.RunTestInPadCommand"/> class="ICSharpCode.UnitTesting.RunTestInPadCommand"/>
</ComplexCondition> </ComplexCondition>
<Include id="CommonTestCommands" path="/SharpDevelop/Pads/UnitTestsPad/CommonTestCommands"/> <Include id="CommonTestCommands" path="/SharpDevelop/Pads/UnitTestsPad/CommonTestCommands"/>
</MenuItem> </MenuItem>
@ -71,9 +71,9 @@
</Not> </Not>
</And> </And>
<MenuItem id="RunInPad" <MenuItem id="RunInPad"
label="${res:ICSharpCode.UnitTesting.RunInTestPad}" label="${res:ICSharpCode.UnitTesting.RunInTestPad}"
icon="PadIcons.NUnitTest" icon="PadIcons.NUnitTest"
class="ICSharpCode.UnitTesting.RunTestInPadCommand"/> class="ICSharpCode.UnitTesting.RunTestInPadCommand"/>
</ComplexCondition> </ComplexCondition>
<Include id="CommonTestCommands" path="/SharpDevelop/Pads/UnitTestsPad/CommonTestCommands"/> <Include id="CommonTestCommands" path="/SharpDevelop/Pads/UnitTestsPad/CommonTestCommands"/>
</MenuItem> </MenuItem>
@ -89,9 +89,9 @@
</Not> </Not>
</And> </And>
<MenuItem id="RunWithDebugger" <MenuItem id="RunWithDebugger"
label="${res:ICSharpCode.UnitTesting.RunWithDebugger}" label="${res:ICSharpCode.UnitTesting.RunWithDebugger}"
icon="Icons.16x16.RunProgramIcon" icon="Icons.16x16.RunProgramIcon"
class="ICSharpCode.UnitTesting.RunTestWithDebuggerCommand"/> class="ICSharpCode.UnitTesting.RunTestWithDebuggerCommand"/>
</ComplexCondition> </ComplexCondition>
</Path> </Path>
@ -104,14 +104,14 @@
</Not> </Not>
</And> </And>
<ToolbarItem id="RunAll" <ToolbarItem id="RunAll"
icon="Icons.16x16.RunAllIcon" icon="Icons.16x16.RunAllIcon"
tooltip="${res:NUnitPad.NUnitPadContent.RunAllTests}" tooltip="${res:NUnitPad.NUnitPadContent.RunAllTests}"
class="ICSharpCode.UnitTesting.RunAllTestsInPadCommand"/> class="ICSharpCode.UnitTesting.RunAllTestsInPadCommand"/>
<ToolbarItem id="Run" <ToolbarItem id="Run"
insertafter="RunAll" insertafter="RunAll"
icon="Icons.16x16.RunProgramIcon" icon="Icons.16x16.RunProgramIcon"
tooltip="${res:NUnitPad.NUnitPadContent.RunItem}" tooltip="${res:NUnitPad.NUnitPadContent.RunItem}"
class="ICSharpCode.UnitTesting.RunTestInPadCommand"/> class="ICSharpCode.UnitTesting.RunTestInPadCommand"/>
</ComplexCondition> </ComplexCondition>
<ComplexCondition action="Disable"> <ComplexCondition action="Disable">
<And> <And>
@ -119,16 +119,21 @@
<Condition name="RunningTests"/> <Condition name="RunningTests"/>
</And> </And>
<ToolbarItem id="Stop" <ToolbarItem id="Stop"
icon="Icons.16x16.Debug.StopProcess" icon="Icons.16x16.Debug.StopProcess"
tooltip="${res:NUnitPad.NUnitPadContent.StopTests}" tooltip="${res:NUnitPad.NUnitPadContent.StopTests}"
class="ICSharpCode.UnitTesting.StopTestsCommand"/> class="ICSharpCode.UnitTesting.StopTestsCommand"/>
</ComplexCondition> </ComplexCondition>
<Condition name = "SolutionOpen" action="Disable"> <Condition name = "SolutionOpen" action="Disable">
<ToolbarItem id="Separator2" type="Separator"/> <ToolbarItem id="Separator2" type="Separator"/>
<ToolbarItem id="AddNUnitReference" <ToolbarItem id="AddNUnitReference"
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>
@ -141,9 +146,9 @@
</Not> </Not>
</And> </And>
<MenuItem id="Run" <MenuItem id="Run"
icon="Icons.16x16.RunProgramIcon" icon="Icons.16x16.RunProgramIcon"
label="${res:NUnitPad.NUnitPadContent.RunTestsContextMenuLabel}" label="${res:NUnitPad.NUnitPadContent.RunTestsContextMenuLabel}"
class="ICSharpCode.UnitTesting.RunTestInPadCommand"/> class="ICSharpCode.UnitTesting.RunTestInPadCommand"/>
</ComplexCondition> </ComplexCondition>
<Include id="CommonTestCommands" path="/SharpDevelop/Pads/UnitTestsPad/CommonTestCommands"/> <Include id="CommonTestCommands" path="/SharpDevelop/Pads/UnitTestsPad/CommonTestCommands"/>
<ComplexCondition action="Disable"> <ComplexCondition action="Disable">
@ -152,14 +157,14 @@
<Condition name="RunningTests"/> <Condition name="RunningTests"/>
</And> </And>
<MenuItem id="Stop" <MenuItem id="Stop"
icon="Icons.16x16.Debug.StopProcess" icon="Icons.16x16.Debug.StopProcess"
label="${res:NUnitPad.NUnitPadContent.StopTests}" label="${res:NUnitPad.NUnitPadContent.StopTests}"
class="ICSharpCode.UnitTesting.StopTestsCommand"/> class="ICSharpCode.UnitTesting.StopTestsCommand"/>
</ComplexCondition> </ComplexCondition>
<Condition name="Ownerstate" ownerstate="SourceCodeItemSelected" action="Disable"> <Condition name="Ownerstate" ownerstate="SourceCodeItemSelected" action="Disable">
<MenuItem id="GotoDefinition" <MenuItem id="GotoDefinition"
label="${res:NUnitPad.NUnitPadContent.GotoDefinitionContextMenuLabel}" label="${res:NUnitPad.NUnitPadContent.GotoDefinitionContextMenuLabel}"
class="ICSharpCode.UnitTesting.GotoDefinitionCommand"/> class="ICSharpCode.UnitTesting.GotoDefinitionCommand"/>
</Condition> </Condition>
</Path> </Path>
@ -173,9 +178,9 @@
</Not> </Not>
</And> </And>
<MenuItem id="RunAll" <MenuItem id="RunAll"
icon="Icons.16x16.RunAllIcon" icon="Icons.16x16.RunAllIcon"
label="${res:NUnitPad.NUnitPadContent.RunAllTests}" label="${res:NUnitPad.NUnitPadContent.RunAllTests}"
class="ICSharpCode.UnitTesting.RunAllTestsInPadCommand"/> class="ICSharpCode.UnitTesting.RunAllTestsInPadCommand"/>
</ComplexCondition> </ComplexCondition>
<ComplexCondition action="Disable"> <ComplexCondition action="Disable">
<And> <And>
@ -186,9 +191,9 @@
</Not> </Not>
</And> </And>
<MenuItem id="RunProjectTests" <MenuItem id="RunProjectTests"
icon="Icons.16x16.RunProgramIcon" icon="Icons.16x16.RunProgramIcon"
label="${res:ICSharpCode.UnitTesting.RunProjectTests}" label="${res:ICSharpCode.UnitTesting.RunProjectTests}"
class="ICSharpCode.UnitTesting.RunProjectTestsInPadCommand"/> class="ICSharpCode.UnitTesting.RunProjectTestsInPadCommand"/>
</ComplexCondition> </ComplexCondition>
<ComplexCondition action="Disable"> <ComplexCondition action="Disable">
<And> <And>
@ -196,16 +201,16 @@
<Condition name="RunningTests"/> <Condition name="RunningTests"/>
</And> </And>
<MenuItem id="Stop" <MenuItem id="Stop"
icon="Icons.16x16.Debug.StopProcess" icon="Icons.16x16.Debug.StopProcess"
label="${res:NUnitPad.NUnitPadContent.StopTests}" label="${res:NUnitPad.NUnitPadContent.StopTests}"
class="ICSharpCode.UnitTesting.StopTestsCommand"/> class="ICSharpCode.UnitTesting.StopTestsCommand"/>
</ComplexCondition> </ComplexCondition>
</MenuItem> </MenuItem>
</Path> </Path>
<Path name="/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions"> <Path name="/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">
<OptionPanel id="UnitTestingOptionsPanel" <OptionPanel id="UnitTestingOptionsPanel"
label="${res:ICSharpCode.NUnitPad.NUnitPadContent.PadName}" label="${res:ICSharpCode.NUnitPad.NUnitPadContent.PadName}"
class="ICSharpCode.UnitTesting.UnitTestingOptionsPanel"/> class="ICSharpCode.UnitTesting.UnitTestingOptionsPanel"/>
</Path> </Path>
</AddIn> </AddIn>

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)

12
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) { this.treeView.ExpandAll();
node.ExpandAll(); }
} else {
else { this.treeView.CollapseAll();
node.Collapse(false);
}
} }
this.treeView.Nodes[0].Expand(); this.treeView.Nodes[0].Expand();

Loading…
Cancel
Save