当前位置: 首页>>代码示例>>C#>>正文


C# ICompletionWidget类代码示例

本文整理汇总了C#中ICompletionWidget的典型用法代码示例。如果您正苦于以下问题:C# ICompletionWidget类的具体用法?C# ICompletionWidget怎么用?C# ICompletionWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ICompletionWidget类属于命名空间,在下文中一共展示了ICompletionWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowWindow

		// ext may be null, but then parameter completion don't work
		public static bool ShowWindow (CompletionTextEditorExtension ext, char firstChar, ICompletionDataList list, ICompletionWidget completionWidget, CodeCompletionContext completionContext)
		{
			try {
				if (ext != null) {
					int inserted = ext.document.Editor.EnsureCaretIsNotVirtual ();
					if (inserted > 0)
						completionContext.TriggerOffset = ext.document.Editor.Caret.Offset;
				}
				if (wnd == null) {
					wnd = new CompletionListWindow ();
					wnd.WordCompleted += HandleWndWordCompleted;
				}
				wnd.Extension = ext;
				try {
					if (!wnd.ShowListWindow (firstChar, list, completionWidget, completionContext)) {
						if (list is IDisposable)
							((IDisposable)list).Dispose ();
						HideWindow ();
						return false;
					}
					
					if (ForceSuggestionMode)
						wnd.AutoSelect = false;
					wnd.Show ();
					DesktopService.RemoveWindowShadow (wnd);
					OnWindowShown (EventArgs.Empty);
					return true;
				} catch (Exception ex) {
					LoggingService.LogError (ex.ToString ());
					return false;
				}
			} finally {
				ParameterInformationWindowManager.UpdateWindow (ext, completionWidget);
			}
		}
开发者ID:harishamdani,项目名称:monodevelop,代码行数:36,代码来源:CompletionWindowManager.cs

示例2: ShowWindow

		public static bool ShowWindow (char firstChar, ICompletionDataList list, ICompletionWidget completionWidget, CodeCompletionContext completionContext, System.Action closedDelegate)
		{
			try {
				if (wnd == null) {
					wnd = new CompletionListWindow ();
					wnd.WordCompleted += HandleWndWordCompleted;
				}
				try {
					if (!wnd.ShowListWindow (firstChar, list, completionWidget, completionContext, closedDelegate)) {
						if (list is IDisposable)
							((IDisposable)list).Dispose ();
						DestroyWindow ();
						return false;
					}
					
					if (ForceSuggestionMode)
						wnd.AutoSelect = false;
					
					OnWindowShown (EventArgs.Empty);
					return true;
				} catch (Exception ex) {
					LoggingService.LogError (ex.ToString ());
					return false;
				}
			} finally {
				ParameterInformationWindowManager.UpdateWindow (completionWidget);
			}
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:28,代码来源:CompletionWindowManager.cs

示例3: InsertCompletionText

        public void InsertCompletionText(ICompletionWidget widget, CodeCompletionContext context)
        {
            // insert add/remove event handler code after +=/-=
            editor.Replace (initialOffset, editor.Caret.Offset - initialOffset, this.DisplayText + ";");

            // Search opening bracket of member
            int pos = editor.Document.LocationToOffset (callingMember.BodyRegion.Start.Line - 1, callingMember.BodyRegion.Start.Column - 1);
            while (pos < editor.Document.Length && editor.Document.GetCharAt (pos) != '{') {
                pos++;
            }

            // Search closing bracket of member
            pos = editor.Document.GetMatchingBracketOffset (pos) + 1;

            pos = Math.Max (0, Math.Min (pos, editor.Document.Length - 1));

            // Insert new event handler after closing bracket
            string indent = editor.Document.GetLine (callingMember.Location.Line).GetIndentation (editor.Document);

            StringBuilder sb = new StringBuilder ();
            sb.AppendLine ();
            sb.AppendLine ();
            sb.Append (indent);
            if (callingMember.IsStatic)
                sb.Append ("static ");
            sb.Append ("void ");sb.Append (this.DisplayText);sb.Append (' ');sb.Append (this.parameterList);sb.AppendLine ();
            sb.Append (indent);sb.Append ("{");sb.AppendLine ();
            sb.Append (indent);sb.Append (TextEditorProperties.IndentString);
            int cursorPos = pos + sb.Length;
            sb.AppendLine ();
            sb.Append (indent);sb.Append ("}");
            editor.Insert (pos, sb.ToString ());
            editor.Caret.Offset = cursorPos;
        }
开发者ID:vasili,项目名称:FSharpBinding,代码行数:34,代码来源:EventCreationCompletionData.cs

示例4: ProcessKeyEvent

		// Called when a key is pressed in the editor.
		// Returns false if the key press has to continue normal processing.
		internal static bool ProcessKeyEvent (CompletionTextEditorExtension ext, ICompletionWidget widget, KeyDescriptor descriptor)
		{
			if (methods.Count == 0)
				return false;

			MethodData cmd = methods [methods.Count - 1];

			if (descriptor.SpecialKey == SpecialKey.Down) {
				if (cmd.MethodProvider.Count <= 1)
					return false;
				if (cmd.CurrentOverload < cmd.MethodProvider.Count - 1)
					cmd.CurrentOverload ++;
				else
					cmd.CurrentOverload = 0;
				window.ChangeOverload ();
				UpdateWindow (ext, widget);
				return true;
			} else if (descriptor.SpecialKey == SpecialKey.Up) {
				if (cmd.MethodProvider.Count <= 1)
					return false;
				if (cmd.CurrentOverload > 0)
					cmd.CurrentOverload --;
				else
					cmd.CurrentOverload = cmd.MethodProvider.Count - 1;
				window.ChangeOverload ();
				UpdateWindow (ext, widget);
				return true;
			}
			else if (descriptor.SpecialKey == SpecialKey.Escape) {
				HideWindow (ext, widget);
				return true;
			}
			return false;
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:36,代码来源:ParameterInformationWindowManager.cs

示例5: PostProcessKeyEvent

		public static void PostProcessKeyEvent (ICompletionWidget widget, Gdk.Key key, Gdk.ModifierType modifier)
		{
			// Called after the key has been processed by the editor
		
			if (methods.Count == 0)
				return;
				
			for (int n=0; n<methods.Count; n++) {
				// If the cursor is outside of any of the methods parameter list, discard the
				// information window for that method.
				
				MethodData md = methods [n];
				int pos = md.MethodProvider.GetCurrentParameterIndex (widget, md.CompletionContext);
				if (pos == -1) {
					methods.RemoveAt (n);
					n--;
				}
			}
			// If the user enters more parameters than the current overload has,
			// look for another overload with more parameters.
			UpdateOverload (widget);
			
			// Refresh.
			UpdateWindow (widget);
		}
开发者ID:Shanto,项目名称:monodevelop,代码行数:25,代码来源:ParameterInformationWindowManager.cs

示例6: ProcessKeyEvent

		// Called when a key is pressed in the editor.
		// Returns false if the key press has to continue normal processing.
		public static bool ProcessKeyEvent (ICompletionWidget widget, Gdk.Key key, Gdk.ModifierType modifier)
		{
			if (methods.Count == 0)
				return false;

			MethodData cmd = methods [methods.Count - 1];
			
			if (key == Gdk.Key.Down) {
				if (cmd.MethodProvider.OverloadCount <= 1)
					return false;
				if (cmd.CurrentOverload < cmd.MethodProvider.OverloadCount - 1)
					cmd.CurrentOverload ++;
				else
					cmd.CurrentOverload = 0;
				UpdateWindow (widget);
				return true;
			}
			else if (key == Gdk.Key.Up) {
				if (cmd.MethodProvider.OverloadCount <= 1)
					return false;
				if (cmd.CurrentOverload > 0)
					cmd.CurrentOverload --;
				else
					cmd.CurrentOverload = cmd.MethodProvider.OverloadCount - 1;
				UpdateWindow (widget);
				return true;
			}
			else if (key == Gdk.Key.Escape) {
				HideWindow (widget);
				return true;
			}
			return false;
		}
开发者ID:Shanto,项目名称:monodevelop,代码行数:35,代码来源:ParameterInformationWindowManager.cs

示例7: ShowWindow

		public static void ShowWindow (char firstChar, ICompletionDataProvider provider, ICompletionWidget completionWidget, ICodeCompletionContext completionContext, CompletionDelegate closedDelegate)
		{
			try {
				if (!wnd.ShowListWindow (firstChar, provider,  completionWidget, completionContext, closedDelegate)) {
					provider.Dispose ();
					return;
				}
				
				// makes control-space in midle of words to work
				string text = wnd.completionWidget.GetCompletionText (completionContext);
				if (text.Length == 0) {
					text = provider.DefaultCompletionString;
					if (text != null && text.Length > 0)
						wnd.SelectEntry (text);
					return;
				}
				
				wnd.PartialWord = text; 
				//if there is only one matching result we take it by default
				if (wnd.IsUniqueMatch && !wnd.IsChanging)
				{	
					wnd.UpdateWord ();
					wnd.Hide ();
				}
				
			} catch (Exception ex) {
				Console.WriteLine (ex);
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:29,代码来源:XmlCompletionListWindow.cs

示例8: GetCurrentParameterIndex

		// Returns the index of the parameter where the cursor is currently positioned.
		// -1 means the cursor is outside the method parameter list
		// 0 means no parameter entered
		// > 0 is the index of the parameter (1-based)
		public int GetCurrentParameterIndex (ICompletionWidget widget, CodeCompletionContext ctx)
		{
			int cursor = widget.CurrentCodeCompletionContext.TriggerOffset;
			int i = ctx.TriggerOffset;
			if (i < 0 || i >= editor.Length || editor.GetCharAt (i) == ')')
				return -1;
			
			if (i > cursor)
				return -1;
			else if (i == cursor)
				return 0;
			
			int parameterIndex = 1;
			
			while (i++ < cursor) {
				if (i >= widget.TextLength)
					break;
				char ch = widget.GetChar (i);
				if (ch == ',')
					parameterIndex++;
				else if (ch == ')')
					return -1;
			}
			
			return parameterIndex;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:30,代码来源:DataProvider.cs

示例9: GetCurrentParameterIndex

        public int GetCurrentParameterIndex(ICompletionWidget widget, CodeCompletionContext ctx)
        {
            if (showCompletion)
            {
                return 0;
            }

            return -1;
        }
开发者ID:tjhei,项目名称:md-haxebinding,代码行数:9,代码来源:HaxeParameterDataProvider.cs

示例10: GenerateCompletionData

        public ICompletionData[] GenerateCompletionData(ICompletionWidget widget, char charTyped)
        {
            CodeTemplateGroup templateGroup = CodeTemplateLoader.GetTemplateGroupPerFilename (fileName);
            if (templateGroup == null) {
                return null;
            }
            ArrayList completionData = new ArrayList();
            foreach (CodeTemplate template in templateGroup.Templates) {
                completionData.Add(new TemplateCompletionData(template));
            }

            return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:13,代码来源:TemplateCompletionDataProvider.cs

示例11: OverloadDown

		internal static bool OverloadDown (CompletionTextEditorExtension ext, ICompletionWidget widget)
		{
			if (currentMethodGroup == null)
				return false;
			if (currentMethodGroup.MethodProvider.Count <= 1)
				return false;
			if (currentMethodGroup.CurrentOverload < currentMethodGroup.MethodProvider.Count - 1)
				currentMethodGroup.CurrentOverload ++;
			else
				currentMethodGroup.CurrentOverload = 0;
			window.ChangeOverload ();
			UpdateWindow (ext, widget);
			return true;
		}
开发者ID:swarkcn,项目名称:monodevelop,代码行数:14,代码来源:ParameterInformationWindowManager.cs

示例12: ShowCompletion

		public void ShowCompletion (ICompletionDataList completionList)
		{
			completionWidget = Document.GetContent <ICompletionWidget> ();
			currentCompletionContext = completionWidget.CreateCodeCompletionContext (Document.TextEditorData.Caret.Offset);
			int cpos, wlen;
			if (!GetCompletionCommandOffset (out cpos, out wlen)) {
				cpos = Document.TextEditorData.Caret.Offset;
				wlen = 0;
			}
			currentCompletionContext.TriggerOffset = cpos;
			currentCompletionContext.TriggerWordLength = wlen;
			
			CompletionWindowManager.ShowWindow ('\0', completionList, completionWidget, currentCompletionContext, OnCompletionWindowClosed);
		}
开发者ID:natosha,项目名称:monodevelop,代码行数:14,代码来源:CompletionTextEditorExtension.cs

示例13: OverloadDown

		internal static bool OverloadDown (CompletionTextEditorExtension ext, ICompletionWidget widget)
		{
			if (methods.Count == 0)
				return false;
			MethodData cmd = methods [methods.Count - 1];
			if (cmd.MethodProvider.Count <= 1)
				return false;
			if (cmd.CurrentOverload < cmd.MethodProvider.Count - 1)
				cmd.CurrentOverload ++;
			else
				cmd.CurrentOverload = 0;
			window.ChangeOverload ();
			UpdateWindow (ext, widget);
			return true;
		}
开发者ID:vvarshne,项目名称:monodevelop,代码行数:15,代码来源:ParameterInformationWindowManager.cs

示例14: ProcessKeyEvent

		// Called when a key is pressed in the editor.
		// Returns false if the key press has to continue normal processing.
		internal static bool ProcessKeyEvent (CompletionTextEditorExtension ext, ICompletionWidget widget, KeyDescriptor descriptor)
		{
			if (currentMethodGroup == null)
				return false;

			if (descriptor.SpecialKey == SpecialKey.Down) {
				return OverloadDown (ext, widget);
			} else if (descriptor.SpecialKey == SpecialKey.Up) {
				return OverloadUp (ext, widget);
			}
			else if (descriptor.SpecialKey == SpecialKey.Escape) {
				HideWindow (ext, widget);
				return true;
			}
			return false;
		}
开发者ID:swarkcn,项目名称:monodevelop,代码行数:18,代码来源:ParameterInformationWindowManager.cs

示例15: GenerateCompletionData

        /*		int caretLineNumber;
        int caretColumn;

        string[][] commentTags = new string[][] {
            new string[] {"c", "marks text as code"},
            new string[] {"code", "marks text as code"},
            new string[] {"example", "A description of the code example\n(must have a <code> tag inside)"},
            new string[] {"exception cref=\"\"", "description to an exception thrown"},
            new string[] {"list type=\"\"", "A list"},
            new string[] {"listheader", "The header from the list"},
            new string[] {"item", "A list item"},
            new string[] {"term", "A term in a list"},
            new string[] {"description", "A description to a term in a list"},
            new string[] {"param name=\"\"", "A description for a parameter"},
            new string[] {"paramref name=\"\"", "A reference to a parameter"},
            new string[] {"permission cref=\"\"", ""},
            new string[] {"remarks", "Gives description for a member"},
            new string[] {"include file=\"\" path=\"\"", "Includes comments from other files"},
            new string[] {"returns", "Gives description for a return value"},
            new string[] {"see cref=\"\"", "A reference to a member"},
            new string[] {"seealso cref=\"\"", "A reference to a member in the seealso section"},
            new string[] {"summary", "A summary of the object"},
            new string[] {"value", "A description of a property"}
        };
        */
        public ICompletionData[] GenerateCompletionData(ICompletionWidget widget, char charTyped)
        {
            /*caretLineNumber = textArea.Caret.Line;
            caretColumn     = textArea.Caret.Column;
            LineSegment caretLine = textArea.Document.GetLineSegment(caretLineNumber);
            string lineText = textArea.Document.GetText(caretLine.Offset, caretLine.Length);
            if (!lineText.Trim().StartsWith("///")) {
                return null;
            }
            */
            ArrayList completionData = new ArrayList ();
            /*foreach (string[] tag in commentTags) {
                completionData.Add(new CommentCompletionData(tag[0], tag[1]));
            }*/
            return (ICompletionData[])completionData.ToArray (typeof (ICompletionData));
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:41,代码来源:CommentCompletionDataProvider.cs


注:本文中的ICompletionWidget类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。