1:   //  EditActionCodon.cs
2:   //  Copyright (C) 2002 Mike Krueger
3:   //
4:   //  This program is free software; you can redistribute it and/or modify
5:   //  it under the terms of the GNU General Public License as published by
6:   //  the Free Software Foundation; either version 2 of the License, or
7:   //  (at your option) any later version.
8:   //
9:   //  This program is distributed in the hope that it will be useful,
10:   //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11:   //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12:   //  GNU General Public License for more details.
13:   //
14:   //  You should have received a copy of the GNU General Public License
15:   //  along with this program; if not, write to the Free Software
16:   //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17:  
18:   using System;
19:   using System.Collections;
20:   using System.Reflection;
21:   using System.Windows.Forms;
22:  
23:   using Core.Properties;
24:   using Core.Gui.Creators;
25:   using Core.AddIns;
26:   using Core.AddIns.Conditions;
27:   using Core.AddIns.Codons;
28:   using Core.Util;
29:   using SharpDevelop.Gui.Components;
30:   using SharpDevelop.DefaultEditor.Actions;
31:  
32:   namespace SharpDevelop.DefaultEditor.Codons {
33:       
34:       [CodonNameAttribute("EditAction")]
35:       public class EditActionCodon : AbstractCodon
36:       {
37:           [XmlMemberArrayAttribute("keys"IsRequired=true)]
38:           string[] keys null;
39:           
40:           public string[] Keys {
41:               get {
42:                   return keys;
43:               }
44:               set {
45:                   keys value;
46:               }
47:           }
48:           
49:           /// <summary>
50:           /// Creates an item with the specified sub items. And the current
51:           /// Condition status for this item.
52:           /// </summary>
53:           public override object BuildItem(object ownerArrayList subItemsConditionFailedAction action)
54:           {
55:               if (subItems.Count 0) {
56:                   throw new ApplicationException("more than one level of edit actions don't make sense!");
57:               }
58:               
59:               IEditAction editAction = (IEditAction)AddIn.CreateObject(Class);
60:                               
61:               Keys[] actionKeys new Keys[keys.Length];
62:               for (int 0keys.Length; ++j) {
63:                   string[] keydescr keys[j].Split(new char[] { '|' });
64:                   Keys key = (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[0], BindingFlags.GetFieldnullSystem.Windows.Forms.Keys.Spacenew object[0]));
65:                   for (int 1keydescr.Length; ++k) {
66:                       key |= (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[k], BindingFlags.GetFieldnullSystem.Windows.Forms.Keys.Spacenew object[0]));
67:                   }
68:                   actionKeys[j] = key;
69:               }
70:               editAction.Keys actionKeys;
71:               
72:               return editAction;
73:           }
74:           
75:       }
76:   }

This page was automatically generated by SharpDevelop.