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


C# Gui.TextEditor类代码示例

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


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

示例1: FormatLine

		/// <summary>
		/// This function formats a specific line after <code>ch</code> is pressed.
		/// </summary>
		/// <returns>
		/// the caret delta position the caret will be moved this number
		/// of bytes (e.g. the number of bytes inserted before the caret, or
		/// removed, if this number is negative)
		/// </returns>
		public virtual int FormatLine (TextEditor d, int line, int cursorOffset, char ch, string indentString, bool autoInsertCurlyBracket)
		{
			if (ch == '\n')
				return IndentLine (d, line, indentString);
			
			return 0;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:15,代码来源:DefaultFormattingStrategy.cs

示例2: ProjectedDocumentContext

		public ProjectedDocumentContext (TextEditor projectedEditor, DocumentContext originalContext)
		{
			if (projectedEditor == null)
				throw new ArgumentNullException ("projectedEditor");
			if (originalContext == null)
				throw new ArgumentNullException ("originalContext");
			this.projectedEditor = projectedEditor;
			this.originalContext = originalContext;

			if (originalContext.Project != null) {
				var originalProjectId = TypeSystemService.GetProjectId (originalContext.Project);
				if (originalProjectId != null) {
					var originalProject = TypeSystemService.Workspace.CurrentSolution.GetProject (originalProjectId);
					if (originalProject != null) {
						projectedDocument = originalProject.AddDocument (
							projectedEditor.FileName,
							projectedEditor
						);
					}
				}
			}

			projectedEditor.TextChanged += delegate(object sender, TextChangeEventArgs e) {
				if (projectedDocument != null)
					projectedDocument = projectedDocument.WithText (projectedEditor);
				ReparseDocument ();
			};

			ReparseDocument ();
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:30,代码来源:ProjectedDocumentContext.cs

示例3: Rollback

		static void Rollback (TextEditor editor, List<MonoDevelop.Core.Text.TextChangeEventArgs> textChanges)
		{
			for (int i = textChanges.Count - 1; i >= 0; i--) {
				var v = textChanges [i];
				editor.ReplaceText (v.Offset, v.InsertionLength, v.RemovedText);
			}
		}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:7,代码来源:RenameRefactoring.cs

示例4: NRefactoryIndexerParameterDataProvider

		public NRefactoryIndexerParameterDataProvider (MonoDevelop.Ide.Gui.TextEditor editor, IType type, string resolvedExpression)
		{
			this.editor = editor;
//			this.type = type;
			this.resolvedExpression = resolvedExpression;
			indexers = new List<IProperty> (type.Properties.Where (p => p.IsIndexer && !p.Name.Contains ('.')));
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:NRefactoryIndexerParameterDataProvider.cs

示例5: TextFileNavigationPoint

		public TextFileNavigationPoint (Document doc, TextEditor buffer)
			: base (doc)
		{
			var location = buffer.CaretLocation;
			line = location.Line;
			column = location.Column;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:TextFileNavigationPoint.cs

示例6: Initialize

        public override void Initialize(IPadWindow window)
        {
            base.Initialize(window);

            // Call ctors
            inputEditor = new TextEditor() { Name = "input", Events = Gdk.EventMask.AllEventsMask, HeightRequest = 80 };
            editor = new TextEditor() { Name = "output", Events = Gdk.EventMask.AllEventsMask };
            vpaned = new Gtk.VPaned();
            var scr1 = new Gtk.ScrolledWindow();
            var scr2 = new Gtk.ScrolledWindow();

            // Init layout
            scr1.ShadowType = Gtk.ShadowType.In;
            scr1.Child = inputEditor;
            vpaned.Add1(scr1);
            scr1.ShowAll();
            inputEditor.ShowAll();

            scr2.ShadowType = Gtk.ShadowType.In;
            scr2.Child = editor;
            vpaned.Add2(scr2);
            scr2.ShowAll();
            editor.ShowAll();

            vpaned.ShowAll();

            // Init editors
            var o = editor.Options;
            inputEditor.Options = o;
            o.ShowLineNumberMargin = false;
            o.ShowFoldMargin = false;
            o.ShowIconMargin = false;

            editor.Document.ReadOnly = true;
            inputEditor.Text = PropertyService.Get(lastInputStringPropId, string.Empty);
            editor.Text = string.Empty;
            editor.Document.SyntaxMode = new Highlighting.DSyntaxMode();
            inputEditor.Document.SyntaxMode = new Highlighting.DSyntaxMode();
            editor.Document.MimeType = Formatting.DCodeFormatter.MimeType;
            inputEditor.Document.MimeType = Formatting.DCodeFormatter.MimeType;

            // Init toolbar
            var tb = window.GetToolbar(Gtk.PositionType.Top);

            executeButton = new Gtk.Button();
            executeButton.Image = new Gtk.Image(Gtk.Stock.Execute, Gtk.IconSize.Menu);
            executeButton.TooltipText = "Evaluates the expression typed in the upper input editor.";
            executeButton.Clicked += Execute;
            tb.Add(executeButton);

            abortButton = new Gtk.Button();
            abortButton.Sensitive = false;
            abortButton.Image = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu);
            abortButton.TooltipText = "Stops the evaluation.";
            abortButton.Clicked += (object sender, EventArgs e) => AbortExecution();
            tb.Add(abortButton);

            tb.ShowAll();
        }
开发者ID:simendsjo,项目名称:Mono-D,代码行数:59,代码来源:ExpressionEvaluationWidget.cs

示例7: Run

		internal void Run (TextEditor editor, DocumentContext ctx)
		{
			var info = RefactoringSymbolInfo.GetSymbolInfoAsync (ctx, editor.CaretOffset).Result;
			var sym = info.DeclaredSymbol ?? info.Symbol;
			if (!CanRename (sym))
				return;
			new RenameRefactoring ().Rename (sym);
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:8,代码来源:RenameHandler.cs

示例8: GetItem

		public override async Task<TooltipItem> GetItem (TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default(CancellationToken))
		{
			if (offset >= editor.Length)
				return null;

			if (!DebuggingService.IsDebugging || DebuggingService.IsRunning)
				return null;

			StackFrame frame = DebuggingService.CurrentFrame;
			if (frame == null)
				return null;

			var ed = CompileErrorTooltipProvider.GetExtensibleTextEditor (editor);
			if (ed == null)
				return null;
			string expression = null;
			int startOffset;

			if (ed.IsSomethingSelected && offset >= ed.SelectionRange.Offset && offset <= ed.SelectionRange.EndOffset) {
				startOffset = ed.SelectionRange.Offset;
				expression = ed.SelectedText;
			} else {
				var doc = ctx;
				if (doc == null || doc.ParsedDocument == null)
					return null;

				var resolver = doc.GetContent<IDebuggerExpressionResolver> ();
				var data = doc.GetContent<SourceEditorView> ();

				if (resolver != null) {
					var result = await resolver.ResolveExpressionAsync (editor, doc, offset, token);
					expression = result.Text;
					startOffset = result.Span.Start;
				} else {
					int endOffset = data.GetTextEditorData ().FindCurrentWordEnd (offset);
					startOffset = data.GetTextEditorData ().FindCurrentWordStart (offset);

					expression = editor.GetTextAt (startOffset, endOffset - startOffset);
				}
			}
			
			if (string.IsNullOrEmpty (expression))
				return null;

			var options = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
			options.AllowMethodEvaluation = true;
			options.AllowTargetInvoke = true;

			var val = frame.GetExpressionValue (expression, options);

			if (val == null || val.IsUnknown || val.IsNotSupported)
				return null;
			
			val.Name = expression;
			
			return new TooltipItem (val, startOffset, expression.Length);
		}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:57,代码来源:DebugValueTooltipProvider.cs

示例9: ParameterDataProvider

		public ParameterDataProvider (Document document, ProjectInformation info, string functionName)
		{
			this.editor = document.TextEditor;
			this.functionName = functionName;
			this.info = info;

			functions = new List<Symbol> ();
			Symbol function = info.GetFunction (functionName, document.FileName, editor.CursorLine, editor.CursorColumn);
			if (null != function){ functions.Add (function); }
		}// member function constructor
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:10,代码来源:DataProvider.cs

示例10: CreateProjectedEditor

		public TextEditor CreateProjectedEditor (DocumentContext originalContext)
		{
			if (projectedEditor == null) {
				projectedEditor = TextEditorFactory.CreateNewEditor (Document, TextEditorType.Projection);
				projectedDocumentContext = new ProjectedDocumentContext (projectedEditor, originalContext);
				projectedEditor.InitializeExtensionChain (projectedDocumentContext);
				projectedProjections.InstallListener (projectedEditor);
			}
			return projectedEditor;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:10,代码来源:Projection.cs

示例11: Run

		internal async Task Run (TextEditor editor, DocumentContext ctx)
		{
			var cts = new CancellationTokenSource ();
			var getSymbolTask = RefactoringSymbolInfo.GetSymbolInfoAsync (ctx, editor, cts.Token);
			var message = GettextCatalog.GetString ("Resolving symbol…");
			var info = await MessageService.ExecuteTaskAndShowWaitDialog (getSymbolTask, message, cts);
			var sym = info.DeclaredSymbol ?? info.Symbol;
			if (!CanRename (sym))
				return;
			await new RenameRefactoring ().Rename (sym);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:11,代码来源:RenameHandler.cs

示例12: AutoIndentLine

		/// <summary>
		/// Could be overwritten to define more complex indenting.
		/// </summary>
		protected virtual int AutoIndentLine (TextEditor d, int lineNumber, string indentString)
		{
			string indentation = lineNumber != 0 ? GetIndentation (d, lineNumber - 1) : "";
			
			if (indentation.Length > 0) {
				string newLineText = indentation + d.GetLineText (lineNumber).Trim ();
				d.ReplaceLine (lineNumber, newLineText);
			}
			
			return indentation.Length;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:14,代码来源:DefaultFormattingStrategy.cs

示例13: NRefactoryTemplateParameterDataProvider

 public NRefactoryTemplateParameterDataProvider(MonoDevelop.Ide.Gui.TextEditor editor, NRefactoryResolver resolver, IEnumerable<string> namespaces, string typeName)
 {
     this.editor = editor;
     foreach (string ns in namespaces) {
         string prefix = ns + (ns.Length > 0 ? "." : "") + typeName + "`";
         for (int i = 1; i < 99; i++) {
             IType possibleType = resolver.Dom.GetType (prefix + i);
             if (possibleType != null)
                 types.Add (possibleType);
         }
     }
 }
开发者ID:vasili,项目名称:FSharpBinding,代码行数:12,代码来源:NRefactoryTemplateParameterDataProvider.cs

示例14: TextEditorViewContent

		public TextEditorViewContent (TextEditor textEditor, ITextEditorImpl textEditorImpl)
		{
			if (textEditor == null)
				throw new ArgumentNullException (nameof (textEditor));
			if (textEditorImpl == null)
				throw new ArgumentNullException (nameof (textEditorImpl));
			this.textEditor = textEditor;
			this.textEditorImpl = textEditorImpl;
			this.textEditor.MimeTypeChanged += UpdateTextEditorOptions;
			DefaultSourceEditorOptions.Instance.Changed += UpdateTextEditorOptions;
			this.textEditor.DocumentContextChanged += HandleDocumentContextChanged;
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:12,代码来源:TextEditorViewContent.cs

示例15: Initialize

		protected internal void Initialize (TextEditor editor, DocumentContext context)
		{
			if (editor == null)
				throw new ArgumentNullException ("editor");
			if (context == null)
				throw new ArgumentNullException ("context");
			if (DocumentContext != null)
				throw new InvalidOperationException ("Extension is already initialized.");
			DocumentContext = context;
			Editor = editor;
			Initialize ();
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:12,代码来源:TextEditorExtension.cs


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