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


C# Editing.TextArea类代码示例

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


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


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