Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ProjectionSourceSpansChangedEventArgs.cs « Projection « Model « TextData « Def « Text « src - github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e219725dccecf5dfdecb11606551c71213e3fef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
//  Copyright (c) Microsoft Corporation. All rights reserved.
//  Licensed under the MIT License. See License.txt in the project root for license information.
//
namespace Microsoft.VisualStudio.Text.Projection
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;

    /// <summary>
    /// Provides information for an edit transaction on a <see cref="IProjectionBuffer"/> in which the set of source <see cref="ITrackingSpan"/> objects has changed.
    /// </summary>
    public class ProjectionSourceSpansChangedEventArgs : TextContentChangedEventArgs
    {
        private ReadOnlyCollection<ITrackingSpan> insertedSpans;
        private ReadOnlyCollection<ITrackingSpan> deletedSpans;
        private int spanPosition;

        /// <summary>
        /// Initializes a new instance of a <see cref="ProjectionSourceSpansChangedEventArgs"/>.
        /// </summary>
        /// <param name="beforeSnapshot">The most recent <see cref="IProjectionSnapshot"/> before the change occurred.</param>
        /// <param name="afterSnapshot">The <see cref="IProjectionSnapshot"/> immediately after the change occurred.</param>
        /// <param name="insertedSpans">Zero or more source spans that were inserted into the <see cref="IProjectionBuffer"/>.</param>
        /// <param name="deletedSpans">Zero or more source spans that were deleted from the <see cref="IProjectionBuffer"/>.</param>
        /// <param name="spanPosition">The position at which the span changes occurred.</param>
        /// <param name="options">The edit options that were applied to this change.</param>
        /// <param name="editTag">An arbitrary object associated with this change.</param>
        /// <exception cref="ArgumentNullException">One of the parameters: <paramref name="beforeSnapshot"/>, <paramref name="afterSnapshot"/>,
        /// <paramref name="insertedSpans"/>, or <paramref name="deletedSpans"/>is null.</exception>
        public ProjectionSourceSpansChangedEventArgs(IProjectionSnapshot beforeSnapshot,
                                                     IProjectionSnapshot afterSnapshot,
                                                     IList<ITrackingSpan> insertedSpans,
                                                     IList<ITrackingSpan> deletedSpans,
                                                     int spanPosition,
                                                     EditOptions options,
                                                     object editTag)
          : base(beforeSnapshot, afterSnapshot, options, editTag)
        {
            if (insertedSpans == null)
            {
                throw new ArgumentNullException("insertedSpans");
            }
            if (deletedSpans == null)
            {
                throw new ArgumentNullException("deletedSpans");
            }
            this.insertedSpans = new ReadOnlyCollection<ITrackingSpan>(insertedSpans);
            this.deletedSpans = new ReadOnlyCollection<ITrackingSpan>(deletedSpans);
            this.spanPosition = spanPosition;
        }

        /// <summary>
        /// The position in the list of source spans at which the change occurred.
        /// </summary>
        public int SpanPosition
        {
            get { return this.spanPosition; }
        }

        /// <summary>
        /// The set of source spans that were inserted into the <see cref="IProjectionBuffer"/> by this edit transaction.
        /// </summary>
        public ReadOnlyCollection<ITrackingSpan> InsertedSpans
        {
            get { return this.insertedSpans; }
        }

        /// <summary>
        /// The set of source spans that were deleted from the <see cref="IProjectionBuffer"/> by this edit transaction.
        /// </summary>
        public ReadOnlyCollection<ITrackingSpan> DeletedSpans
        {
            get { return this.deletedSpans; }
        }

        /// <summary>
        /// The state of the <see cref="IProjectionBuffer"/> before the change occurred.
        /// </summary>
        public new IProjectionSnapshot Before
        {
            get { return (IProjectionSnapshot)base.Before; }
        }

        /// <summary>
        /// The state of the <see cref="IProjectionBuffer"/> after the change occurred.
        /// </summary>
        public new IProjectionSnapshot After
        {
            get { return (IProjectionSnapshot)base.After; }
        }
    }
}