• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Editing.TextArea类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GenerateCompletionData

    public CompletionData[] GenerateCompletionData(string fileName, TextArea textArea)
    {
      string name = WordUtilities.FindPreviousWord(textArea);

      if (name == null)
        return EmptySuggestion(textArea.Caret);

      if (name == "specification" || name == "requires" || name == "same_machine_as" || name == "@")
      {
        return ModulesSuggestions();
      }

      if (name == "users_per_machine")
      {
        return NumbersSuggestions(50,100,150,200);
      }
      else if (name == "min_memory")
      {
          return NumbersSuggestions(1024,2048,4096,8*1024);
      }
      else if (name == "min_cpu_count")
      {
          return NumbersSuggestions(1, 2, 4, 8, 16);
      }

      return EmptySuggestion(textArea.Caret);
    }
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:27,代码来源:CompletionManager.cs


示例2: ReplaceSelectionWithText

		/// <inheritdoc/>
		public override void ReplaceSelectionWithText(TextArea textArea, string newText)
		{
			if (textArea == null)
				throw new ArgumentNullException("textArea");
			if (newText == null)
				throw new ArgumentNullException("newText");
			using (textArea.Document.RunUpdate()) {
				if (IsEmpty) {
					if (newText.Length > 0) {
						if (textArea.ReadOnlySectionProvider.CanInsert(textArea.Caret.Offset)) {
							textArea.Document.Insert(textArea.Caret.Offset, newText);
						}
					}
				} else {
					ISegment[] segmentsToDelete = textArea.GetDeletableSegments(this);
					for (int i = segmentsToDelete.Length - 1; i >= 0; i--) {
						if (i == segmentsToDelete.Length - 1) {
							textArea.Caret.Offset = segmentsToDelete[i].EndOffset;
							textArea.Document.Replace(segmentsToDelete[i], newText);
						} else {
							textArea.Document.Remove(segmentsToDelete[i]);
						}
					}
					if (segmentsToDelete.Length != 0) {
						textArea.Selection = Selection.Empty;
					}
				}
			}
		}
开发者ID:pusp,项目名称:o2platform,代码行数:30,代码来源:SimpleSelection.cs


示例3: Create

		/// <summary>
		/// Creates a new <see cref="TextAreaInputHandler"/> for the text area.
		/// </summary>
		public static TextAreaInputHandler Create(TextArea textArea)
		{
			TextAreaInputHandler handler = new TextAreaInputHandler(textArea);
			handler.CommandBindings.AddRange(CommandBindings);
			handler.InputBindings.AddRange(InputBindings);
			return handler;
		}
开发者ID:pusp,项目名称:o2platform,代码行数:10,代码来源:EditingCommandHandler.cs


示例4: Insert

        /// <summary>
        /// Inserts the snippet into the text area.
        /// </summary>
        public void Insert(TextArea textArea)
        {
            if (textArea == null)
                throw new ArgumentNullException("textArea");

            ISegment selection = textArea.Selection.SurroundingSegment;
            int insertionPosition = textArea.Caret.Offset;

            if (selection != null) // if something is selected
                // use selection start instead of caret position,
                // because caret could be at end of selection or anywhere inside.
                // Removal of the selected text causes the caret position to be invalid.
                insertionPosition = selection.Offset + TextUtilities.GetWhitespaceAfter(textArea.Document, selection.Offset).Length;

            InsertionContext context = new InsertionContext(textArea, insertionPosition);

            using (context.Document.RunUpdate()) {
                if (selection != null)
                    textArea.Document.Remove(insertionPosition, selection.EndOffset - insertionPosition);
                Insert(context);

                // [DIGITALRUNE] Format inserted lines.
                int beginLine = textArea.Document.GetLineByOffset(context.StartPosition).LineNumber;
                int endLine = textArea.Document.GetLineByOffset(context.InsertionPosition).LineNumber;
                textArea.IndentationStrategy?.IndentLines(textArea, beginLine, endLine);

                context.RaiseInsertionCompleted(EventArgs.Empty);
            }
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:32,代码来源:Snippet.cs


示例5: SetUpFixture

		public void SetUpFixture()
		{
			string python = "class Test:\r\n" +
							"\tdef foo(self):\r\n" +
							"\t\tpass";
			
			DefaultProjectContent projectContent = new DefaultProjectContent();
			PythonParser parser = new PythonParser();
			compilationUnit = parser.Parse(projectContent, @"C:\test.py", python);			
			if (compilationUnit.Classes.Count > 0) {
				c = compilationUnit.Classes[0];
				if (c.Methods.Count > 0) {
					method = c.Methods[0];
				}
				
				TextArea textArea = new TextArea();
				document = new TextDocument();
				textArea.Document = document;
				textArea.Document.Text = python;
				
				ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea);
				
				ParseInformation parseInfo = new ParseInformation(compilationUnit);
				foldingStrategy.UpdateFoldings(parseInfo);
				List<FoldingSection> folds = new List<FoldingSection>(foldingStrategy.FoldingManager.AllFoldings);
				
				if (folds.Count > 0) {
					classFold = folds[0];
				}
				if (folds.Count > 1) {
					methodFold = folds[1];
				}
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:34,代码来源:ParseClassWithMethodTestFixture.cs


示例6: SearchInputHandler

		/// <summary>
		/// Creates a new SearchInputHandler and registers the search-related commands.
		/// </summary>
		public SearchInputHandler(TextArea textArea)
			: base(textArea)
		{
			this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, ExecuteFind));
			this.CommandBindings.Add(new CommandBinding(SearchCommands.FindNext, ExecuteFindNext));
			this.CommandBindings.Add(new CommandBinding(SearchCommands.FindPrevious, ExecuteFindPrevious));
		}
