Code Coverage Statistics for Source File
c:\Tools\SD3\src\Libraries\ICSharpCode.TextEditor\Project\Src\Gui\CompletionWindow\ICompletionData.cs
|
Sequence Point Coverage
N/A
0 of 0
|
Branch Coverage
N/A
0 of 0
|
Lines
107
|
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 |
||
10 |
namespace ICSharpCode.TextEditor.Gui.CompletionWindow |
|
11 |
{ |
|
12 |
public interface ICompletionData : IComparable |
|
13 |
{ |
|
14 |
int ImageIndex { |
|
15 |
get; |
|
16 |
} |
|
17 |
||
18 |
string Text { |
|
19 |
get; |
|
20 |
set; |
|
21 |
} |
|
22 |
||
23 |
string Description { |
|
24 |
get; |
|
25 |
} |
|
26 |
||
27 |
/// <summary> |
|
28 |
/// Gets a priority value for the completion data item. |
|
29 |
/// When selecting items by their start characters, the item with the highest |
|
30 |
/// priority is selected first. |
|
31 |
/// </summary> |
|
32 |
double Priority { |
|
33 |
get; |
|
34 |
} |
|
35 |
||
36 |
/// <summary> |
|
37 |
/// Insert the element represented by the completion data into the text |
|
38 |
/// editor. |
|
39 |
/// </summary> |
|
40 |
/// <param name="textArea">TextArea to insert the completion data in.</param> |
|
41 |
/// <param name="ch">Character that should be inserted after the completion data. |
|
42 |
/// \0 when no character should be inserted.</param> |
|
43 |
/// <returns>Returns true when the insert action has processed the character |
|
44 |
/// <paramref name="ch"/>; false when the character was not processed.</returns> |
|
45 |
bool InsertAction(TextArea textArea, char ch); |
|
46 |
} |
|
47 |
||
48 |
public class DefaultCompletionData : ICompletionData |
|
49 |
{ |
|
50 |
string text; |
|
51 |
string description; |
|
52 |
int imageIndex; |
|
53 |
||
54 |
public int ImageIndex { |
|
55 |
get { |
|
56 |
return imageIndex; |
|
57 |
} |
|
58 |
} |
|
59 |
||
60 |
public string Text { |
|
61 |
get { |
|
62 |
return text; |
|
63 |
} |
|
64 |
set { |
|
65 |
text = value; |
|
66 |
} |
|
67 |
} |
|
68 |
||
69 |
public string Description { |
|
70 |
get { |
|
71 |
return description; |
|
72 |
} |
|
73 |
} |
|
74 |
||
75 |
double priority; |
|
76 |
||
77 |
public double Priority { |
|
78 |
get { |
|
79 |
return priority; |
|
80 |
} |
|
81 |
set { |
|
82 |
priority = value; |
|
83 |
} |
|
84 |
} |
|
85 |
||
86 |
public virtual bool InsertAction(TextArea textArea, char ch) |
|
87 |
{ |
|
88 |
textArea.InsertString(text); |
|
89 |
return false; |
|
90 |
} |
|
91 |
||
92 |
public DefaultCompletionData(string text, string description, int imageIndex) |
|
93 |
{ |
|
94 |
this.text = text; |
|
95 |
this.description = description; |
|
96 |
this.imageIndex = imageIndex; |
|
97 |
} |
|
98 |
||
99 |
public int CompareTo(object obj) |
|
100 |
{ |
|
101 |
if (obj == null || !(obj is DefaultCompletionData)) { |
|
102 |
return -1; |
|
103 |
} |
|
104 |
return text.CompareTo(((DefaultCompletionData)obj).Text); |
|
105 |
} |
|
106 |
} |
|
107 |
} |