@@ -164,54 +164,58 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
164164
165165 // Add our command handlers for menu (commands must exist in the .vsct file)
166166 OleMenuCommandService mcs = await GetServiceAsync ( typeof ( IMenuCommandService ) ) as OleMenuCommandService ;
167- if ( null != mcs )
167+ if ( mcs == null )
168168 {
169- // Create the command for the menu item.
170- {
171- CommandID menuCommandID = new CommandID ( GuidList . guidCPPCheckPluginCmdSet , ( int ) PkgCmdIDList . cmdidCheckProjectCppcheck ) ;
172- menuCheckCurrentProject = new MenuCommand ( onCheckCurrentProjectRequested , menuCommandID ) ;
173- mcs . AddCommand ( menuCheckCurrentProject ) ;
174- }
169+ Debug . Assert ( mcs != null ) ;
170+ return ;
171+ }
175172
176- {
177- // Create the command for the settings window
178- CommandID settingsWndCmdId = new CommandID ( GuidList . guidCPPCheckPluginCmdSet , ( int ) PkgCmdIDList . cmdidSettings ) ;
179- menuShowSettingsWindow = new MenuCommand ( onSettingsWindowRequested , settingsWndCmdId ) ;
180- mcs . AddCommand ( menuShowSettingsWindow ) ;
181- }
173+
174+ // Create the command for the menu item.
175+ {
176+ CommandID menuCommandID = new CommandID ( GuidList . guidCPPCheckPluginCmdSet , ( int ) PkgCmdIDList . cmdidCheckProjectCppcheck ) ;
177+ menuCheckCurrentProject = new MenuCommand ( onCheckCurrentProjectRequested , menuCommandID ) ;
178+ mcs . AddCommand ( menuCheckCurrentProject ) ;
179+ }
182180
183- {
184- CommandID stopCheckMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginCmdSet , ( int ) PkgCmdIDList . cmdidStopCppcheck ) ;
185- menuCancelCheck = new MenuCommand ( onStopCheckRequested , stopCheckMenuCommandID ) ;
186- mcs . AddCommand ( menuCancelCheck ) ;
187- }
181+ {
182+ // Create the command for the settings window
183+ CommandID settingsWndCmdId = new CommandID ( GuidList . guidCPPCheckPluginCmdSet , ( int ) PkgCmdIDList . cmdidSettings ) ;
184+ menuShowSettingsWindow = new MenuCommand ( onSettingsWindowRequested , settingsWndCmdId ) ;
185+ mcs . AddCommand ( menuShowSettingsWindow ) ;
186+ }
188187
189- {
190- CommandID selectionsMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginCmdSet , ( int ) PkgCmdIDList . cmdidCheckMultiItemCppcheck ) ;
191- menuCheckSelections = new MenuCommand ( onCheckSelectionsRequested , selectionsMenuCommandID ) ;
192- mcs . AddCommand ( menuCheckSelections ) ;
193- }
188+ {
189+ CommandID stopCheckMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginCmdSet , ( int ) PkgCmdIDList . cmdidStopCppcheck ) ;
190+ menuCancelCheck = new MenuCommand ( onStopCheckRequested , stopCheckMenuCommandID ) ;
191+ mcs . AddCommand ( menuCancelCheck ) ;
192+ }
194193
195- {
196- CommandID projectMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginProjectCmdSet , ( int ) PkgCmdIDList . cmdidCheckProjectCppcheck1 ) ;
197- menuCheckCurrentProjectContext = new MenuCommand ( onCheckCurrentProjectRequested , projectMenuCommandID ) ;
198- mcs . AddCommand ( menuCheckCurrentProjectContext ) ;
199- }
194+ {
195+ CommandID selectionsMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginCmdSet , ( int ) PkgCmdIDList . cmdidCheckMultiItemCppcheck ) ;
196+ menuCheckSelections = new MenuCommand ( onCheckSelectionsRequested , selectionsMenuCommandID ) ;
197+ mcs . AddCommand ( menuCheckSelections ) ;
198+ }
200199
201- {
202- CommandID projectsMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginMultiProjectCmdSet , ( int ) PkgCmdIDList . cmdidCheckProjectsCppcheck ) ;
203- menuCheckCurrentProjectsContext = new MenuCommand ( onCheckAllProjectsRequested , projectsMenuCommandID ) ;
204- mcs . AddCommand ( menuCheckCurrentProjectsContext ) ;
205- }
200+ {
201+ CommandID projectMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginProjectCmdSet , ( int ) PkgCmdIDList . cmdidCheckProjectCppcheck1 ) ;
202+ menuCheckCurrentProjectContext = new MenuCommand ( onCheckCurrentProjectRequested , projectMenuCommandID ) ;
203+ mcs . AddCommand ( menuCheckCurrentProjectContext ) ;
204+ }
206205
207- {
208- CommandID selectionsMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginMultiItemProjectCmdSet , ( int ) PkgCmdIDList . cmdidCheckMultiItemCppcheck1 ) ;
209- checkMultiSelections = new MenuCommand ( onCheckSelectionsRequested , selectionsMenuCommandID ) ;
210- mcs . AddCommand ( checkMultiSelections ) ;
211- }
206+ {
207+ CommandID projectsMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginMultiProjectCmdSet , ( int ) PkgCmdIDList . cmdidCheckProjectsCppcheck ) ;
208+ menuCheckCurrentProjectsContext = new MenuCommand ( onCheckAllProjectsRequested , projectsMenuCommandID ) ;
209+ mcs . AddCommand ( menuCheckCurrentProjectsContext ) ;
210+ }
212211
213- setMenuState ( false ) ;
212+ {
213+ CommandID selectionsMenuCommandID = new CommandID ( GuidList . guidCPPCheckPluginMultiItemProjectCmdSet , ( int ) PkgCmdIDList . cmdidCheckMultiItemCppcheck1 ) ;
214+ checkMultiSelections = new MenuCommand ( onCheckSelectionsRequested , selectionsMenuCommandID ) ;
215+ mcs . AddCommand ( checkMultiSelections ) ;
214216 }
217+
218+ setMenuState ( false ) ;
215219 }
216220
217221 protected override void Dispose ( bool disposing )
0 commit comments