9
9
10
10
namespace Rubberduck . UI . CodeExplorer . Commands
11
11
{
12
- public class AddTemplateCommand : CommandBase
12
+ public class AddTemplateCommand : CodeExplorerCommandBase
13
13
{
14
14
private static readonly Type [ ] ApplicableNodes =
15
15
{
@@ -38,7 +38,7 @@ public AddTemplateCommand(ICodeExplorerAddComponentService addComponentService,
38
38
AddToCanExecuteEvaluation ( SpecialEvaluateCanExecute ) ;
39
39
}
40
40
41
- public IEnumerable < Type > ApplicableNodeTypes => ApplicableNodes ;
41
+ public override IEnumerable < Type > ApplicableNodeTypes => new [ ] { typeof ( System . ValueTuple < string , ICodeExplorerNode > ) } ;
42
42
43
43
public IEnumerable < ProjectType > AllowableProjectTypes => ApplicableProjectTypes ;
44
44
@@ -52,11 +52,6 @@ public bool CanExecuteForNode(ICodeExplorerNode model)
52
52
53
53
private bool SpecialEvaluateCanExecute ( object parameter )
54
54
{
55
- if ( parameter == null )
56
- {
57
- return false ;
58
- }
59
-
60
55
try
61
56
{
62
57
if ( parameter is System . ValueTuple < string , ICodeExplorerNode > data )
@@ -75,7 +70,7 @@ private bool SpecialEvaluateCanExecute(object parameter)
75
70
76
71
private bool EvaluateCanExecute ( ICodeExplorerNode node )
77
72
{
78
- if ( ! ApplicableNodeTypes . Contains ( node . GetType ( ) )
73
+ if ( ! ApplicableNodes . Contains ( node . GetType ( ) )
79
74
|| ! ( node is CodeExplorerItemViewModel )
80
75
|| node . Declaration == null )
81
76
{
@@ -87,8 +82,9 @@ private bool EvaluateCanExecute(ICodeExplorerNode node)
87
82
var project = node . Declaration . Project ;
88
83
return AllowableProjectTypes . Contains ( project . Type ) ;
89
84
}
90
- catch ( COMException )
85
+ catch ( COMException exception )
91
86
{
87
+ Logger . Debug ( exception ) ;
92
88
return false ;
93
89
}
94
90
}
0 commit comments