Exemplo n.º 1
0
        public FileChange(TextDocument left,
                          TextDocument right,
                          IComponentModel componentModel,
                          AbstractChange parent,
                          PreviewEngine engine,
                          IVsImageService2 imageService) : base(engine)
        {
            Contract.ThrowIfFalse(left != null || right != null);

            this.Id       = left != null ? left.Id : right.Id;
            _left         = left;
            _right        = right;
            _imageService = imageService;

            _componentModel = componentModel;
            var bufferFactory = componentModel.GetService <ITextBufferFactoryService>();
            var bufferText    = left != null
                ? left.GetTextSynchronously(CancellationToken.None)
                : right.GetTextSynchronously(CancellationToken.None);

            _buffer   = bufferFactory.CreateTextBuffer(bufferText.ToString(), bufferFactory.InertContentType);
            _encoding = bufferText.Encoding;

            this.Children = ComputeChildren(left, right, CancellationToken.None);
            this.parent   = parent;
        }
Exemplo n.º 2
0
        public FileChange(TextDocument left,
            TextDocument right,
            IComponentModel componentModel,
            AbstractChange parent,
            PreviewEngine engine,
            IVsImageService2 imageService) : base(engine)
        {
            Contract.ThrowIfFalse(left != null || right != null);

            this.Id = left != null ? left.Id : right.Id;
            _left = left;
            _right = right;
            _imageService = imageService;

            _componentModel = componentModel;
            var bufferFactory = componentModel.GetService<ITextBufferFactoryService>();
            var bufferText = left != null ?
                left.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None) :
                right.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None);
            _buffer = bufferFactory.CreateTextBuffer(bufferText.ToString(), bufferFactory.InertContentType);
            _encoding = bufferText.Encoding;

            this.Children = ComputeChildren(left, right, CancellationToken.None);
            this.parent = parent;
        }
Exemplo n.º 3
0
 public SpanChange(ITrackingSpan span, ITextBuffer buffer, DocumentId id, string text, string leftText, string rightText, bool isDeletion, AbstractChange parent, PreviewEngine engine)
     : base(engine)
 {
     _span = span;
     _id = id;
     _buffer = buffer;
     _text = text;
     this.parent = parent;
     _rightText = rightText;
     _leftText = leftText;
     _isDeletion = isDeletion;
     this.Children = new ChangeList(new AbstractChange[0]);
 }
Exemplo n.º 4
0
 public SpanChange(
     ITrackingSpan span,
     ITextBuffer buffer,
     DocumentId id,
     string text,
     string leftText,
     string rightText,
     bool isDeletion,
     AbstractChange parent,
     PreviewEngine engine
     ) : base(engine)
 {
     _span         = span;
     _id           = id;
     _buffer       = buffer;
     _text         = text;
     this.parent   = parent;
     _rightText    = rightText;
     _leftText     = leftText;
     _isDeletion   = isDeletion;
     this.Children = new ChangeList(Array.Empty <AbstractChange>());
 }
Exemplo n.º 5
0
 public ChangeList(AbstractChange[] changes)
 {
     this.Changes = changes;
 }