Code Coverage Statistics for Source File
c:\Tools\SD3\src\Libraries\ICSharpCode.TextEditor\Project\Src\Actions\FoldActions.cs
|
Sequence Point Coverage
N/A
0 of 0
|
Branch Coverage
N/A
0 of 0
|
Lines
54
|
Highlight:
Uncovered Code
Covered Code
| L | V | Source |
|---|---|---|
1 |
// <file> |
|
2 |
// <copyright see="prj:///doc/copyright.txt"/> |
|
3 |
// <license see="prj:///doc/license.txt"/> |
|
4 |
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/> |
|
5 |
// <version>$Revision: 1965 $</version> |
|
6 |
// </file> |
|
7 |
||
8 |
using System; |
|
9 |
using System.Collections.Generic; |
|
10 |
using ICSharpCode.TextEditor.Document; |
|
11 |
||
12 |
namespace ICSharpCode.TextEditor.Actions |
|
13 |
{ |
|
14 |
public class ToggleFolding : AbstractEditAction |
|
15 |
{ |
|
16 |
public override void Execute(TextArea textArea) |
|
17 |
{ |
|
18 |
List<FoldMarker> foldMarkers = textArea.Document.FoldingManager.GetFoldingsWithStart(textArea.Caret.Line); |
|
19 |
foreach (FoldMarker fm in foldMarkers) { |
|
20 |
fm.IsFolded = !fm.IsFolded; |
|
21 |
} |
|
22 |
textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty); |
|
23 |
} |
|
24 |
} |
|
25 |
||
26 |
public class ToggleAllFoldings : AbstractEditAction |
|
27 |
{ |
|
28 |
public override void Execute(TextArea textArea) |
|
29 |
{ |
|
30 |
bool doFold = true; |
|
31 |
foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) { |
|
32 |
if (fm.IsFolded) { |
|
33 |
doFold = false; |
|
34 |
break; |
|
35 |
} |
|
36 |
} |
|
37 |
foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) { |
|
38 |
fm.IsFolded = doFold; |
|
39 |
} |
|
40 |
textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty); |
|
41 |
} |
|
42 |
} |
|
43 |
||
44 |
public class ShowDefinitionsOnly : AbstractEditAction |
|
45 |
{ |
|
46 |
public override void Execute(TextArea textArea) |
|
47 |
{ |
|
48 |
foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) { |
|
49 |
fm.IsFolded = fm.FoldType == FoldType.MemberBody || fm.FoldType == FoldType.Region; |
|
50 |
} |
|
51 |
textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty); |
|
52 |
} |
|
53 |
} |
|
54 |
} |