Skip to content

Commit 5006b7c

Browse files
extend controller to handle debug action in the Connections window and editor
1 parent a6cea12 commit 5006b7c

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

sqldev/src/main/java/org/utplsql/sqldev/menu/UtplsqlController.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,28 @@ public class UtplsqlController implements Controller {
6767

6868
public static int UTPLSQL_TEST_CMD_ID = (Ide.findCmdID("utplsql.test")).intValue();
6969
public static int UTPLSQL_COVERAGE_CMD_ID = (Ide.findCmdID("utplsql.coverage")).intValue();
70+
public static int UTPLSQL_DEBUG_CMD_ID = (Ide.findCmdID("utplsql.debug")).intValue();
7071
public static int UTPLSQL_GENERATE_CMD_ID = (Ide.findCmdID("utplsql.generate")).intValue();
7172
public static final IdeAction UTPLSQL_TEST_ACTION = IdeAction.get(UTPLSQL_TEST_CMD_ID);
7273
public static final IdeAction UTPLSQL_COVERAGE_ACTION = IdeAction.get(UTPLSQL_COVERAGE_CMD_ID);
74+
public static final IdeAction UTPLSQL_DEBUG_ACTION = IdeAction.get(UTPLSQL_DEBUG_CMD_ID);
7375
public static final IdeAction UTPLSQL_GENERATE_ACTION = IdeAction.get(UTPLSQL_GENERATE_CMD_ID);
7476

7577
@Override
7678
public boolean handleEvent(final IdeAction action, final Context context) {
7779
try {
7880
if (action.getCommandId() == UTPLSQL_TEST_CMD_ID) {
7981
logger.finer(() -> "handle utplsql.test");
80-
runTest(context);
82+
runTest(context, false);
8183
return true;
8284
} else if (action.getCommandId() == UTPLSQL_COVERAGE_CMD_ID) {
8385
logger.finer(() -> "handle utplsql.coverage");
8486
codeCoverage(context);
8587
return true;
88+
} else if (action.getCommandId() == UTPLSQL_DEBUG_CMD_ID) {
89+
logger.finer(() -> "handle utplsql.debug");
90+
runTest(context, true);
91+
return true;
8692
} else if (action.getCommandId() == UTPLSQL_GENERATE_CMD_ID) {
8793
logger.finer(() -> "handle utplsql.generate");
8894
generateTest(context);
@@ -98,7 +104,8 @@ public boolean handleEvent(final IdeAction action, final Context context) {
98104

99105
@Override
100106
public boolean update(final IdeAction action, final Context context) {
101-
if (action.getCommandId() == UTPLSQL_TEST_CMD_ID || action.getCommandId() == UTPLSQL_COVERAGE_CMD_ID) {
107+
if (action.getCommandId() == UTPLSQL_TEST_CMD_ID || action.getCommandId() == UTPLSQL_COVERAGE_CMD_ID ||
108+
action.getCommandId() == UTPLSQL_DEBUG_CMD_ID) {
102109
final PreferenceModel preferences = PreferenceModel.getInstance(Preferences.getPreferences());
103110
action.setEnabled(false);
104111
final View view = context.getView();
@@ -315,7 +322,7 @@ private GenContext getGenContext(final Context context) {
315322
return genContext;
316323
}
317324

318-
public void runTest(final Context context) {
325+
public void runTest(final Context context, boolean withDebug) {
319326
final View view = context.getView();
320327
final Node node = context.getNode();
321328
final PreferenceModel preferences = PreferenceModel.getInstance(Preferences.getPreferences());
@@ -348,9 +355,15 @@ public void runTest(final Context context) {
348355
final RealtimeReporterDao rrDao = new RealtimeReporterDao(conn);
349356
if (preferences.isUseRealtimeReporter() && rrDao.isSupported()) {
350357
final UtplsqlRunner runner = new UtplsqlRunner(getPathList(path), connectionName);
358+
if (withDebug) {
359+
runner.enableDebugging(context);
360+
}
351361
runner.runTestAsync();
352362
} else {
353363
final UtplsqlWorksheetRunner worksheet = new UtplsqlWorksheetRunner(getPathList(path), connectionName);
364+
if (withDebug) {
365+
worksheet.enableDebugging();
366+
}
354367
worksheet.runTestAsync();
355368
}
356369
}
@@ -364,9 +377,15 @@ public void runTest(final Context context) {
364377
final ArrayList<String> pathList = dedupPathList(getPathList(context));
365378
if (preferences.isUseRealtimeReporter() && rrDao.isSupported()) {
366379
final UtplsqlRunner runner = new UtplsqlRunner(pathList, connectionName);
380+
if (withDebug) {
381+
runner.enableDebugging(context);
382+
}
367383
runner.runTestAsync();
368384
} else {
369385
final UtplsqlWorksheetRunner worksheet = new UtplsqlWorksheetRunner(pathList, connectionName);
386+
if (withDebug) {
387+
worksheet.enableDebugging();
388+
}
370389
worksheet.runTestAsync();
371390
}
372391
}

0 commit comments

Comments
 (0)