Author: lluis
Date: 2007-07-18 12:16:19 -0400 (Wed, 18 Jul 2007)
New Revision: 82221

Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Components/ChangeLog
   
trunk/monodevelop/Core/src/MonoDevelop.Components/MonoDevelop.Components.Commands/CommandHandlerAttribute.cs
   
trunk/monodevelop/Core/src/MonoDevelop.Components/MonoDevelop.Components.Commands/CommandManager.cs
Log:
* MonoDevelop.Components.Commands/CommandManager.cs,
  MonoDevelop.Components.Commands/CommandHandlerAttribute.cs: Allow
  assigning multiple command handler attributes to a single method.

Modified: trunk/monodevelop/Core/src/MonoDevelop.Components/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Components/ChangeLog 2007-07-18 
16:15:32 UTC (rev 82220)
+++ trunk/monodevelop/Core/src/MonoDevelop.Components/ChangeLog 2007-07-18 
16:16:19 UTC (rev 82221)
@@ -1,5 +1,11 @@
 2007-07-18  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
+       * MonoDevelop.Components.Commands/CommandManager.cs,
+         MonoDevelop.Components.Commands/CommandHandlerAttribute.cs: Allow
+         assigning multiple command handler attributes to a single method.
+
+2007-07-18  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
        * MonoDevelop.Components.Commands/CommandManager.cs: Don't crash if a
          command is not found.
 

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Components/MonoDevelop.Components.Commands/CommandHandlerAttribute.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Components/MonoDevelop.Components.Commands/CommandHandlerAttribute.cs
        2007-07-18 16:15:32 UTC (rev 82220)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Components/MonoDevelop.Components.Commands/CommandHandlerAttribute.cs
        2007-07-18 16:16:19 UTC (rev 82221)
@@ -45,6 +45,7 @@
                }
        }
 
+       [AttributeUsage (AttributeTargets.Method, AllowMultiple=true)]
        public class CommandHandlerAttribute: CommandMethodAttribute
        {
                public CommandHandlerAttribute (object commandId): base 
(commandId)
@@ -52,6 +53,7 @@
                }
        }
        
+       [AttributeUsage (AttributeTargets.Method, AllowMultiple=true)]
        public class CommandUpdateHandlerAttribute: CommandMethodAttribute
        {
                public CommandUpdateHandlerAttribute (object commandId): base 
(commandId)

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Components/MonoDevelop.Components.Commands/CommandManager.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Components/MonoDevelop.Components.Commands/CommandManager.cs
 2007-07-18 16:15:32 UTC (rev 82220)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Components/MonoDevelop.Components.Commands/CommandManager.cs
 2007-07-18 16:16:19 UTC (rev 82221)
@@ -537,12 +537,10 @@
                        
                        MethodInfo[] methods = type.GetMethods 
(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                        foreach (MethodInfo method in methods) {
-                               object attr = Attribute.GetCustomAttribute 
(method, typeof(CommandHandlerAttribute));
-                               if (attr != null)
+                               foreach (CommandHandlerAttribute attr in 
method.GetCustomAttributes (typeof(CommandHandlerAttribute), true))
                                        handlers.Add (new CommandHandlerInfo 
(method, (CommandHandlerAttribute) attr));
 
-                               attr = Attribute.GetCustomAttribute (method, 
typeof(CommandUpdateHandlerAttribute));
-                               if (attr != null)
+                               foreach (CommandUpdateHandlerAttribute attr in 
method.GetCustomAttributes (typeof(CommandUpdateHandlerAttribute), true))
                                        updaters.Add (new CommandUpdaterInfo 
(method, (CommandUpdateHandlerAttribute) attr));
                        }
                        

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to