public TemplateProjectionBuffer(IContentTypeRegistryService contentRegistry, IProjectionBufferFactoryService bufferFactory, ITextBuffer diskBuffer, IBufferGraphFactoryService bufferGraphFactory, IContentType contentType) { _diskBuffer = diskBuffer; _contentRegistry = contentRegistry; _contentType = contentType; _projBuffer = bufferFactory.CreateProjectionBuffer( this, new object[0], ProjectionBufferOptions.None ); _projBuffer.Properties.AddProperty(typeof(TemplateProjectionBuffer), this); _bufferGraph = bufferGraphFactory.CreateBufferGraph(_projBuffer); _htmlBuffer = CreateHtmlBuffer(bufferFactory); _templateBuffer = CreateTemplateBuffer(bufferFactory); IVsTextBuffer buffer; if (_diskBuffer.Properties.TryGetProperty <IVsTextBuffer>(typeof(IVsTextBuffer), out buffer)) { // keep the Venus HTML classifier happy - it wants to find a site via IVsTextBuffer _htmlBuffer.Properties.AddProperty(typeof(IVsTextBuffer), buffer); } var reader = new SnapshotSpanSourceCodeReader(new SnapshotSpan(diskBuffer.CurrentSnapshot, new Span(0, diskBuffer.CurrentSnapshot.Length))); UpdateTemplateSpans(reader); }
public PhpProjectionBuffer( IContentTypeRegistryService contentRegistry, IProjectionBufferFactoryService bufferFactory, IBufferTagAggregatorFactoryService bufferTagAggregatorFactory, ITextBuffer diskBuffer, IBufferGraphFactoryService bufferGraphFactory, IContentType contentType) { _diskBuffer = diskBuffer; _contentRegistry = contentRegistry; _contentType = contentType; _projBuffer = CreateProjectionBuffer(bufferFactory); _htmlBuffer = CreateHtmlBuffer(bufferFactory); _templateBuffer = CreateTemplateBuffer(bufferFactory); _bufferGraph = bufferGraphFactory.CreateBufferGraph(_projBuffer); _contentTypeTagger = bufferTagAggregatorFactory.CreateTagAggregator <ContentTypeTag>(_diskBuffer); _contentTypeTagger.TagsChanged += HandleContentTypeTagsChanged; IVsTextBuffer buffer; if (_diskBuffer.Properties.TryGetProperty <IVsTextBuffer>(typeof(IVsTextBuffer), out buffer)) { // keep the Venus HTML classifier happy - it wants to find a site via IVsTextBuffer _htmlBuffer.Properties.AddProperty(typeof(IVsTextBuffer), buffer); } HandleContentTypeTagsChanged(); }
// Methods public DCIBabyIDETextViewModel(ITextDataModel dataModel, IElisionBuffer elisionBuffer, int leadingCharCount, char leadingCharacter) { this._dataModel = dataModel; this._elisionBuffer = elisionBuffer; this._leadingCharCount = leadingCharCount; this._leadingCharacter = leadingCharacter; this._properties = new PropertyCollection(); this.ElideIndentation(); }
public RHistoryFiltering(IRHistory history, IRHistoryWindowVisualComponent visualComponent, IRSettings settings, ITextSearchService2 textSearchService) { _history = history; _history.HistoryChanging += HistoryChanging; _history.HistoryChanged += HistoryChanged; _settings = settings; _textSearchService = textSearchService; _textView = visualComponent.TextView; _textBuffer = _textView.TextDataModel.DataBuffer; IElisionBuffer elisionBuffer; _textView.TextViewModel.Properties.TryGetProperty(IntraTextAdornmentBufferKey, out elisionBuffer); _elisionBuffer = elisionBuffer; }
public BufferBar(ITextBuffer textBuffer, IWpfTextViewHost textViewHost, IEditorOperations editorOperations, ITextEditorFactoryService factory) { InitializeComponent(); DataContext = this; this.textBuffer = textBuffer; this.projBuffer = textBuffer as IProjectionBuffer; this.elBuffer = textBuffer as IElisionBuffer; this.prevVersion = textBuffer.CurrentSnapshot.Version; this.textView = textViewHost.TextView; this.textViewHost = textViewHost; this.factory = factory; this.editorOperations = editorOperations; this.snapshots.Add(new WeakReference(textBuffer.CurrentSnapshot)); SolidColorBrush brush = new SolidColorBrush(textBuffer is IElisionBuffer ? Colors.LightBlue : (textBuffer is IProjectionBuffer ? Colors.LightGreen : Colors.LightGray)); brush.Freeze(); //Background = brush; ITextDataModel tdm = this.textView.TextDataModel; ITextViewModel tvm = this.textView.TextViewModel; StringBuilder tip = new StringBuilder(); if (textBuffer == tdm.DocumentBuffer) { tip.Append("Document Buffer,"); } if (textBuffer == tdm.DataBuffer) { tip.Append("Data Buffer,"); } if (textBuffer == tvm.EditBuffer) { tip.Append("Edit Buffer,"); } if (textBuffer == tvm.VisualBuffer) { tip.Append("Visual Buffer,"); } if (tip.Length > 0) { tip.Remove(tip.Length - 1, 1); TipText = tip.ToString(); } else { TipText = "Uncategorized Buffer"; } if (this.projBuffer != null || this.elBuffer != null) { if (this.projBuffer != null) { this.projBuffer.SourceSpansChanged += OnProjectionSourceSpansChanged; } else { this.elBuffer.SourceSpansChanged += OnElisionSourceSpansChanged; } } else { this.SpansLabel.Visibility = Visibility.Collapsed; } if (this.textBuffer.Properties.TryGetProperty <ITextDocument>(typeof(ITextDocument), out this.document)) { UpdateEncoding(); this.document.EncodingChanged += OnEncodingChanged; } else { this.EncodingLabel.Visibility = Visibility.Collapsed; } this.textBuffer.ContentTypeChanged += OnContentTypeChanged; this.textBuffer.Changed += OnTextChanged; this.textView.Caret.PositionChanged += OnCaretPositionChanged; this.textView.Selection.SelectionChanged += OnSelectionChanged; this.SelectionLabel.Background = Brushes.Transparent; this.SelectionLabel.BorderBrush = Brushes.Transparent; this.SelectionLabel.Padding = new Thickness(3.0); this.SelectionCombo.Background = Brushes.Transparent; this.SelectionCombo.BorderBrush = Brushes.Transparent; this.SelectionCombo.Padding = new Thickness(3.0); this.SelectionPanel.Children.Add(this.SelectionLabel); this.selectionLabelInstalled = true; UpdateAll(); }