@@ -207,7 +207,7 @@ public static void OnMenuClick(int index)
207207 {
208208 if ( index == PluginMenuIndexAllTests )
209209 {
210- if ( connected ( ) && ! Sydba ( ) )
210+ if ( isConnected ( ) && ! isSydba ( ) )
211211 {
212212 var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
213213 Windows . Add ( testResultWindow ) ;
@@ -216,7 +216,7 @@ public static void OnMenuClick(int index)
216216 }
217217 else if ( index == PluginMenuIndexAllTestsWithCoverage )
218218 {
219- if ( connected ( ) && ! Sydba ( ) )
219+ if ( isConnected ( ) && ! isSydba ( ) )
220220 {
221221 var testResultWindow = new TestRunnerWindow ( _plugin , username , password , database , connectAs ) ;
222222 Windows . Add ( testResultWindow ) ;
@@ -225,7 +225,7 @@ public static void OnMenuClick(int index)
225225 }
226226 else if ( index == PluginPopupIndex )
227227 {
228- if ( connected ( ) && ! Sydba ( ) )
228+ if ( isConnected ( ) && ! isSydba ( ) )
229229 {
230230 getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
231231
@@ -237,7 +237,7 @@ public static void OnMenuClick(int index)
237237 }
238238 else if ( index == PluginPopupIndexWithCoverage )
239239 {
240- if ( connected ( ) && ! Sydba ( ) )
240+ if ( isConnected ( ) && ! isSydba ( ) )
241241 {
242242 getPopupObject ( out IntPtr type , out IntPtr owner , out IntPtr name , out IntPtr subType ) ;
243243
@@ -263,7 +263,7 @@ public void OpenPackageBody(string owner, string name)
263263 var source = getObjectSource ( "PACKAGE BODY" , owner , name ) ;
264264 createWindow ( 3 , Marshal . PtrToStringAnsi ( source ) , false ) ;
265265 }
266- private static bool Sydba ( )
266+ private static bool isSydba ( )
267267 {
268268 if ( connectAs . ToLower ( ) . Equals ( "sysdba" ) ) {
269269 MessageBox . Show ( "You shouldn't run utPLSQL as SYSDBA.\n \n Test will not run." , "Connected as SYSDBA" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
@@ -272,7 +272,17 @@ private static bool Sydba()
272272 return false ;
273273 }
274274
275- private static void ConnectToDatabase ( )
275+ private static bool isConnected ( )
276+ {
277+ if ( ! connected ( ) )
278+ {
279+ MessageBox . Show ( "Please connect before running tests!" , "No connection" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
280+ return false ;
281+ }
282+ return true ;
283+ }
284+
285+ private static void ConnectToDatabase ( )
276286 {
277287 try
278288 {
0 commit comments