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


C# ITextDocument类代码示例

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


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

示例1: PreviewWindowUpdateListener

        public PreviewWindowUpdateListener(IWpfTextView wpfTextView, MarkdownPackage package, ITextDocument document)
        {
            this.textView = wpfTextView;
            this.package = package;
            this.document = document;

            EventHandler updateHandler =
                (sender, args) => UDNDocRunningTableMonitor.CurrentUDNDocView.ParsingResultsCache.AsyncForceReparse();

            BufferIdleEventUtil.AddBufferIdleEventListener(wpfTextView.TextBuffer, updateHandler);

            document.FileActionOccurred +=
                (sender, args) => UDNDocRunningTableMonitor.CurrentUDNDocView.ParsingResultsCache.AsyncForceReparse();

            textView.Closed += (sender, args) =>
                {
                    ClearPreviewWindow();
                    BufferIdleEventUtil.RemoveBufferIdleEventListener(wpfTextView.TextBuffer, updateHandler);
                };

            //On updating the publish flags re-run the preview
            package.PublishFlags.CollectionChanged +=
                (sender, args) => UDNDocRunningTableMonitor.CurrentUDNDocView.ParsingResultsCache.AsyncForceReparse();

            DoxygenHelper.TrackedFilesChanged +=
                () => UDNDocRunningTableMonitor.CurrentUDNDocView.ParsingResultsCache.AsyncForceReparse();

            Templates.TemplatesChanged += () => UpdatePreviewWindow(UDNDocRunningTableMonitor.CurrentUDNDocView.ParsingResultsCache.Results);
            UDNDocRunningTableMonitor.CurrentOutputIsChanged += UpdatePreviewWindow;
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:30,代码来源:PreviewWindowUpdateListener.cs

示例2: RoslynCodeAnalysisHelper

        public RoslynCodeAnalysisHelper(IWpfTextView view, ITextDocument document, IVsTaskList tasks, DTE2 dte, SVsServiceProvider serviceProvider, IVsActivityLog log)
        {
            _view = view;
            _document = document;
            _text = new Adornment();
            _tasks = tasks;
            _serviceProvider = serviceProvider;
            _log = log;
            _dispatcher = Dispatcher.CurrentDispatcher;

            _adornmentLayer = view.GetAdornmentLayer(RoslynCodeAnalysisFactory.LayerName);

            _view.ViewportHeightChanged += SetAdornmentLocation;
            _view.ViewportWidthChanged += SetAdornmentLocation;

            _text.MouseUp += (s, e) => dte.ExecuteCommand("View.ErrorList");

            _timer = new Timer(750);
            _timer.Elapsed += (s, e) =>
            {
                _timer.Stop();
                System.Threading.Tasks.Task.Run(() =>
                {
                    _dispatcher.Invoke(new Action(() => Update(false)), DispatcherPriority.ApplicationIdle, null);
                });
            };
            _timer.Start();
        }
开发者ID:karthik25,项目名称:roslyn-code-analysis-extension,代码行数:28,代码来源:RoslynCodeAnalysisHelper.cs

示例3: LoadRuleset

 /// <summary>
 /// Load the ruleset file according to the document file path.
 /// </summary>
 /// <param name="document">The specified document file.</param>
 private void LoadRuleset(ITextDocument document)
 {
     try
     {
         for (string path = Path.GetDirectoryName(document.FilePath); path != null; path = Path.GetDirectoryName(path))
         {
             string[] rulesetFiles = Directory.GetFiles(path, "*.ruleset");
             if (rulesetFiles.Length == 1)
             {
                 this.ruleset = DirectiveRuleset.LoadFromRulesetFile(rulesetFiles[0]);
                 this.RulesetFilePath = Path.GetFullPath(rulesetFiles[0]);
                 this.NoRulesetFileReason = null;
             }
             else if (rulesetFiles.Length > 1)
             {
                 this.RulesetFilePath = null;
                 this.NoRulesetFileReason = string.Format("Folder \"{0}\" contains more than one \"*.ruleset\" files", path);
             }
             if (rulesetFiles.Length > 0)
                 break;
         }
         if (this.ruleset == null)
             this.NoRulesetFileReason = "No \"*.ruleset\" file was found in the directory hierarchy";
     }
     catch (Exception ex)
     {
         this.RulesetFilePath = null;
         this.NoRulesetFileReason = ex.ToString();
     }
 }
开发者ID:JunyiYi,项目名称:MarkdownMode,代码行数:34,代码来源:MarkdownBackgroundParser.cs

示例4: ParseTemplateCore

 protected internal virtual ParserResults ParseTemplateCore(ITextDocument input, CancellationToken? cancelToken)
 {
     // Construct the parser
     RazorParser parser = CreateParser();
     Debug.Assert(parser != null);
     return parser.Parse(input);
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:7,代码来源:RazorTemplateEngine.cs

示例5: EditorCompilerInvoker

        public EditorCompilerInvoker(ITextDocument doc, CompilerRunnerBase compilerRunner)
        {
            Document = doc;
            CompilerRunner = compilerRunner;

            Document.FileActionOccurred += Document_FileActionOccurred;
        }
开发者ID:roadsunknown,项目名称:WebEssentials2013,代码行数:7,代码来源:EditorCompilerInvoker.cs

示例6: GenerateCodeCore

		//copied from base impl in RazorTemplateEngine.ParseTemplateCore, only change is that it actually calls ParseTemplateCore
		protected override GeneratorResults GenerateCodeCore (ITextDocument input, string className, string rootNamespace, string sourceFileName, CancellationToken? cancelToken)
		{
			className = (className ?? Host.DefaultClassName) ?? DefaultClassName;
			rootNamespace = (rootNamespace ?? Host.DefaultNamespace) ?? DefaultNamespace;

			ParserResults results = ParseTemplateCore (input, cancelToken);

			// Generate code
			RazorCodeGenerator generator = CreateCodeGenerator(className, rootNamespace, sourceFileName);
			generator.DesignTimeMode = Host.DesignTimeMode;
			generator.Visit(results);

			// Post process code
			Host.PostProcessGeneratedCode(generator.Context);

			// Extract design-time mappings
			IDictionary<int, GeneratedCodeMapping> designTimeLineMappings = null;
			if (Host.DesignTimeMode)
			{
				designTimeLineMappings = generator.Context.CodeMappings;
			}

			// Collect results and return
			return new GeneratorResults(results, generator.Context.CompileUnit, designTimeLineMappings);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:26,代码来源:RewritingRazorTemplateEngine.cs

示例7: MouseClickProcessor

        public MouseClickProcessor(IWpfTextView TextView, ITextDocument Document)
        {
            this.TextView = TextView;
            this.Document = Document;

            SetupFolderSettings();
        }
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:7,代码来源:MouseClickProcessor.cs

示例8: ParserContext

		/// <summary>
		/// Initializes a new instance of the <see cref="ParserContext"/> class.
		/// </summary>
		/// <param name="source">The source.</param>
		/// <param name="parser">The parser.</param>
		/// <param name="errorSink">The error sink.</param>
		public ParserContext(ITextDocument source, ParserBase parser, ParserErrorSink errorSink, TagProvidersCollection providers)
		{
			Source = new TextDocumentReader(source);
			Parser = parser;
			_errorSink = errorSink;
			TagProviders = providers;
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:13,代码来源:ParserContext.cs

示例9: InformationBarMargin

        public InformationBarMargin(IWpfTextView textView, ITextDocument document, IEditorOperations editorOperations, ITextUndoHistory undoHistory, DTE dte)
        {
            _textView = textView;
            _document = document;
            _operations = editorOperations;
            _undoHistory = undoHistory;
            _dte = dte;

            _informationBarControl = new InformationBarControl();
            _informationBarControl.Hide.Click += Hide;
            _informationBarControl.DontShowAgain.Click += DontShowAgain;
            var format = new Action(() => this.FormatDocument());
            _informationBarControl.Tabify.Click += (s, e) => this.Dispatcher.Invoke(format);

            this.Height = 0;
            this.Content = _informationBarControl;
            this.Name = MarginName;

            document.FileActionOccurred += FileActionOccurred;
            textView.Closed += TextViewClosed;

            // Delay the initial check until the view gets focus
            textView.GotAggregateFocus += GotAggregateFocus;

            this._tabDirectiveParser = new TabDirectiveParser(textView, document, dte);
            this._fileHeuristics = new FileHeuristics(textView, document, dte);

            var fix = new Action(() => this.FixFile());
            this._tabDirectiveParser.Change += (s, e) => this.Dispatcher.Invoke(fix);
        }
开发者ID:Mpdreamz,项目名称:tabdirective,代码行数:30,代码来源:InformationBar.cs

示例10: ErrorHighlighter

        public ErrorHighlighter(IWpfTextView view, ITextDocument document, IVsTaskList tasks, DTE2 dte)
        {
            _view = view;
            _document = document;
            _text = new Adornment();
            _tasks = tasks;
            _dispatcher = Dispatcher.CurrentDispatcher;

            _adornmentLayer = view.GetAdornmentLayer(ErrorHighlighterFactory.LayerName);

            _view.ViewportHeightChanged += SetAdornmentLocation;
            _view.ViewportWidthChanged += SetAdornmentLocation;

            _text.MouseUp += (s, e) => { dte.ExecuteCommand("View.ErrorList"); };

            _timer = new Timer(750);
            _timer.Elapsed += (s, e) =>
            {
                _timer.Stop();
                Task.Run(() =>
                {
                    _dispatcher.Invoke(new Action(() =>
                    {
                        Update(false);
                    }), DispatcherPriority.ApplicationIdle, null);
                });
            };
            _timer.Start();
        }
开发者ID:vandro,项目名称:ErrorHighlighter,代码行数:29,代码来源:ErrorHighlighter.cs

示例11: PreviewWindowUpdateListener

        public PreviewWindowUpdateListener(IWpfTextView wpfTextView, MarkdownPackage package, ITextDocument document)
        {
            this.textView = wpfTextView;
            this.package = package;
            this.document = document;

            if (textView.HasAggregateFocus)
                UpdatePreviewWindow(false);

            updateHandler = (sender, args) =>
                {
                    UpdatePreviewWindow(async: true);
                };

            BufferIdleEventUtil.AddBufferIdleEventListener(wpfTextView.TextBuffer, updateHandler);

            textView.Closed += (sender, args) =>
                {
                    ClearPreviewWindow();
                    BufferIdleEventUtil.RemoveBufferIdleEventListener(wpfTextView.TextBuffer, updateHandler);
                };

            textView.GotAggregateFocus += (sender, args) =>
                {
                    var window = GetPreviewWindow(false);
                    if (window != null)
                    {
                        if (window.CurrentSource == null || window.CurrentSource != this)
                            UpdatePreviewWindow(false);
                    }
                };
        }
开发者ID:andorardo,项目名称:MarkdownMode,代码行数:32,代码来源:PreviewWindowUpdateListener.cs

示例12: RemoveWhitespaceOnSave

 public RemoveWhitespaceOnSave(IVsTextView textViewAdapter, IWpfTextView view, DTE2 dte, ITextDocument document)
 {
     textViewAdapter.AddCommandFilter(this, out _nextCommandTarget);
     _view = view;
     _dte = dte;
     _document = document;
 }
开发者ID:laurentkempe,项目名称:TrailingWhitespace,代码行数:7,代码来源:RemoveWhitespaceOnSave.cs

示例13: ParserContext

        public ParserContext(ITextDocument source, ParserBase codeParser, ParserBase markupParser, ParserBase activeParser)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (codeParser == null)
            {
                throw new ArgumentNullException("codeParser");
            }
            if (markupParser == null)
            {
                throw new ArgumentNullException("markupParser");
            }
            if (activeParser == null)
            {
                throw new ArgumentNullException("activeParser");
            }
            if (activeParser != codeParser && activeParser != markupParser)
            {
                throw new ArgumentException(RazorResources.ActiveParser_Must_Be_Code_Or_Markup_Parser, "activeParser");
            }

            CaptureOwnerTask();

            Source = new TextDocumentReader(source);
            CodeParser = codeParser;
            MarkupParser = markupParser;
            ActiveParser = activeParser;
            Errors = new List<RazorError>();
        }
开发者ID:chrisortman,项目名称:aspnetwebstack,代码行数:31,代码来源:ParserContext.cs

示例14: GetGitDiffFor

        public IEnumerable<HunkRangeInfo> GetGitDiffFor(ITextDocument textDocument, ITextSnapshot snapshot)
        {
            string fileName = textDocument.FilePath;
            GitFileStatusTracker tracker = new GitFileStatusTracker(Path.GetDirectoryName(fileName));
            if (!tracker.IsGit)
                yield break;

            GitFileStatus status = tracker.GetFileStatus(fileName);
            if (status == GitFileStatus.New || status == GitFileStatus.Added)
                yield break;

            HistogramDiff diff = new HistogramDiff();
            diff.SetFallbackAlgorithm(null);
            string currentText = snapshot.GetText();

            byte[] preamble = textDocument.Encoding.GetPreamble();
            byte[] content = textDocument.Encoding.GetBytes(currentText);
            if (preamble.Length > 0)
            {
                byte[] completeContent = new byte[preamble.Length + content.Length];
                Buffer.BlockCopy(preamble, 0, completeContent, 0, preamble.Length);
                Buffer.BlockCopy(content, 0, completeContent, preamble.Length, content.Length);
                content = completeContent;
            }

            byte[] previousContent = null; //GetPreviousRevision(tracker, fileName);
            RawText b = new RawText(content);
            RawText a = new RawText(previousContent ?? new byte[0]);
            EditList edits = diff.Diff(RawTextComparator.DEFAULT, a, b);
            foreach (Edit edit in edits)
                yield return new HunkRangeInfo(snapshot, edit, a, b);
        }
开发者ID:Frrank1,项目名称:Git-Source-Control-Provider,代码行数:32,代码来源:GitCommands.cs

示例15: SourceDocument

	    public SourceDocument(IEditorController controller, ITextDocument document, Project.IProject proj)
	    {
	        _controller = controller;
	        _document = document;
            _project = proj;
            if(_project != null)
                _changeTracker = new DocChangeTracker(this, _project.Index);
	    }
开发者ID:JadeHub,项目名称:Jade,代码行数:8,代码来源:SourceDocument.cs


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