1 using Castle
.ActiveRecord
.Generator
.Parts
;
2 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
16 namespace Castle
.ActiveRecord
.Generator
.Actions
19 using System
.Windows
.Forms
;
21 using Castle
.ActiveRecord
.Generator
.Components
;
24 public class ViewAvailableItemsAction
: AbstractAction
26 private MenuItem _item
;
27 private ToolBarButton _button
;
28 private AvailableShapes _availableShapes
;
30 public ViewAvailableItemsAction(AvailableShapes availableShapes
)
32 _availableShapes
= availableShapes
;
35 #region IAction Members
37 public override void Install(IWorkspace workspace
, object parentMenu
, object parentGroup
)
39 base.Install(workspace
, parentMenu
, parentGroup
);
41 _item
= new MenuItem("&Available Nodes");
43 _item
.Click
+= new EventHandler(OnNew
);
44 (parentMenu
as MenuItem
).MenuItems
.Add(_item
);
46 _button
= new ToolBarButton();
47 _button
.ToolTipText
= "Available Nodes";
48 _button
.ImageIndex
= 5;
50 (parentGroup
as ToolBar
).Buttons
.Add( _button
);
51 (parentGroup
as ToolBar
).ButtonClick
+= new ToolBarButtonClickEventHandler(ProjectNewAction_ButtonClick
);
56 private void OnNew(object sender
, EventArgs e
)
64 private void DoAction()
66 _availableShapes
.Show(Workspace
.MainDockManager
);
69 private void ProjectNewAction_ButtonClick(object sender
, ToolBarButtonClickEventArgs e
)
71 if (e
.Button
== _button
)