Author: rolf
Date: 2007-07-12 12:11:26 -0400 (Thu, 12 Jul 2007)
New Revision: 81879
Modified:
trunk/mcs/class/System/System.ComponentModel/ChangeLog
trunk/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs
trunk/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
Log:
* PropertyDescriptor.cs: GetEditor: We have to check the property
itself for attributes as well, not only the property type.
* TypeDescriptor.cs: Make a couple of methods internal so that
PropertyDescriptor can use them.
Modified: trunk/mcs/class/System/System.ComponentModel/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/ChangeLog 2007-07-12
15:59:29 UTC (rev 81878)
+++ trunk/mcs/class/System/System.ComponentModel/ChangeLog 2007-07-12
16:11:26 UTC (rev 81879)
@@ -1,5 +1,12 @@
2007-07-12 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+ * PropertyDescriptor.cs: GetEditor: We have to check the property
+ itself for attributes as well, not only the property type.
+ * TypeDescriptor.cs: Make a couple of methods internal so that
+ PropertyDescriptor can use them.
+
+2007-07-12 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
* TypeDescriptor.cs: GetEditor: Make sure the static constructor of the
editors basetype is called, since that's where we're initializing
the editor table.
Modified: trunk/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs
2007-07-12 15:59:29 UTC (rev 81878)
+++ trunk/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs
2007-07-12 16:11:26 UTC (rev 81879)
@@ -247,6 +247,25 @@
public virtual object GetEditor(Type editorBaseType)
{
+ Type t = null;
+ Attribute [] atts = AttributeArray;
+
+ if (atts != null && atts.Length != 0) {
+ foreach (Attribute a in atts) {
+ EditorAttribute ea = a as
EditorAttribute;
+
+ if (ea == null)
+ continue;
+
+ t = TypeDescriptor.GetTypeFromName
(null, ea.EditorTypeName);
+ if (t.IsSubclassOf(editorBaseType))
+ break;
+ }
+ }
+
+ if (t != null)
+ return TypeDescriptor.CreateEditor (t,
PropertyType);
+
return TypeDescriptor.GetEditor (PropertyType,
editorBaseType);
}
Modified: trunk/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
2007-07-12 15:59:29 UTC (rev 81878)
+++ trunk/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
2007-07-12 16:11:26 UTC (rev 81879)
@@ -441,7 +441,7 @@
}
}
- private static object CreateEditor (Type t, Type componentType)
+ internal static object CreateEditor (Type t, Type componentType)
{
if (t == null)
return null;
@@ -505,6 +505,7 @@
{
Type t = null;
object [] atts = componentType.GetCustomAttributes
(typeof(EditorAttribute), true);
+
if (atts != null && atts.Length != 0) {
foreach (EditorAttribute ea in atts)
{
@@ -835,7 +836,7 @@
}
}
- static Type GetTypeFromName (IComponent component, string typeName)
+ internal static Type GetTypeFromName (IComponent component, string
typeName)
{
if (component != null && component.Site != null) {
ITypeResolutionService resver =
(ITypeResolutionService) component.Site.GetService
(typeof(ITypeResolutionService));
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches