Skip to content

Commit 0b128f9

Browse files
committed
Redo hotkey CanExecute before Execute
1 parent 133968c commit 0b128f9

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

RetailCoder.VBE/Common/RubberduckHooks.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@
55
using System.Linq;
66
using System.Runtime.InteropServices;
77
using System.Windows.Forms;
8-
using System.Windows.Input;
98
using Microsoft.Vbe.Interop;
109
using Rubberduck.Common.Hotkeys;
1110
using Rubberduck.Common.WinAPI;
1211
using Rubberduck.Settings;
1312
using Rubberduck.UI.Command;
14-
using Rubberduck.UI.Command.Refactorings;
1513
using NLog;
16-
using Rubberduck.UI;
1714

1815
namespace Rubberduck.Common
1916
{
2017
public class RubberduckHooks : IRubberduckHooks
2118
{
22-
private readonly VBE _vbe;
2319
private readonly IntPtr _mainWindowHandle;
2420
private readonly IntPtr _oldWndPointer;
2521
private readonly User32.WndProc _oldWndProc;
@@ -34,7 +30,6 @@ public class RubberduckHooks : IRubberduckHooks
3430

3531
public RubberduckHooks(VBE vbe, IGeneralConfigService config, IEnumerable<CommandBase> commands)
3632
{
37-
_vbe = vbe;
3833
_mainWindowHandle = (IntPtr)vbe.MainWindow.HWnd;
3934
_oldWndProc = WindowProc;
4035
_newWndProc = WindowProc;
@@ -175,7 +170,7 @@ public void Detach()
175170
private void hook_MessageReceived(object sender, HookEventArgs e)
176171
{
177172
var hotkey = sender as IHotkey;
178-
if (hotkey != null)
173+
if (hotkey != null && hotkey.Command.CanExecute(null))
179174
{
180175
hotkey.Command.Execute(null);
181176
return;

0 commit comments

Comments
 (0)