8
8
using Rubberduck . Settings ;
9
9
using Rubberduck . SettingsProvider ;
10
10
using Rubberduck . UI . CodeExplorer . Commands ;
11
+ using Rubberduck . VBERuntime ;
11
12
using Rubberduck . VBEditor . ComManagement . TypeLibsAPI ;
12
13
using Rubberduck . VBEditor . SafeComWrappers ;
13
14
using Rubberduck . VBEditor . SafeComWrappers . Abstract ;
@@ -20,13 +21,15 @@ public class ReparseCommand : CommandBase
20
21
{
21
22
private readonly IVBE _vbe ;
22
23
private readonly IVBETypeLibsAPI _typeLibApi ;
24
+ private readonly IVBESettings _vbeSettings ;
23
25
private readonly IMessageBox _messageBox ;
24
26
private readonly RubberduckParserState _state ;
25
27
private readonly GeneralSettings _settings ;
26
28
27
- public ReparseCommand ( IVBE vbe , IConfigProvider < GeneralSettings > settingsProvider , RubberduckParserState state , IVBETypeLibsAPI typeLibApi , IMessageBox messageBox ) : base ( LogManager . GetCurrentClassLogger ( ) )
29
+ public ReparseCommand ( IVBE vbe , IConfigProvider < GeneralSettings > settingsProvider , RubberduckParserState state , IVBETypeLibsAPI typeLibApi , IVBESettings vbeSettings , IMessageBox messageBox ) : base ( LogManager . GetCurrentClassLogger ( ) )
28
30
{
29
31
_vbe = vbe ;
32
+ _vbeSettings = vbeSettings ;
30
33
_typeLibApi = typeLibApi ;
31
34
_state = state ;
32
35
_settings = settingsProvider . Create ( ) ;
@@ -46,6 +49,11 @@ protected override void OnExecute(object parameter)
46
49
{
47
50
if ( _settings . CompileBeforeParse )
48
51
{
52
+ if ( ! VerifyCompileOnDemand ( ) )
53
+ {
54
+ return ;
55
+ }
56
+
49
57
if ( CompileAllProjects ( out var failedNames ) )
50
58
{
51
59
if ( ! PromptUserToContinue ( failedNames ) )
@@ -57,6 +65,20 @@ protected override void OnExecute(object parameter)
57
65
_state . OnParseRequested ( this ) ;
58
66
}
59
67
68
+ private bool VerifyCompileOnDemand ( )
69
+ {
70
+ //Command_Reparse_CompileOnDemandEnabled
71
+
72
+ if ( _vbeSettings . CompileOnDemand )
73
+ {
74
+ return DialogResult . Yes == _messageBox . Show ( RubberduckUI . Command_Reparse_CompileOnDemandEnabled ,
75
+ RubberduckUI . Command_Reparse_CompileOnDemandEnabled_Caption , MessageBoxButtons . YesNo ,
76
+ MessageBoxIcon . Exclamation , MessageBoxDefaultButton . Button2 ) ;
77
+ }
78
+
79
+ return true ;
80
+ }
81
+
60
82
private bool CompileAllProjects ( out List < string > failedNames )
61
83
{
62
84
failedNames = new List < string > ( ) ;
0 commit comments