本文整理汇总了C#中ICompletionData类的典型用法代码示例。如果您正苦于以下问题:C# ICompletionData类的具体用法?C# ICompletionData怎么用?C# ICompletionData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICompletionData类属于命名空间,在下文中一共展示了ICompletionData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertAction
/// <summary>
/// Called when entry should be inserted. Forward to the insertion action of the completion data.
/// </summary>
public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
{
textArea.SelectionManager.SetSelection(textArea.Document.OffsetToPosition(
Math.Min(insertionOffset - ((AEGISCompletionData)data).Expression.Length, textArea.Document.TextLength)
), textArea.Caret.Position);
return data.InsertAction(textArea, key);
}
示例2: Compare
public static int Compare(ICompletionData a, ICompletionData b) {
if (a == null)
throw new ArgumentNullException("a");
if (b == null)
throw new ArgumentNullException("b");
return string.Compare(a.Text, b.Text, StringComparison.InvariantCultureIgnoreCase);
}
示例3: AutoCompleteResponse
public AutoCompleteResponse(ICompletionData d)
{
DisplayText = d.DisplayText;
CompletionText = d.CompletionText;
Description = d.Description;
RequiredNamespaceImport = d is CompletionData ? ((CompletionData)d).RequiredNamespaceImport : (string)null;
}
示例4: GenerateCompletionData
/// <summary>
/// Generates the completion data. This method is called by the text editor control.
/// </summary>
/// <param name="fileName">the name of the file.</param>
/// <param name="textArea">The text area.</param>
/// <param name="charTyped">The character typed.</param>
/// <returns>The completion data.</returns>
public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
{
ICompletionData[] completionData = new ICompletionData[_texts.Length];
for (int i = 0; i < completionData.Length; i++)
completionData[i] = new DefaultCompletionData(_texts[i], null, _imageIndex);
return completionData;
}
示例5: InsertAction
public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
{
textArea.Caret.Position = textArea.Document.OffsetToPosition(
Math.Min(insertionOffset, textArea.Document.TextLength));
return data.InsertAction(textArea, key);
}
示例6: AddCompletionData
protected void AddCompletionData(ICompletionData data)
{
if (this._c != null)
{
this._c.CompletionList.CompletionData.Add(data);
}
}
示例7: CodeCompletionWindow
CodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData, Form parentForm, TextEditorControl control, bool showDeclarationWindow, bool fixedListViewWidth)
: base(parentForm, control)
{
this.dataProvider = completionDataProvider;
this.completionData = completionData;
this.document = control.Document;
this.showDeclarationWindow = showDeclarationWindow;
this.fixedListViewWidth = fixedListViewWidth;
workingScreen = Screen.GetWorkingArea(Location);
startOffset = control.ActiveTextAreaControl.Caret.Offset + 1;
endOffset = startOffset;
if (completionDataProvider.PreSelection != null) {
startOffset -= completionDataProvider.PreSelection.Length + 1;
endOffset--;
}
codeCompletionListView = new CodeCompletionListView(completionData);
codeCompletionListView.Font = new System.Drawing.Font(FontFamily.GenericMonospace, codeCompletionListView.Font.Size);
codeCompletionListView.ImageList = completionDataProvider.ImageList;
codeCompletionListView.Dock = DockStyle.Fill;
codeCompletionListView.SelectedItemChanged += new EventHandler(CodeCompletionListViewSelectedItemChanged);
codeCompletionListView.DoubleClick += new EventHandler(CodeCompletionListViewDoubleClick);
codeCompletionListView.Click += new EventHandler(CodeCompletionListViewClick);
Controls.Add(codeCompletionListView);
if (completionData.Length > MaxListLength) {
vScrollBar.Dock = DockStyle.Right;
vScrollBar.Minimum = 0;
vScrollBar.Maximum = completionData.Length - 1;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = MaxListLength;
codeCompletionListView.FirstItemChanged += new EventHandler(CodeCompletionListViewFirstItemChanged);
Controls.Add(vScrollBar);
}
this.drawingSize = GetListViewSize();
SetLocation();
if (declarationViewWindow == null) {
declarationViewWindow = new DeclarationViewWindow(parentForm);
}
SetDeclarationViewLocation();
declarationViewWindow.ShowDeclarationViewWindow();
declarationViewWindow.MouseMove += ControlMouseMove;
control.Focus();
CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty);
if (completionDataProvider.DefaultIndex >= 0) {
codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex);
}
if (completionDataProvider.PreSelection != null) {
CaretOffsetChanged(this, EventArgs.Empty);
}
vScrollBar.ValueChanged += VScrollBarValueChanged;
document.DocumentAboutToBeChanged += DocumentAboutToBeChanged;
}
示例8: GenerateCompletionData
public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
{
ICompletionData[] data = new ICompletionData[texts.Length];
for (int i = 0; i < data.Length; i++) {
data[i] = new DefaultCompletionData(texts[i], null, ClassBrowserIconService.GotoArrowIndex);
}
return data;
}
示例9: CompletionListView
/// <summary>
/// Initializes a new instance of the <see cref="CompletionListView"/> class.
/// </summary>
/// <param name="completionData">The completion data.</param>
public CompletionListView(ICompletionData[] completionData)
{
if (completionData == null)
throw new ArgumentNullException("completionData");
_fullCompletionData = completionData;
Array.Sort(_fullCompletionData, DefaultCompletionData.Compare);
_filteredCompletionData = new List<ICompletionData>(_fullCompletionData);
}
示例10: IdeBridgeCodeCompletionWindow
protected IdeBridgeCodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData, Form parentForm, TextEditorControl control, bool showDeclarationWindow, bool fixedListViewWidth)
: base(completionDataProvider, completionData, parentForm, control, showDeclarationWindow, fixedListViewWidth)
{
TopMost = true;
declarationViewWindow.Dispose();
declarationViewWindow = new DeclarationViewWindow(null);
declarationViewWindow.TopMost = true;
SetDeclarationViewLocation();
}
示例11: InsertAction
public virtual bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
{
if (InsertSpace) {
textArea.Document.Insert(insertionOffset++, " ");
}
textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
return data.InsertAction(textArea, key);
}
示例12: CompareTo
private static int CompareTo(ICompletionData a, ICompletionData b)
{
if (a.CompletionCategory == null && b.CompletionCategory == null)
return 0;
if (a.CompletionCategory == null)
return -1;
if (b.CompletionCategory == null)
return 1;
return a.CompletionCategory.CompareTo(b.CompletionCategory);
}
示例13: CodeCompletionListView
public CodeCompletionListView(ICompletionData[] completionData)
{
Array.Sort(completionData, DefaultCompletionData.Compare);
this.completionData = completionData;
// this.KeyDown += new System.Windows.Forms.KeyEventHandler(OnKey);
// SetStyle(ControlStyles.Selectable, false);
// SetStyle(ControlStyles.UserPaint, true);
// SetStyle(ControlStyles.DoubleBuffer, false);
}
示例14: CompareTo
public int CompareTo(ICompletionData other)
{
int c = this.Priority.CompareTo(other.Priority);
if (c == 0)
{
return this.InsertionText.CompareTo(other.InsertionText);
}
else
{
return c;
}
}
示例15: CodeCompletionWindow
CodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData, Form parentForm, TextEditorControl control, string fileName) : base(parentForm, control, fileName)
{
this.dataProvider = completionDataProvider;
this.completionData = completionData;
workingScreen = Screen.GetWorkingArea(Location);
startOffset = control.ActiveTextAreaControl.Caret.Offset + 1;
endOffset = startOffset;
if (completionDataProvider.PreSelection != null) {
startOffset -= completionDataProvider.PreSelection.Length + 1;
endOffset--;
}
codeCompletionListView = new CodeCompletionListView(completionData);
codeCompletionListView.ImageList = completionDataProvider.ImageList;
codeCompletionListView.Dock = DockStyle.Fill;
codeCompletionListView.SelectedItemChanged += new EventHandler(CodeCompletionListViewSelectedItemChanged);
codeCompletionListView.DoubleClick += new EventHandler(CodeCompletionListViewDoubleClick);
codeCompletionListView.Click += new EventHandler(CodeCompletionListViewClick);
Controls.Add(codeCompletionListView);
if (completionData.Length > 10) {
vScrollBar.Dock = DockStyle.Right;
vScrollBar.Minimum = 0;
vScrollBar.Maximum = completionData.Length - 8;
vScrollBar.SmallChange = 1;
vScrollBar.LargeChange = 3;
codeCompletionListView.FirstItemChanged += new EventHandler(CodeCompletionListViewFirstItemChanged);
Controls.Add(vScrollBar);
}
this.drawingSize = new Size(codeCompletionListView.ItemHeight * 10, codeCompletionListView.ItemHeight * Math.Min(10, completionData.Length));
SetLocation();
if (declarationViewWindow == null) {
declarationViewWindow = new DeclarationViewWindow(parentForm);
}
SetDeclarationViewLocation();
declarationViewWindow.ShowDeclarationViewWindow();
control.Focus();
CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty);
if (completionDataProvider.DefaultIndex >= 0) {
codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex);
}
if (completionDataProvider.PreSelection != null) {
CaretOffsetChanged(this, EventArgs.Empty);
}
vScrollBar.Scroll += new ScrollEventHandler(DoScroll);
}