0:   // MenuAction.cs
1:   // Copyright (C) 2000 Mike Krueger
2:   //
3:   // This program is free software; you can redistribute it and/or modify
4:   // it under the terms of the GNU General Public License as published by
5:   // the Free Software Foundation; either version 2 of the License, or
6:   // (at your option) any later version.
7:   //
8:   // This program is distributed in the hope that it will be useful,
9:   // but WITHOUT ANY WARRANTY; without even the implied warranty of
10:   // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11:   // GNU General Public License for more details.
12:   //
13:   // You should have received a copy of the GNU General Public License
14:   // along with this program; if not, write to the Free Software
15:   // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16:  
17:   using System;
18:   using System.Diagnostics;
19:   using System.Windows.Forms;
20:   using SharpDevelop.Internal.Messages;
21:  
22:   namespace SharpDevelop.Actions.Menu {
23:       
24:       public class MenuAction
25:       {
26:           ISdPluginExecutor executor;
27:           ISdPlugin plugin;
28:           public MenuItem MenuItem;
29:           
30:           public ISdPlugin Plugin {
31:               get {
32:                   return plugin;
33:               }
34:           }
35:           
36:           public MenuAction(ISdPluginExecutor executorISdPlugin plugin)
37:           {
38:               Debug.Assert(executor != null"executor == null");
39:               Debug.Assert(plugin   != null"plugin   == null");
40:               this.executor executor;
41:               this.plugin   plugin;
42:           }
43:           
44:  
45:           public void FirstInit(object senderEventArgs e)
46:           {
47:               MenuItem.Checked = ((ISdToggleablePlugin)plugin).IsEnabled(executor);
48:           }
49:           
50:           public void Invoke(object senderEventArgs e)
51:           {
52:               plugin.Execute(executor);
53:           }
54:           
55:           public void Toggle(object senderEventArgs e)
56:           {
57:               MenuItem item = (MenuItem)sender;
58:               item.Checked = ((ISdToggleablePlugin)plugin).IsEnabled(executor);
59:           }
60:       }
61:  
62:   }

This page was automatically generated by SharpDevelop.