1
- using System . Linq ;
2
- using System . Runtime . InteropServices ;
1
+ using System . Runtime . InteropServices ;
3
2
using Microsoft . Vbe . Interop ;
4
- using Rubberduck . Parsing . Annotations ;
5
- using Rubberduck . Parsing . Symbols ;
6
- using Rubberduck . Parsing . VBA ;
7
3
using Rubberduck . Settings ;
8
4
using Rubberduck . SmartIndenter ;
9
5
@@ -13,22 +9,17 @@ namespace Rubberduck.UI.Command
13
9
public class IndentCurrentModuleCommand : CommandBase
14
10
{
15
11
private readonly VBE _vbe ;
16
- private readonly RubberduckParserState _state ;
17
12
private readonly IIndenter _indenter ;
18
13
19
- public IndentCurrentModuleCommand ( VBE vbe , RubberduckParserState state , IIndenter indenter )
14
+ public IndentCurrentModuleCommand ( VBE vbe , IIndenter indenter )
20
15
{
21
16
_vbe = vbe ;
22
- _state = state ;
23
17
_indenter = indenter ;
24
18
}
25
19
26
20
public override bool CanExecute ( object parameter )
27
21
{
28
- var target = FindTarget ( parameter ) ;
29
-
30
- return _vbe . ActiveCodePane != null && target != null &&
31
- target . Annotations . All ( a => a . AnnotationType != AnnotationType . NoIndent ) ;
22
+ return _vbe . ActiveCodePane != null ;
32
23
}
33
24
34
25
public override void Execute ( object parameter )
@@ -37,23 +28,5 @@ public override void Execute(object parameter)
37
28
}
38
29
39
30
public RubberduckHotkey Hotkey { get { return RubberduckHotkey . IndentModule ; } }
40
-
41
- private Declaration FindTarget ( object parameter )
42
- {
43
- var declaration = parameter as Declaration ;
44
- if ( declaration != null )
45
- {
46
- return declaration ;
47
- }
48
-
49
- var selectedDeclaration = _state . FindSelectedDeclaration ( _vbe . ActiveCodePane ) ;
50
-
51
- while ( selectedDeclaration != null && selectedDeclaration . DeclarationType . HasFlag ( DeclarationType . Module ) )
52
- {
53
- selectedDeclaration = selectedDeclaration . ParentDeclaration ;
54
- }
55
-
56
- return selectedDeclaration ;
57
- }
58
31
}
59
32
}
0 commit comments