Skip to content

Commit 461934a

Browse files
committed
Adds AddPredeclaredClassModuleCommand
1 parent 34ad8a6 commit 461934a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using NLog;
2+
using Rubberduck.Navigation.CodeExplorer;
3+
using Rubberduck.UI.Command;
4+
using Rubberduck.VBEditor.SafeComWrappers;
5+
6+
namespace Rubberduck.UI.CodeExplorer.Commands
7+
{
8+
[CodeExplorerCommand]
9+
public class AddPredeclaredClassModuleCommand : CommandBase
10+
{
11+
private readonly AddComponentCommand _addComponentCommand;
12+
13+
public AddPredeclaredClassModuleCommand(AddComponentCommand addComponentCommand) : base(LogManager.GetCurrentClassLogger())
14+
{
15+
_addComponentCommand = addComponentCommand;
16+
}
17+
18+
protected override bool EvaluateCanExecute(object parameter)
19+
{
20+
return _addComponentCommand.CanAddComponent(parameter as CodeExplorerItemViewModel);
21+
}
22+
23+
protected override void OnExecute(object parameter)
24+
{
25+
_addComponentCommand.AddComponent(parameter as CodeExplorerItemViewModel, ComponentType.ClassModule);
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)