Skip to content

Commit 150ae40

Browse files
committed
Check if user is connected before trying to run the tests
1 parent f825b4e commit 150ae40

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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\nTest 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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy