Skip to content

Commit

Permalink
fix FindAllImplementations target acquisition from Project Explorer.
Browse files Browse the repository at this point in the history
  • Loading branch information
retailcoder committed May 8, 2021
1 parent ffb75b6 commit 80581fb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Expand Up @@ -7,10 +7,35 @@

namespace Rubberduck.UI.Command.ComCommands
{
public class ProjectExplorerFindAllImplementationsCommand : FindAllImplementationsCommand
{
private readonly ISelectedDeclarationProvider _selectedDeclarationProvider;

public ProjectExplorerFindAllImplementationsCommand(
IParserStatusProvider parserStatusProvider,
ISelectedDeclarationProvider selectedDeclarationProvider,
ISearchResultsWindowViewModel viewModel,
FindAllImplementationsService finder,
IVbeEvents vbeEvents)
: base(parserStatusProvider, selectedDeclarationProvider, viewModel, finder, vbeEvents)
{
_selectedDeclarationProvider = selectedDeclarationProvider;
}

protected override Declaration FindTarget(object parameter)
{
if (parameter is Declaration declaration)
{
return declaration;
}

return _selectedDeclarationProvider.SelectedProjectExplorerModule();
}
}

/// <summary>
/// A command that finds all implementations of a specified method, or of the active interface module.
/// </summary>
[ComVisible(false)]
public class FindAllImplementationsCommand : ComCommandBase
{
private readonly ISelectedDeclarationProvider _selectedDeclarationProvider;
Expand Down Expand Up @@ -59,7 +84,7 @@ protected override void OnExecute(object parameter)
_finder.FindAllImplementations(declaration);
}

private Declaration FindTarget(object parameter)
protected virtual Declaration FindTarget(object parameter)
{
if (parameter is Declaration declaration)
{
Expand Down
Expand Up @@ -29,7 +29,7 @@ public FindAllImplementationsCommandMenuItem(FindAllImplementationsCommand comma

public class ProjectExplorerFindAllImplementationsCommandMenuItem : FindAllImplementationsCommandMenuItemBase
{
public ProjectExplorerFindAllImplementationsCommandMenuItem(FindAllImplementationsCommand command)
public ProjectExplorerFindAllImplementationsCommandMenuItem(ProjectExplorerFindAllImplementationsCommand command)
: base(command)
{}

Expand Down

0 comments on commit 80581fb

Please sign in to comment.