Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4f27db1

Browse filesBrowse files
extend context menu, enable it on header row and apply filter
1 parent 6d20605 commit 4f27db1
Copy full SHA for 4f27db1

File tree

1 file changed

+49
-1
lines changed
Filter options

1 file changed

+49
-1
lines changed

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

Copy file name to clipboardExpand all lines: sqldev/src/main/java/org/utplsql/sqldev/ui/runner/RunnerPanel.xtend
+49-1Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import javax.swing.JSplitPane
4545
import javax.swing.JTabbedPane
4646
import javax.swing.JTable
4747
import javax.swing.RepaintManager
48+
import javax.swing.RowFilter
4849
import javax.swing.SwingConstants
4950
import javax.swing.Timer
5051
import javax.swing.UIManager
@@ -55,6 +56,7 @@ import javax.swing.event.ListSelectionEvent
5556
import javax.swing.event.ListSelectionListener
5657
import javax.swing.plaf.basic.BasicProgressBarUI
5758
import javax.swing.table.DefaultTableCellRenderer
59+
import javax.swing.table.TableRowSorter
5860
import oracle.dbtools.raptor.controls.grid.DefaultDrillLink
5961
import oracle.dbtools.raptor.utils.Connections
6062
import oracle.ide.config.Preferences
@@ -105,6 +107,8 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
105107
JCheckBoxMenuItem showTestDescriptionCheckBoxMenuItem
106108
JCheckBoxMenuItem showWarningIndicatorCheckBoxMenuItem
107109
JCheckBoxMenuItem showInfoIndicatorCheckBoxMenuItem
110+
JCheckBoxMenuItem showSuccessfulTestsCheckBoxMenuItem
111+
JCheckBoxMenuItem showDisabledTestsCheckBoxMenuItem
108112
JCheckBoxMenuItem syncDetailTabCheckBoxMenuItem
109113
RunnerTextField testOwnerTextField
110114
RunnerTextField testPackageTextField
@@ -220,6 +224,30 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
220224
col.preferredWidth = 0
221225
}
222226
}
227+
228+
private def applyFilter(boolean showSuccessfulTests, boolean showDisabledTests) {
229+
val sorter = testOverviewTable.rowSorter as TableRowSorter<TestOverviewTableModel>
230+
val filter = new RowFilter<TestOverviewTableModel, Integer>() {
231+
override include(Entry<? extends TestOverviewTableModel, ? extends Integer> entry) {
232+
val test = entry.model.getTest(entry.identifier)
233+
val counter = test.counter
234+
if (counter !== null) {
235+
if (counter.success > 0) {
236+
if (!showSuccessfulTests) {
237+
return false
238+
}
239+
}
240+
if (counter.disabled > 0) {
241+
if (!showDisabledTests) {
242+
return false
243+
}
244+
}
245+
}
246+
return true
247+
}
248+
}
249+
sorter.rowFilter = filter
250+
}
223251

224252
private def openSelectedTest() {
225253
val rowIndex = testOverviewTable.selectedRow
@@ -338,6 +366,9 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
338366
fixCheckBoxMenuItem(showWarningIndicatorCheckBoxMenuItem)
339367
showInfoIndicatorCheckBoxMenuItem.selected = preferences.showInfoIndicator
340368
applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem.selected)
369+
showSuccessfulTestsCheckBoxMenuItem.selected = preferences.showSuccessfulTests
370+
showDisabledTestsCheckBoxMenuItem.selected = preferences.showDisabledTests
371+
applyFilter(showSuccessfulTestsCheckBoxMenuItem.selected, showDisabledTestsCheckBoxMenuItem.selected)
341372
fixCheckBoxMenuItem(showInfoIndicatorCheckBoxMenuItem)
342373
syncDetailTabCheckBoxMenuItem.selected = preferences.syncDetailTab
343374
fixCheckBoxMenuItem(syncDetailTabCheckBoxMenuItem)
@@ -380,10 +411,13 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
380411
testOverviewTableModel.fireTableDataChanged
381412
} else {
382413
if (testOverviewTableModel.rowCount > row) {
383-
val positionOfCurrentTest = testOverviewTable.getCellRect(row, 0, true);
414+
val positionOfCurrentTest = testOverviewTable.getCellRect(testOverviewTable.convertRowIndexToView(row), 0, true);
384415
testOverviewTable.scrollRectToVisible = positionOfCurrentTest
385416
testOverviewTableModel.fireTableRowsUpdated(row, row)
386417
Thread.sleep(5) // reduce flickering
418+
if (!showSuccessfulTestsCheckBoxMenuItem.selected || !showDisabledTestsCheckBoxMenuItem.selected) {
419+
applyFilter(showSuccessfulTestsCheckBoxMenuItem.selected, showDisabledTestsCheckBoxMenuItem.selected)
420+
}
387421
testOverviewTable.scrollRectToVisible = positionOfCurrentTest
388422
}
389423
}
@@ -485,6 +519,12 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
485519
} else if (e.source == showInfoCounterCheckBoxMenuItem) {
486520
applyShowInfoCounter(showInfoCounterCheckBoxMenuItem.selected)
487521
fixCheckBoxMenuItem(showInfoCounterCheckBoxMenuItem)
522+
} else if (e.source == showSuccessfulTestsCheckBoxMenuItem) {
523+
applyFilter(showSuccessfulTestsCheckBoxMenuItem.selected, showDisabledTestsCheckBoxMenuItem.selected)
524+
fixCheckBoxMenuItem(showSuccessfulTestsCheckBoxMenuItem)
525+
} else if (e.source == showDisabledTestsCheckBoxMenuItem) {
526+
applyFilter(showSuccessfulTestsCheckBoxMenuItem.selected, showDisabledTestsCheckBoxMenuItem.selected)
527+
fixCheckBoxMenuItem(showDisabledTestsCheckBoxMenuItem)
488528
} else if (e.source == showTestDescriptionCheckBoxMenuItem) {
489529
applyShowTestDescription(showTestDescriptionCheckBoxMenuItem.selected)
490530
fixCheckBoxMenuItem(showTestDescriptionCheckBoxMenuItem)
@@ -943,6 +983,13 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
943983
testOverviewRunWorksheetMenuItem.addActionListener(this)
944984
testOverviewPopupMenu.add(testOverviewRunWorksheetMenuItem)
945985
testOverviewPopupMenu.add(new JSeparator)
986+
showSuccessfulTestsCheckBoxMenuItem = new JCheckBoxMenuItem(UtplsqlResources.getString("PREF_SHOW_SUCCESSFUL_TESTS_LABEL").replace("?",""), true)
987+
showSuccessfulTestsCheckBoxMenuItem.addActionListener(this)
988+
testOverviewPopupMenu.add(showSuccessfulTestsCheckBoxMenuItem)
989+
showDisabledTestsCheckBoxMenuItem = new JCheckBoxMenuItem(UtplsqlResources.getString("PREF_SHOW_DISABLED_TESTS_LABEL").replace("?",""), true)
990+
showDisabledTestsCheckBoxMenuItem.addActionListener(this)
991+
testOverviewPopupMenu.add(showDisabledTestsCheckBoxMenuItem)
992+
testOverviewPopupMenu.add(new JSeparator)
946993
showTestDescriptionCheckBoxMenuItem = new JCheckBoxMenuItem(UtplsqlResources.getString("PREF_SHOW_TEST_DESCRIPTION_LABEL").replace("?",""), true)
947994
showTestDescriptionCheckBoxMenuItem.addActionListener(this)
948995
testOverviewPopupMenu.add(showTestDescriptionCheckBoxMenuItem)
@@ -956,6 +1003,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
9561003
syncDetailTabCheckBoxMenuItem.addActionListener(this)
9571004
testOverviewPopupMenu.add(syncDetailTabCheckBoxMenuItem)
9581005
testOverviewTable.componentPopupMenu = testOverviewPopupMenu
1006+
testOverviewTable.tableHeader.componentPopupMenu = testOverviewPopupMenu
9591007

9601008
// Test tabbed pane (Test Properties)
9611009
val testInfoPanel = new ScrollablePanel

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.