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 @@ -29,5 +29,7 @@ namespace ICSharpCode.UnitTesting
{
return null;
}
public void CollapseAll() { }
}
}

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

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

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

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
@ -99,4 +100,20 @@ namespace ICSharpCode.UnitTesting @@ -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 @@ -120,6 +120,17 @@ namespace ICSharpCode.UnitTesting
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>
/// Called when a solution has been loaded.
/// </summary>

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

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

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

@ -177,9 +177,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -177,9 +177,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
if (this.classBrowserTreeView == null) return;
if (this.classBrowserTreeView.Nodes == null || this.classBrowserTreeView.Nodes.Count == 0) return;
foreach(TreeNode node in this.classBrowserTreeView.Nodes) {
node.Collapse(false);
}
this.classBrowserTreeView.CollapseAll();
}
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 @@ -491,13 +491,11 @@ namespace ICSharpCode.SharpDevelop.Project
if (this.treeView == null) return;
if (this.treeView.Nodes == null || this.treeView.Nodes.Count == 0) return;
foreach(TreeNode node in this.treeView.Nodes) {
if (expand) {
node.ExpandAll();
}
else {
node.Collapse(false);
}
if (expand) {
this.treeView.ExpandAll();
}
else {
this.treeView.CollapseAll();
}
this.treeView.Nodes[0].Expand();

Loading…
Cancel
Save