Skip to content

Commit cf9d439

Browse files
committed
Make AddTemplateCommand inherit from CodeExplorerCommandBase again
1 parent d5f1761 commit cf9d439

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Rubberduck.Core/UI/CodeExplorer/Commands/AddTemplateCommand.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace Rubberduck.UI.CodeExplorer.Commands
1111
{
12-
public class AddTemplateCommand : CommandBase
12+
public class AddTemplateCommand : CodeExplorerCommandBase
1313
{
1414
private static readonly Type[] ApplicableNodes =
1515
{
@@ -38,7 +38,7 @@ public AddTemplateCommand(ICodeExplorerAddComponentService addComponentService,
3838
AddToCanExecuteEvaluation(SpecialEvaluateCanExecute);
3939
}
4040

41-
public IEnumerable<Type> ApplicableNodeTypes => ApplicableNodes;
41+
public override IEnumerable<Type> ApplicableNodeTypes => new[]{typeof(System.ValueTuple<string, ICodeExplorerNode>)};
4242

4343
public IEnumerable<ProjectType> AllowableProjectTypes => ApplicableProjectTypes;
4444

@@ -52,11 +52,6 @@ public bool CanExecuteForNode(ICodeExplorerNode model)
5252

5353
private bool SpecialEvaluateCanExecute(object parameter)
5454
{
55-
if (parameter == null)
56-
{
57-
return false;
58-
}
59-
6055
try
6156
{
6257
if(parameter is System.ValueTuple<string, ICodeExplorerNode> data)
@@ -75,7 +70,7 @@ private bool SpecialEvaluateCanExecute(object parameter)
7570

7671
private bool EvaluateCanExecute(ICodeExplorerNode node)
7772
{
78-
if (!ApplicableNodeTypes.Contains(node.GetType())
73+
if (!ApplicableNodes.Contains(node.GetType())
7974
|| !(node is CodeExplorerItemViewModel)
8075
|| node.Declaration == null)
8176
{
@@ -87,8 +82,9 @@ private bool EvaluateCanExecute(ICodeExplorerNode node)
8782
var project = node.Declaration.Project;
8883
return AllowableProjectTypes.Contains(project.Type);
8984
}
90-
catch (COMException)
85+
catch (COMException exception)
9186
{
87+
Logger.Debug(exception);
9288
return false;
9389
}
9490
}

0 commit comments

Comments
 (0)