@@ -205,48 +205,55 @@ public static string CreateMenuItem(int index)
205205 [ DllExport ( "OnMenuClick" , CallingConvention = CallingConvention . Cdecl ) ]
206206 public static void OnMenuClick ( int index )
207207 {
208- if ( index == PluginMenuIndexAllTests )
208+ try
209209 {
210- if ( isConnected ( ) && ! isSydba ( ) )
210+ if ( index == PluginMenuIndexAllTests )
211211 {
212- var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
213- Windows . Add ( testResultWindow ) ;
214- testResultWindow . RunTestsAsync ( "_ALL" , username , null , null , false ) ;
212+ if ( isConnected ( ) && ! isSydba ( ) )
213+ {
214+ var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
215+ Windows . Add ( testResultWindow ) ;
216+ testResultWindow . RunTestsAsync ( "_ALL" , username , null , null , false ) ;
217+ }
215218 }
216- }
217- else if ( index == PluginMenuIndexAllTestsWithCoverage )
218- {
219- if ( isConnected ( ) && ! isSydba ( ) )
219+ else if ( index == PluginMenuIndexAllTestsWithCoverage )
220220 {
221- var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
222- Windows . Add ( testResultWindow ) ;
223- testResultWindow . RunTestsAsync ( "_ALL" , username , null , null , true ) ;
221+ if ( isConnected ( ) && ! isSydba ( ) )
222+ {
223+ var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
224+ Windows . Add ( testResultWindow ) ;
225+ testResultWindow . RunTestsAsync ( "_ALL" , username , null , null , true ) ;
226+ }
224227 }
225- }
226- else if ( index == PluginPopupIndex )
227- {
228- if ( isConnected ( ) && ! isSydba ( ) )
228+ else if ( index == PluginPopupIndex )
229229 {
230- getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
230+ if ( isConnected ( ) && ! isSydba ( ) )
231+ {
232+ getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
231233
232- var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
233- Windows . Add ( testResultWindow ) ;
234- testResultWindow . RunTestsAsync ( Marshal . PtrToStringAnsi ( type ) , Marshal . PtrToStringAnsi ( owner ) ,
235- Marshal . PtrToStringAnsi ( name ) , Marshal . PtrToStringAnsi ( subType ) , false ) ;
234+ var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
235+ Windows . Add ( testResultWindow ) ;
236+ testResultWindow . RunTestsAsync ( Marshal . PtrToStringAnsi ( type ) , Marshal . PtrToStringAnsi ( owner ) ,
237+ Marshal . PtrToStringAnsi ( name ) , Marshal . PtrToStringAnsi ( subType ) , false ) ;
238+ }
236239 }
237- }
238- else if ( index == PluginPopupIndexWithCoverage )
239- {
240- if ( isConnected ( ) && ! isSydba ( ) )
240+ else if ( index == PluginPopupIndexWithCoverage )
241241 {
242- getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
242+ if ( isConnected ( ) && ! isSydba ( ) )
243+ {
244+ getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
243245
244- var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
245- Windows . Add ( testResultWindow ) ;
246- testResultWindow . RunTestsAsync ( Marshal . PtrToStringAnsi ( type ) , Marshal . PtrToStringAnsi ( owner ) ,
247- Marshal . PtrToStringAnsi ( name ) , Marshal . PtrToStringAnsi ( subType ) , true ) ;
246+ var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
247+ Windows . Add ( testResultWindow ) ;
248+ testResultWindow . RunTestsAsync ( Marshal . PtrToStringAnsi ( type ) , Marshal . PtrToStringAnsi ( owner ) ,
249+ Marshal . PtrToStringAnsi ( name ) , Marshal . PtrToStringAnsi ( subType ) , true ) ;
250+ }
248251 }
249252 }
253+ catch ( Exception e )
254+ {
255+ MessageBox . Show ( $ "{ e . Message } \n \n { e . StackTrace } ", "Unexpected Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
256+ }
250257 }
251258
252259 [ DllExport ( "About" , CallingConvention = CallingConvention . Cdecl ) ]
@@ -265,7 +272,8 @@ public void OpenPackageBody(string owner, string name)
265272 }
266273 private static bool isSydba ( )
267274 {
268- if ( connectAs . ToLower ( ) . Equals ( "sysdba" ) ) {
275+ if ( connectAs . ToLower ( ) . Equals ( "sysdba" ) )
276+ {
269277 MessageBox . Show ( "You shouldn't run utPLSQL as SYSDBA.\n \n Test will not run." , "Connected as SYSDBA" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
270278 return true ;
271279 }
@@ -282,7 +290,7 @@ private static bool isConnected()
282290 return true ;
283291 }
284292
285- private static void ConnectToDatabase ( )
293+ private static void ConnectToDatabase ( )
286294 {
287295 try
288296 {
0 commit comments