开发者ID:eusebiu,项目名称:SharpDevelop,代码行数:10,代码来源:SearchCommands.cs


示例7: SearchInputHandler

 /// <summary>
 /// Creates a new SearchInputHandler and registers the search-related commands.
 /// </summary>
 public SearchInputHandler(TextArea textArea)
     : base(textArea)
 {
     RegisterCommands(this.CommandBindings);
     panel = new SearchPanel();
     panel.Attach(TextArea);
 }
开发者ID:piaolingzxh,项目名称:Justin,代码行数:10,代码来源:SearchCommands.cs


示例8: Complete

 public virtual void Complete(TextArea textArea, ISegment completionSegment,
     EventArgs insertionRequestEventArgs)
 {
   textArea.Document.Replace(completionSegment, Action == null ? this.Text : Action.Invoke());
   if (CaretOffset != 0)
     textArea.Caret.Offset += CaretOffset;
 }
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:7,代码来源:BasicCompletionData.cs


示例9: TextMarkerService

		public TextMarkerService(TextArea area)
		{
			this.area = area;
			markers = new TextSegmentCollection<TextMarker>(area.Document);
			this.area.TextView.BackgroundRenderers.Add(this);
			this.area.TextView.LineTransformers.Add(this);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:TextMarkerService.cs


示例10: Complete

 public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs)
 {
     if (m_jsonEditorViewModel.IsBetweenQoats)
       {
     int offset = m_jsonEditorViewModel.Caret.Offset;
     List<char> startChars = new List<char> {m_autoCompleteValue.SchemaObject.AutoCompletePathSeperator, '"'};
     if (m_autoCompleteValue.SchemaObject.Prefix.Length > 0)
       startChars.Add(m_autoCompleteValue.SchemaObject.Prefix.Last());
     int indexQuotStart = m_jsonEditorViewModel.TextDocument.Text.LastIndexOfAny(startChars.ToArray(), offset - 1, offset - 1) + 1;
     int indexQuatEnd = m_jsonEditorViewModel.TextDocument.Text.IndexOf('"', offset);
     int indexLineBreak = m_jsonEditorViewModel.TextDocument.Text.IndexOf('\n', offset);
     if (indexQuatEnd >= indexQuotStart && indexQuatEnd < indexLineBreak)
       completionSegment = new SelectionSegment(indexQuotStart, indexQuatEnd);
       }
       int endOffset = completionSegment.Offset + Text.Length;
       textArea.Document.Replace(completionSegment, (Text + m_autoCompleteValue.SchemaObject.Suffix).Replace("\\", "\\\\"));
       m_jsonEditorViewModel.Caret.Offset = endOffset;
       string value = m_autoCompleteValue.SchemaObject.RemovePrefixAndSuffix(m_jsonEditorViewModel.GetCurrentValue());
       if (Text.StartsWith(".." + m_autoCompleteValue.SchemaObject.AutoCompletePathSeperator) && value.Any(char.IsLetterOrDigit))
       {
     value = value.Substring(0, value.Length - 4);
     int startIndex = value.LastIndexOf(m_autoCompleteValue.SchemaObject.AutoCompletePathSeperator);
     if (startIndex == -1)
       startIndex = m_autoCompleteValue.SchemaObject.Prefix.Length;
     else
     {
       startIndex++;
     }
     m_jsonEditorViewModel.TextDocument.Replace(
       m_jsonEditorViewModel.Caret.Offset - 4 - (value.Length - startIndex), (value.Length - startIndex) + 4, "");
       }
       m_jsonEditorViewModel.UpdateAutoCompletList = true;
 }
开发者ID:grarup,项目名称:SharpE,代码行数:33,代码来源:FileCompletionDataViewModel.cs


