Skip to content

Commit ec7d68d

Browse files
add sync detail tab context menu item honoring preferences
1 parent af316da commit ec7d68d

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

sqldev/src/main/java/org/utplsql/sqldev/ui/runner/RunnerPanel.xtend

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class RunnerPanel implements FocusListener, ActionListener {
9090
JMenuItem testOverviewRunWorksheetMenuItem
9191
JCheckBoxMenuItem showWarningIndicatorCheckBoxMenuItem
9292
JCheckBoxMenuItem showInfoIndicatorCheckBoxMenuItem
93+
JCheckBoxMenuItem syncDetailTabCheckBoxMenuItem
9394
JTextArea testIdTextArea
9495
JTextField testOwnerTextField
9596
JTextField testPackageTextField
@@ -190,6 +191,29 @@ class RunnerPanel implements FocusListener, ActionListener {
190191
}
191192
}
192193

194+
private def syncDetailTab() {
195+
if (syncDetailTabCheckBoxMenuItem.selected) {
196+
val rowIndex = testOverviewTable.selectedRow
197+
if (rowIndex != -1) {
198+
val row = testOverviewTable.convertRowIndexToModel(rowIndex)
199+
val test = testOverviewTableModel.getTest(row)
200+
var int tabIndex
201+
if (test.counter?.failure !== null && test.counter.failure > 0) {
202+
tabIndex = 1
203+
} else if (test.counter?.error !== null && test.counter.error > 0) {
204+
tabIndex = 2
205+
} else if (test.counter?.warning !== null && test.counter.warning > 0) {
206+
tabIndex = 3
207+
} else if (test.serverOutput !== null && test.serverOutput.length > 0) {
208+
tabIndex = 4
209+
} else {
210+
tabIndex = 0
211+
}
212+
testDetailTabbedPane.selectedIndex = tabIndex
213+
}
214+
}
215+
}
216+
193217
private def getPreferenceModel() {
194218
var PreferenceModel preferences
195219
try {
@@ -212,6 +236,7 @@ class RunnerPanel implements FocusListener, ActionListener {
212236
applyShowWarningIndicator(showWarningIndicatorCheckBoxMenuItem.selected)
213237
showInfoIndicatorCheckBoxMenuItem.selected = preferences.showInfoIndicator
214238
applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem.selected)
239+
syncDetailTabCheckBoxMenuItem.selected = preferences.syncDetailTab
215240
}
216241

217242
def setModel(Run run) {
@@ -350,6 +375,8 @@ class RunnerPanel implements FocusListener, ActionListener {
350375
applyShowWarningIndicator(showWarningIndicatorCheckBoxMenuItem.selected)
351376
} else if (e.source == showInfoIndicatorCheckBoxMenuItem) {
352377
applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem.selected)
378+
} else if (e.source == syncDetailTabCheckBoxMenuItem) {
379+
syncDetailTab
353380
}
354381
}
355382

@@ -393,19 +420,7 @@ class RunnerPanel implements FocusListener, ActionListener {
393420
p.testErrorStackTextArea.text = test.errorStack?.trim
394421
p.testWarningsTextArea.text = test.warnings?.trim
395422
p.testServerOutputTextArea.text = test.serverOutput?.trim
396-
var int tabIndex
397-
if (test.counter?.failure !== null && test.counter.failure > 0) {
398-
tabIndex = 1
399-
} else if (test.counter?.error !== null && test.counter.error > 0) {
400-
tabIndex = 2
401-
} else if (test.counter?.warning !== null && test.counter.warning > 0) {
402-
tabIndex = 3
403-
} else if (test.serverOutput !== null && test.serverOutput.length > 0) {
404-
tabIndex = 4
405-
} else {
406-
tabIndex = 0
407-
}
408-
p.testDetailTabbedPane.selectedIndex = tabIndex
423+
p.syncDetailTab
409424
p.testOverviewRunMenuItem.enabled = true
410425
p.testOverviewRunWorksheetMenuItem.enabled = true
411426
}
@@ -698,6 +713,10 @@ class RunnerPanel implements FocusListener, ActionListener {
698713
showInfoIndicatorCheckBoxMenuItem.selected = true
699714
showInfoIndicatorCheckBoxMenuItem.addActionListener(this)
700715
testOverviewPopupMenu.add(showInfoIndicatorCheckBoxMenuItem)
716+
syncDetailTabCheckBoxMenuItem = new JCheckBoxMenuItem(UtplsqlResources.getString("PREF_SYNC_DETAIL_TAB_LABEL").replace("?",""))
717+
syncDetailTabCheckBoxMenuItem.selected = true
718+
syncDetailTabCheckBoxMenuItem.addActionListener(this)
719+
testOverviewPopupMenu.add(syncDetailTabCheckBoxMenuItem)
701720
testOverviewTable.componentPopupMenu = testOverviewPopupMenu
702721

703722
// Test tabbed pane (Test Properties)

0 commit comments

Comments
 (0)