@@ -30,6 +30,7 @@ import java.text.DecimalFormat
3030import java.util.ArrayList
3131import javax.swing.Box
3232import javax.swing.DefaultComboBoxModel
33+ import javax.swing.JCheckBoxMenuItem
3334import javax.swing.JComboBox
3435import javax.swing.JComponent
3536import javax.swing.JLabel
@@ -38,6 +39,7 @@ import javax.swing.JPanel
3839import javax.swing.JPopupMenu
3940import javax.swing.JProgressBar
4041import javax.swing.JScrollPane
42+ import javax.swing.JSeparator
4143import javax.swing.JSplitPane
4244import javax.swing.JTabbedPane
4345import javax.swing.JTable
@@ -49,8 +51,10 @@ import javax.swing.event.ListSelectionEvent
4951import javax.swing.event.ListSelectionListener
5052import javax.swing.plaf.basic.BasicProgressBarUI
5153import javax.swing.table.DefaultTableCellRenderer
54+ import oracle.ide.config.Preferences
5255import oracle.javatools.ui.table.ToolbarButton
5356import org.utplsql.sqldev.model.LimitedLinkedHashMap
57+ import org.utplsql.sqldev.model.preference.PreferenceModel
5458import org.utplsql.sqldev.model.runner.Run
5559import org.utplsql.sqldev.resources.UtplsqlResources
5660import org.utplsql.sqldev.runner.UtplsqlRunner
@@ -59,6 +63,7 @@ import org.utplsql.sqldev.runner.UtplsqlWorksheetRunner
5963class RunnerPanel implements FocusListener , ActionListener {
6064 static val GREEN = new Color (0 , 153 , 0 )
6165 static val RED = new Color (153 , 0 , 0 )
66+ static val INDICATOR_WIDTH = 20
6267 LimitedLinkedHashMap<String , Run > runs = new LimitedLinkedHashMap<String , Run > (10 )
6368 Run currentRun
6469 JPanel basePanel
@@ -75,11 +80,16 @@ class RunnerPanel implements FocusListener, ActionListener {
7580 JLabel disabledCounterValueLabel
7681 JLabel warningsCounterValueLabel
7782 JLabel infoCounterValueLabel
83+ JCheckBoxMenuItem showDisabledCounterCheckBoxMenuItem
84+ JCheckBoxMenuItem showWarningsCounterCheckBoxMenuItem
85+ JCheckBoxMenuItem showInfoCounterCheckBoxMenuItem
7886 JProgressBar progressBar;
7987 TestOverviewTableModel testOverviewTableModel
8088 JTable testOverviewTable
8189 JMenuItem testOverviewRunMenuItem
8290 JMenuItem testOverviewRunWorksheetMenuItem
91+ JCheckBoxMenuItem showWarningIndicatorCheckBoxMenuItem
92+ JCheckBoxMenuItem showInfoIndicatorCheckBoxMenuItem
8393 JTextArea testIdTextArea
8494 JTextField testOwnerTextField
8595 JTextField testPackageTextField
@@ -134,6 +144,72 @@ class RunnerPanel implements FocusListener, ActionListener {
134144 runComboBox. addActionListener(this )
135145 }
136146 }
147+
148+ private def applyShowDisabledCounter (boolean show ) {
149+ disabledCounterValueLabel. parent. visible = showDisabledCounterCheckBoxMenuItem. selected
150+ }
151+
152+ private def applyShowWarningsCounter (boolean show ) {
153+ warningsCounterValueLabel. parent. visible = showWarningsCounterCheckBoxMenuItem. selected
154+ }
155+
156+ private def applyShowInfoCounter (boolean show ) {
157+ infoCounterValueLabel. parent. visible = showInfoCounterCheckBoxMenuItem. selected
158+ }
159+
160+ private def applyShowWarningIndicator (boolean show ) {
161+ val col = testOverviewTable. columnModel. getColumn(1 )
162+ if (show) {
163+ col. width = INDICATOR_WIDTH
164+ col. minWidth = INDICATOR_WIDTH
165+ col. maxWidth = INDICATOR_WIDTH
166+ col. preferredWidth = INDICATOR_WIDTH
167+ } else {
168+ col. width = 0
169+ col. minWidth = 0
170+ col. maxWidth = 0
171+ col. preferredWidth = 0
172+ }
173+ }
174+
175+ private def applyShowInfoIndicator (boolean show ) {
176+ val col = testOverviewTable. columnModel. getColumn(2 )
177+ if (show) {
178+ col. width = INDICATOR_WIDTH
179+ col. minWidth = INDICATOR_WIDTH
180+ col. maxWidth = INDICATOR_WIDTH
181+ col. preferredWidth = INDICATOR_WIDTH
182+ } else {
183+ col. width = 0
184+ col. minWidth = 0
185+ col. maxWidth = 0
186+ col. preferredWidth = 0
187+ }
188+ }
189+
190+ private def getPreferenceModel () {
191+ var PreferenceModel preferences
192+ try {
193+ preferences = PreferenceModel . getInstance(Preferences . preferences)
194+ } catch (NoClassDefFoundError e) {
195+ preferences = PreferenceModel . getInstance(null )
196+ }
197+ return preferences
198+ }
199+
200+ private def applyPreferences () {
201+ val PreferenceModel preferences = preferenceModel
202+ showDisabledCounterCheckBoxMenuItem. selected = preferences. showDisabledCounter
203+ applyShowDisabledCounter(showDisabledCounterCheckBoxMenuItem. selected)
204+ showWarningsCounterCheckBoxMenuItem. selected = preferences. showWarningsCounter
205+ applyShowWarningsCounter(showWarningsCounterCheckBoxMenuItem. selected)
206+ showInfoCounterCheckBoxMenuItem. selected = preferences. showInfoCounter
207+ applyShowInfoCounter(showInfoCounterCheckBoxMenuItem. selected)
208+ showWarningIndicatorCheckBoxMenuItem. selected = preferences. showWarningIndicator
209+ applyShowWarningIndicator(showWarningIndicatorCheckBoxMenuItem. selected)
210+ showInfoIndicatorCheckBoxMenuItem. selected = preferences. showInfoIndicator
211+ applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem. selected)
212+ }
137213
138214 def setModel (Run run ) {
139215 runs. put(run. reporterId, run)
@@ -261,6 +337,16 @@ class RunnerPanel implements FocusListener, ActionListener {
261337 } else if (e. source == testOverviewRunWorksheetMenuItem) {
262338 val worksheet = new UtplsqlWorksheetRunner (pathListFromSelectedTests, currentRun. connectionName)
263339 worksheet. runTestAsync
340+ } else if (e. source == showDisabledCounterCheckBoxMenuItem) {
341+ applyShowDisabledCounter(showDisabledCounterCheckBoxMenuItem. selected)
342+ } else if (e. source == showWarningsCounterCheckBoxMenuItem) {
343+ applyShowWarningsCounter( showWarningsCounterCheckBoxMenuItem. selected)
344+ } else if (e. source == showInfoCounterCheckBoxMenuItem) {
345+ applyShowInfoCounter(showInfoCounterCheckBoxMenuItem. selected)
346+ } else if (e. source == showWarningIndicatorCheckBoxMenuItem) {
347+ applyShowWarningIndicator(showWarningIndicatorCheckBoxMenuItem. selected)
348+ } else if (e. source == showInfoIndicatorCheckBoxMenuItem) {
349+ applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem. selected)
264350 }
265351 }
266352
@@ -523,6 +609,22 @@ class RunnerPanel implements FocusListener, ActionListener {
523609 c. weightx = 1
524610 c. weighty = 0
525611 basePanel. add(counterPanel,c)
612+
613+ // Context menu for counters panel
614+ val countersPopupMenu = new JPopupMenu
615+ showDisabledCounterCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_DISABLED_COUNTER_LABEL" ). replace(" ?" ," " ))
616+ showDisabledCounterCheckBoxMenuItem. selected = true
617+ showDisabledCounterCheckBoxMenuItem. addActionListener(this )
618+ countersPopupMenu. add(showDisabledCounterCheckBoxMenuItem)
619+ showWarningsCounterCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_WARNINGS_COUNTER_LABEL" ). replace(" ?" ," " ))
620+ showWarningsCounterCheckBoxMenuItem. selected = true
621+ showWarningsCounterCheckBoxMenuItem. addActionListener(this )
622+ countersPopupMenu. add(showWarningsCounterCheckBoxMenuItem)
623+ showInfoCounterCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_INFO_COUNTER_LABEL" ). replace(" ?" ," " ))
624+ showInfoCounterCheckBoxMenuItem. selected = true
625+ showInfoCounterCheckBoxMenuItem. addActionListener(this )
626+ countersPopupMenu. add(showInfoCounterCheckBoxMenuItem)
627+ counterPanel. componentPopupMenu = countersPopupMenu
526628
527629 // Progress bar
528630 progressBar = new JProgressBar
@@ -551,19 +653,19 @@ class RunnerPanel implements FocusListener, ActionListener {
551653 testOverviewTable. selectionModel. addListSelectionListener(new TestOverviewRowListener (this ))
552654 val testTableHeaderRenderer = new TestTableHeaderRenderer
553655 val overviewTableStatus = testOverviewTable. columnModel. getColumn(0 )
554- overviewTableStatus. minWidth = 20
555- overviewTableStatus. preferredWidth = 20
556- overviewTableStatus. maxWidth = 20
656+ overviewTableStatus. minWidth = INDICATOR_WIDTH
657+ overviewTableStatus. preferredWidth = INDICATOR_WIDTH
658+ overviewTableStatus. maxWidth = INDICATOR_WIDTH
557659 overviewTableStatus. headerRenderer = testTableHeaderRenderer
558660 val overviewTableWarning = testOverviewTable. columnModel. getColumn(1 )
559- overviewTableWarning. minWidth = 20
560- overviewTableWarning. preferredWidth = 20
561- overviewTableWarning. maxWidth = 20
661+ overviewTableWarning. minWidth = INDICATOR_WIDTH
662+ overviewTableWarning. preferredWidth = INDICATOR_WIDTH
663+ overviewTableWarning. maxWidth = INDICATOR_WIDTH
562664 overviewTableWarning. headerRenderer = testTableHeaderRenderer
563665 val overviewTableInfo = testOverviewTable. columnModel. getColumn(2 )
564- overviewTableInfo. minWidth = 20
565- overviewTableInfo. preferredWidth = 20
566- overviewTableInfo. maxWidth = 20
666+ overviewTableInfo. minWidth = INDICATOR_WIDTH
667+ overviewTableInfo. preferredWidth = INDICATOR_WIDTH
668+ overviewTableInfo. maxWidth = INDICATOR_WIDTH
567669 overviewTableInfo. headerRenderer = testTableHeaderRenderer
568670 val overviewTableId = testOverviewTable. columnModel. getColumn(3 )
569671 overviewTableId. headerRenderer = testTableHeaderRenderer
@@ -584,8 +686,17 @@ class RunnerPanel implements FocusListener, ActionListener {
584686 testOverviewRunWorksheetMenuItem = new JMenuItem (" Run test in new worksheet" , UtplsqlResources . getIcon(" RUN_WORKSHEET_ICON" ));
585687 testOverviewRunWorksheetMenuItem. addActionListener(this )
586688 testOverviewPopupMenu. add(testOverviewRunWorksheetMenuItem)
689+ testOverviewPopupMenu. add(new JSeparator )
690+ showWarningIndicatorCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_WARNING_INDICATOR_LABEL" ). replace(" ?" ," " ))
691+ showWarningIndicatorCheckBoxMenuItem. selected = true
692+ showWarningIndicatorCheckBoxMenuItem. addActionListener(this )
693+ testOverviewPopupMenu. add(showWarningIndicatorCheckBoxMenuItem)
694+ showInfoIndicatorCheckBoxMenuItem = new JCheckBoxMenuItem (UtplsqlResources . getString(" PREF_SHOW_INFO_INDICATOR_LABEL" ). replace(" ?" ," " ))
695+ showInfoIndicatorCheckBoxMenuItem. selected = true
696+ showInfoIndicatorCheckBoxMenuItem. addActionListener(this )
697+ testOverviewPopupMenu. add(showInfoIndicatorCheckBoxMenuItem)
587698 testOverviewTable. componentPopupMenu = testOverviewPopupMenu
588-
699+
589700 // Test tabbed pane (Test Properties)
590701 // - Id
591702 val testInfoPanel = new ScrollablePanel
@@ -897,5 +1008,6 @@ class RunnerPanel implements FocusListener, ActionListener {
8971008 c. weightx = 1
8981009 c. weighty = 1
8991010 basePanel. add(horizontalSplitPane, c)
1011+ applyPreferences
9001012 }
9011013}
0 commit comments