5
5
using System . Linq ;
6
6
using System . Runtime . InteropServices ;
7
7
using System . Windows . Forms ;
8
- using System . Windows . Input ;
9
8
using Microsoft . Vbe . Interop ;
10
9
using Rubberduck . Common . Hotkeys ;
11
10
using Rubberduck . Common . WinAPI ;
12
11
using Rubberduck . Settings ;
13
12
using Rubberduck . UI . Command ;
14
- using Rubberduck . UI . Command . Refactorings ;
15
13
using NLog ;
16
- using Rubberduck . UI ;
17
14
18
15
namespace Rubberduck . Common
19
16
{
20
17
public class RubberduckHooks : IRubberduckHooks
21
18
{
22
- private readonly VBE _vbe ;
23
19
private readonly IntPtr _mainWindowHandle ;
24
20
private readonly IntPtr _oldWndPointer ;
25
21
private readonly User32 . WndProc _oldWndProc ;
@@ -34,7 +30,6 @@ public class RubberduckHooks : IRubberduckHooks
34
30
35
31
public RubberduckHooks ( VBE vbe , IGeneralConfigService config , IEnumerable < CommandBase > commands )
36
32
{
37
- _vbe = vbe ;
38
33
_mainWindowHandle = ( IntPtr ) vbe . MainWindow . HWnd ;
39
34
_oldWndProc = WindowProc ;
40
35
_newWndProc = WindowProc ;
@@ -175,7 +170,7 @@ public void Detach()
175
170
private void hook_MessageReceived ( object sender , HookEventArgs e )
176
171
{
177
172
var hotkey = sender as IHotkey ;
178
- if ( hotkey != null )
173
+ if ( hotkey != null && hotkey . Command . CanExecute ( null ) )
179
174
{
180
175
hotkey . Command . Execute ( null ) ;
181
176
return ;
0 commit comments