當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。