blob: 7b9b738c53cf89666b246aded63c7d1627475658 (
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
|
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
using System;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.VisualStudio.Text.Editor
{
/// <summary>
/// Specifies the name(s) of an asset that will be replaced by this asset.
/// </summary>
/// <remarks>
/// <para>You can specify multiple Replaces attributes if you want to replace multiple assets.</para>
/// <para>An asset must have a different Name attribute than its Replaces attribute (otherwise it would "replace" itself, preventing it from being created).</para>
/// <para>An asset is not created if its Name attribute matches the Replaces attribute of any other asset that would -- excluding this check -- be created. For
/// margin providers, the means that a provider must match the view's ContentType and TextViewRole before it can replace another provider.</para>
/// </remarks>
public sealed class ReplacesAttribute : MultipleBaseMetadataAttribute
{
private readonly string replaces;
/// <summary>
/// The name of the asset replaced by this asset.
/// </summary>
/// <param name="replaces">The name of the replaced asset.</param>
/// <exception cref="ArgumentNullException"><paramref name="replaces"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="replaces"/> is an empty string.</exception>
public ReplacesAttribute(string replaces)
{
if (replaces == null)
throw new ArgumentNullException("replaces");
if (replaces.Length == 0)
throw new ArgumentException("replaces is an empty string.");
this.replaces = replaces;
}
/// <summary>
/// The name of the replaced margin.
/// </summary>
public string Replaces
{
get
{
return this.replaces;
}
}
}
}
|