@@ -40,7 +40,7 @@ protected override void Initialize()
4040
4141 {
4242 var outputWindow = ( OutputWindow ) _dte . GetOutputWindow ( ) . Object ;
43- _outputPane = outputWindow . OutputWindowPanes . Add ( "Code analysis output" ) ;
43+ _fileAnalysisOutputPane = outputWindow . OutputWindowPanes . Add ( "[cppcheck] File analysis output" ) ;
4444 }
4545
4646 _analyzers . Add ( new AnalyzerCppcheck ( ) ) ;
@@ -88,14 +88,14 @@ private void documentSaved(Document document)
8888 if ( sourceForAnalysis == null )
8989 return ;
9090
91- runAnalysis ( sourceForAnalysis , currentConfig , false ) ;
91+ runAnalysis ( sourceForAnalysis , currentConfig , false , _fileAnalysisOutputPane ) ;
9292 }
9393 catch ( System . Exception ex )
9494 {
95- if ( _outputPane != null )
95+ if ( _fileAnalysisOutputPane != null )
9696 {
97- _outputPane . Clear ( ) ;
98- _outputPane . OutputString ( "Exception occurred in cppcheck add-in: " + ex . Message ) ;
97+ _fileAnalysisOutputPane . Clear ( ) ;
98+ _fileAnalysisOutputPane . OutputString ( "Exception occurred in cppcheck add-in: " + ex . Message ) ;
9999 }
100100 Debug . WriteLine ( "Exception occurred in cppcheck add-in: " + ex . Message ) ;
101101 }
@@ -140,23 +140,30 @@ private void checkCurrentProject()
140140 break ; // Only checking one project at a time for now
141141 }
142142
143- runAnalysis ( files , currentConfig , true ) ;
143+ if ( _projectAnalysisOutputPane == null )
144+ {
145+ var outputWindow = ( OutputWindow ) _dte . GetOutputWindow ( ) . Object ;
146+ _projectAnalysisOutputPane = outputWindow . OutputWindowPanes . Add ( "[cppcheck] Project analysis output" ) ;
147+ }
148+
149+ runAnalysis ( files , currentConfig , true , _projectAnalysisOutputPane ) ;
144150 }
145151
146- private void runAnalysis ( SourceFile file , Configuration currentConfig , bool bringOutputToFrontAfterAnalysis )
152+ private void runAnalysis ( SourceFile file , Configuration currentConfig , bool bringOutputToFrontAfterAnalysis , OutputWindowPane outputPane )
147153 {
148154 var list = new List < SourceFile > ( ) ;
149155 list . Add ( file ) ;
150- runAnalysis ( list , currentConfig , bringOutputToFrontAfterAnalysis ) ;
156+ runAnalysis ( list , currentConfig , bringOutputToFrontAfterAnalysis , outputPane ) ;
151157 }
152158
153- private void runAnalysis ( List < SourceFile > files , Configuration currentConfig , bool bringOutputToFrontAfterAnalysis )
159+ private void runAnalysis ( List < SourceFile > files , Configuration currentConfig , bool bringOutputToFrontAfterAnalysis , OutputWindowPane outputPane )
154160 {
155- _outputPane . Clear ( ) ;
161+ Debug . Assert ( outputPane != null ) ;
162+ outputPane . Clear ( ) ;
156163 var currentConfigName = currentConfig . ConfigurationName ;
157164 foreach ( var analyzer in _analyzers )
158165 {
159- analyzer . analyze ( files , _outputPane , currentConfigName . Contains ( "64" ) , currentConfigName . ToLower ( ) . Contains ( "debug" ) , bringOutputToFrontAfterAnalysis ) ;
166+ analyzer . analyze ( files , outputPane , currentConfigName . Contains ( "64" ) , currentConfigName . ToLower ( ) . Contains ( "debug" ) , bringOutputToFrontAfterAnalysis ) ;
160167 }
161168 }
162169
@@ -194,6 +201,6 @@ SourceFile createSourceFile(string filePath, Configuration targetConfig, dynamic
194201 private DocumentEvents _eventsHandlers = null ;
195202 private List < ICodeAnalyzer > _analyzers = new List < ICodeAnalyzer > ( ) ;
196203
197- private static OutputWindowPane _outputPane = null ;
204+ private static OutputWindowPane _fileAnalysisOutputPane = null , _projectAnalysisOutputPane = null ;
198205 }
199206}
0 commit comments