示例11: SetUpFixture

		public void SetUpFixture()
		{
			string ruby = "class Test\r\n" +
							"\tdef initialize\r\n" +
							"\t\tputs 'test'\r\n" +
							"\tend\r\n" +
							"end";
			
			DefaultProjectContent projectContent = new DefaultProjectContent();
			RubyParser parser = new RubyParser();
			compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby);			
			if (compilationUnit.Classes.Count > 0) {
				c = compilationUnit.Classes[0];
				if (c.Methods.Count > 0) {
					method = c.Methods[0];
				}
				
				TextArea textArea = new TextArea();
				document = new TextDocument();
				textArea.Document = document;
				textArea.Document.Text = ruby;
				
				// Get folds.
				ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea);
				
				ParseInformation parseInfo = new ParseInformation(compilationUnit);
				foldingStrategy.UpdateFoldings(parseInfo);
				List<FoldingSection> folds = new List<FoldingSection>(foldingStrategy.FoldingManager.AllFoldings);
			
				if (folds.Count > 1) {
					classFold = folds[0];
					methodFold = folds[1];
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:35,代码来源:ParseClassWithCtorTestFixture.cs


示例12: Execute

        public void Execute(object arg)
        {
            ta = arg as TextArea;
                        int begin, end, caret;
                        if ( ta!=null){
                                if (CanExecute()){
                                        ViSDGlobalCount.UpdLastUsed( cmdf, ta );

                                        caret = ta.Caret.Offset;
                                        while( IsLetter( caret-1 )) caret--;
                                        begin = caret;
                                        while( IsLetter(caret+1)) caret++;
                                        end = caret;
                                        int lenght =  end - begin + 1;
                                        ViSDGlobalWordSearch.SearchedWord=ta.Document.GetText( begin, lenght);
                                        if ( begin>0)
                                                ta.Caret.Offset = begin-1;
                                        else
                                                ta.Caret.Offset = ta.Document.TextLength-1;
                                        cmdf.Execute(ta);
                                }else{
                                        ViSDGlobalCount.ResetAll();
                                }
                        }
        }
开发者ID:voland,项目名称:ViSD,代码行数:25,代码来源:CmdPrevIdent.cs


示例13: SharpDevelopCompletionWindow

		public SharpDevelopCompletionWindow(ITextEditor editor, TextArea textArea, ICompletionItemList itemList) : base(textArea)
		{
			if (editor == null)
				throw new ArgumentNullException("editor");
			if (itemList == null)
				throw new ArgumentNullException("itemList");
			
			if (!itemList.ContainsAllAvailableItems) {
				// If more items are available (Ctrl+Space wasn't pressed), show this hint
				this.EmptyText = StringParser.Parse("${res:ICSharpCode.AvalonEdit.AddIn.SharpDevelopCompletionWindow.EmptyText}");
			}
			
			InitializeComponent();
			this.Editor = editor;
			this.itemList = itemList;
			ICompletionItem suggestedItem = itemList.SuggestedItem;
			foreach (ICompletionItem item in itemList.Items) {
				ICompletionData adapter = new CodeCompletionDataAdapter(this, item);
				this.CompletionList.CompletionData.Add(adapter);
				if (item == suggestedItem)
					this.CompletionList.SelectedItem = adapter;
			}
			this.StartOffset -= itemList.PreselectionLength;
			this.EndOffset += itemList.PostselectionLength;
		}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:25,代码来源:SharpDevelopCompletionWindow.cs


示例14: Execute

 public void Execute(object arg)
 {
     ViSDGlobalCount.ResetAll();
                 ta = arg as TextArea;
                 int begin=-1;
                 int end=-1;
                 if ( ta!=null ){
                         double TopLine = ta.TextView.ScrollOffset.Y;
                         foreach( VisualLine vl in ta.TextView.VisualLines){
                                 if ( begin == -1 ){
                                         if ( vl.VisualTop>=TopLine) {
                                                 begin = vl.FirstDocumentLine.LineNumber;
                                         }
                                 } else{
                                         if (((vl.VisualTop +2*vl.Height)>=(TopLine+ta.TextView.ActualHeight))||
                                             ((vl.VisualTop +1*vl.Height)>=(ta.TextView.DocumentHeight))) {
                                                 end = vl.LastDocumentLine.LineNumber;
                                                 break;
                                         }
                                 }
                         }
                         if ( (begin >=0)&&( end >=0)){
                                 ta.Caret.Line = begin + (end - begin)/2;
                                 return;
                         }
                 }
 }
开发者ID:voland,项目名称:ViSD,代码行数:27,代码来源:CmdScreenMid.cs


示例15: PythonConsoleCompletionWindow

        /// <summary>
        /// Creates a new code completion window.
        /// </summary>
        public PythonConsoleCompletionWindow(TextArea textArea, PythonTextEditor textEditor)
            : base(textArea)
        {
            // keep height automatic
            this.completionDataProvider = textEditor.CompletionProvider;
            this.textEditor = textEditor;
            this.CloseAutomatically = true;
            this.SizeToContent = SizeToContent.Height;
            this.MaxHeight = 300;
            this.Width = 175;
            this.Content = completionList;
            // prevent user from resizing window to 0x0
            this.MinHeight = 15;
            this.MinWidth = 30;

            toolTip.PlacementTarget = this;
            toolTip.Placement = PlacementMode.Right;
            toolTip.Closed += toolTip_Closed;

            completionList.InsertionRequested += completionList_InsertionRequested;
            completionList.SelectionChanged += completionList_SelectionChanged;
            AttachEvents();

            updateDescription = new DispatcherTimer();
            updateDescription.Tick += new EventHandler(completionList_UpdateDescription);
            updateDescriptionInterval = TimeSpan.FromSeconds(0.3);

            EventInfo eventInfo = typeof(TextView).GetEvent("ScrollOffsetChanged");
            Delegate methodDelegate = Delegate.CreateDelegate(eventInfo.EventHandlerType, (this as CompletionWindowBase), "TextViewScrollOffsetChanged");
            eventInfo.RemoveEventHandler(this.TextArea.TextView, methodDelegate);
        }
开发者ID:iS3-Project,项目名称:iS3,代码行数:34,代码来源:PythonConsoleCompletionWindow.cs


示例16: CodeCompletionWindow

        public CodeCompletionWindow(ITextEditor editor, TextArea textArea, ICompletionItemList itemList)
            : base(textArea)
        {
            if (editor == null)
                throw new ArgumentNullException("editor");
            if (itemList == null)
                throw new ArgumentNullException("itemList");

            if (!itemList.ContainsAllAvailableItems) {
                // If more items are available (Ctrl+Space wasn't pressed), show this hint
                this.EmptyText = "Press Ctrl+Space to show items from all namespaces";
            }

            //InitializeComponent();
            this.Editor = editor;
            this.itemList = itemList;
            ICompletionItem suggestedItem = itemList.SuggestedItem;
            foreach (ICompletionItem item in itemList.Items) {
                ICompletionData adapter = new CodeCompletionDataAdapter(this, item);
                this.CompletionList.CompletionData.Add(adapter);
                if (item == suggestedItem)
                    this.CompletionList.SelectedItem = adapter;
            }
            this.StartOffset -= itemList.PreselectionLength;
        }
开发者ID:RazorPad,项目名称:RazorPad,代码行数:25,代码来源:CodeCompletionWindow.cs


示例17: IncrementalSearch

 public IncrementalSearch(TextArea textArea, LogicalDirection direction)
 {
     if (textArea == null)
                         throw new ArgumentNullException("textArea");
                 this.textArea = textArea;
                 this.direction = direction;
 }
开发者ID:voland,项目名称:ViSD,代码行数:7,代码来源:HandIncrementalSearch.cs


示例18: Complete

 public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs)
 {
     var instance = ServiceLocator.Current.GetInstance<MainViewModel>();
     var text = instance.ActiveEditor.TextBox.FindWord();
     var offset = completionSegment.Offset - text.Length;
     textArea.Document.Replace(offset, text.Length, Text);
 }
开发者ID:mookiejones,项目名称:miEditor,代码行数:7,代码来源:CodeCompletion.cs


示例19: GetIndentationString

        // [DIGITALRUNE]
        /// <summary>
        /// Gets the text used for indentation.
        /// </summary>
        /// <param name="textArea">The active <see cref="TextArea"/>.</param>
        /// <returns>The text used for indentation.</returns>
        public static string GetIndentationString(TextArea textArea)
        {
            if (textArea == null)
                throw new ArgumentNullException("textArea");

            var options = textArea.Options;
            return (options != null) ? options.IndentationString : "\t";
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:14,代码来源:DefaultIndentationStrategy.cs


示例20: SimpleSelection

		/// <summary>
		/// Creates a new SimpleSelection instance.
		/// </summary>
		internal SimpleSelection(TextArea textArea, TextViewPosition start, TextViewPosition end)
			: base(textArea)
		{
			this.start = start;
			this.end = end;
			this.startOffset = textArea.Document.GetOffset(start.Location);
			this.endOffset = textArea.Document.GetOffset(end.Location);
		}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:11,代码来源:SimpleSelection.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Folding.FoldingManager类代码示例发布时间:2022-05-26
下一篇:
C# Document.TextDocument类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap