2
// ExtensionPointAttribute.cs
7
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
9
// Permission is hereby granted, free of charge, to any person obtaining
10
// a copy of this software and associated documentation files (the
11
// "Software"), to deal in the Software without restriction, including
12
// without limitation the rights to use, copy, modify, merge, publish,
13
// distribute, sublicense, and/or sell copies of the Software, and to
14
// permit persons to whom the Software is furnished to do so, subject to
15
// the following conditions:
17
// The above copyright notice and this permission notice shall be
18
// included in all copies or substantial portions of the Software.
20
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
/// Declares an extension point.
37
[AttributeUsage (AttributeTargets.Assembly, AllowMultiple=true)]
38
public class ExtensionPointAttribute: Attribute
47
string objectTypeName;
48
Type customAttributeType;
49
string customAttributeTypeName;
52
/// Initializes a new instance
54
public ExtensionPointAttribute ()
59
/// Initializes a new instance
61
/// <param name="path">
62
/// Extension path that identifies the extension point
64
public ExtensionPointAttribute (string path)
70
/// Initializes a new instance
72
/// <param name="path">
73
/// Extension path that identifies the extension point
75
/// <param name="nodeType">
76
/// Type of the extension node to be created for extensions
78
public ExtensionPointAttribute (string path, Type nodeType)
81
this.nodeType = nodeType;
85
/// Initializes a new instance
87
/// <param name="path">
88
/// Extension path that identifies the extension point
90
/// <param name="nodeName">
91
/// Element name to be used when defining an extension in an XML manifest.
93
/// <param name="nodeType">
94
/// Type of the extension node to be created for extensions
96
public ExtensionPointAttribute (string path, string nodeName, Type nodeType)
99
this.nodeType = nodeType;
100
this.nodeName = nodeName;
104
/// Extension path that identifies the extension point
107
get { return path != null ? path : string.Empty; }
108
set { path = value; }
112
/// Long description of the extension point.
114
public string Description {
115
get { return desc != null ? desc : string.Empty; }
116
set { desc = value; }
120
/// Type of the extension node to be created for extensions
122
public Type NodeType {
123
get { return nodeType != null ? nodeType : typeof(TypeExtensionNode); }
124
set { nodeType = value; nodeTypeName = value.FullName; }
128
/// Expected extension object type (when nodes are of type TypeExtensionNode)
130
public Type ObjectType {
131
get { return objectType; }
132
set { objectType = value; objectTypeName = value.FullName; }
135
internal string NodeTypeName {
136
get { return nodeTypeName != null ? nodeTypeName : typeof(TypeExtensionNode).FullName; }
137
set { nodeTypeName = value; }
140
internal string ObjectTypeName {
141
get { return objectTypeName; }
142
set { objectTypeName = value; }
146
/// Element name to be used when defining an extension in an XML manifest. The default name is "Type".
148
public string NodeName {
149
get { return nodeName != null && nodeName.Length > 0 ? nodeName : string.Empty; }
150
set { nodeName = value; }
154
/// Display name of the extension point.
157
get { return name != null ? name : string.Empty; }
158
set { name = value; }
162
/// Type of the custom attribute to be used to specify metadata for the extension point
164
public Type ExtensionAttributeType {
165
get { return this.customAttributeType; }
166
set { this.customAttributeType = value; customAttributeTypeName = value.FullName; }
169
internal string ExtensionAttributeTypeName {
170
get { return this.customAttributeTypeName; }
171
set { this.customAttributeTypeName = value; }