blob: 9582fb4c93d5f708959b3574887b2b214d7fec98 (
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
|
//
// 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
{
using System;
/// <summary>
/// Provides information about a transaction on a <see cref="ITextBuffer"/>
/// that causes a new <see cref="ITextSnapshot"/> to be generated.
/// </summary>
public abstract class TextSnapshotChangedEventArgs : EventArgs
{
#region Private Members and Construction
private ITextSnapshot before;
private ITextSnapshot after;
private Object editTag;
/// <summary>
/// Initializes a new instance of a <see cref="TextSnapshotChangedEventArgs"/> for a Change event.
/// </summary>
/// <param name="beforeSnapshot">The most recent <see cref="ITextSnapshot"/> before the change occurred.</param>
/// <param name="afterSnapshot">The <see cref="ITextSnapshot"/> immediately after the change occurred.</param>
/// <param name="editTag">An arbitrary object associated with this change.</param>
/// <exception cref="ArgumentNullException"><paramref name="beforeSnapshot"/> or <paramref name="afterSnapshot"/> is null.</exception>
protected TextSnapshotChangedEventArgs(ITextSnapshot beforeSnapshot,
ITextSnapshot afterSnapshot,
object editTag)
{
if (beforeSnapshot == null)
{
throw new ArgumentNullException(nameof(beforeSnapshot));
}
if (afterSnapshot == null)
{
throw new ArgumentNullException(nameof(afterSnapshot));
}
this.before = beforeSnapshot;
this.after = afterSnapshot;
this.editTag = editTag;
}
#endregion // Private Members and Construction
#region Public Properties
/// <summary>
/// Gets the state of the <see cref="ITextBuffer"/> before the change occurred.
/// </summary>
public ITextSnapshot Before
{
get { return this.before; }
}
/// <summary>
/// Gets the state of the <see cref="ITextBuffer"/> after the change.
/// </summary>
public ITextSnapshot After
{
get { return this.after; }
}
/// <summary>
/// Gets the <see cref="ITextVersion"/> associated with <see cref="Before"/>.
/// </summary>
public ITextVersion BeforeVersion
{
get { return this.before.Version; }
}
/// <summary>
/// Gets the <see cref="ITextVersion"/>n associated with <see cref="After"/>.
/// </summary>
public ITextVersion AfterVersion
{
get { return this.after.Version; }
}
/// <summary>
/// Gets an arbitrary object provided by the initiator of the changes.
/// </summary>
public Object EditTag
{
get { return this.editTag; }
}
#endregion
}
}
|