@@ -99,49 +99,39 @@ public void SetStatusLabelCaption(ParserState state, int? errorCount = null)
99
99
100
100
private void SetStatusLabelCaption ( string caption , int ? errorCount = null )
101
101
{
102
- //This try-catch block guarantees that problems with the COM registration of the command bar classes
103
- //only affect the status label text instead of aborting the status change or even crashing the host.
104
- //See issue #5349 at https://github.com/rubberduck-vba/Rubberduck/issues/5349
105
- try
102
+ var reparseCommandButton =
103
+ FindChildByTag ( typeof ( ReparseCommandMenuItem ) . FullName ) as ReparseCommandMenuItem ;
104
+ if ( reparseCommandButton == null )
106
105
{
107
- var reparseCommandButton =
108
- FindChildByTag ( typeof ( ReparseCommandMenuItem ) . FullName ) as ReparseCommandMenuItem ;
109
- if ( reparseCommandButton == null )
110
- {
111
- return ;
112
- }
106
+ return ;
107
+ }
113
108
114
- var showErrorsCommandButton =
115
- FindChildByTag ( typeof ( ShowParserErrorsCommandMenuItem ) . FullName ) as ShowParserErrorsCommandMenuItem ;
116
- if ( showErrorsCommandButton == null )
117
- {
118
- return ;
119
- }
109
+ var showErrorsCommandButton =
110
+ FindChildByTag ( typeof ( ShowParserErrorsCommandMenuItem ) . FullName ) as ShowParserErrorsCommandMenuItem ;
111
+ if ( showErrorsCommandButton == null )
112
+ {
113
+ return ;
114
+ }
120
115
121
- _uiDispatcher . Invoke ( ( ) =>
116
+ _uiDispatcher . Invoke ( ( ) =>
117
+ {
118
+ try
122
119
{
123
- try
120
+ reparseCommandButton . SetCaption ( caption ) ;
121
+ reparseCommandButton . SetToolTip ( string . Format ( RubberduckUI . ReparseToolTipText , caption ) ) ;
122
+ if ( errorCount . HasValue && errorCount . Value > 0 )
124
123
{
125
- reparseCommandButton . SetCaption ( caption ) ;
126
- reparseCommandButton . SetToolTip ( string . Format ( RubberduckUI . ReparseToolTipText , caption ) ) ;
127
- if ( errorCount . HasValue && errorCount . Value > 0 )
128
- {
129
- showErrorsCommandButton . SetToolTip (
130
- string . Format ( RubberduckUI . ParserErrorToolTipText , errorCount . Value ) ) ;
131
- }
124
+ showErrorsCommandButton . SetToolTip (
125
+ string . Format ( RubberduckUI . ParserErrorToolTipText , errorCount . Value ) ) ;
132
126
}
133
- catch ( Exception exception )
134
- {
135
- Logger . Error ( exception ,
136
- "Exception thrown trying to set the status label caption on the UI thread." ) ;
137
- }
138
- } ) ;
139
- Localize ( ) ;
140
- }
141
- catch ( COMException exception )
142
- {
143
- Logger . Error ( exception , "COMException thrown trying to set the status label caption." ) ;
144
- }
127
+ }
128
+ catch ( Exception exception )
129
+ {
130
+ Logger . Error ( exception ,
131
+ "Exception thrown trying to set the status label caption on the UI thread." ) ;
132
+ }
133
+ } ) ;
134
+ Localize ( ) ;
145
135
}
146
136
147
137
private void SetContextSelectionCaption ( string caption , int contextReferenceCount , string description )
0 commit comments