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 db906e7

Browse filesBrowse files
add running elapsed time at the end of the status line
1 parent b5620dd commit db906e7
Copy full SHA for db906e7

File tree

Expand file treeCollapse file tree

1 file changed

+39
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+39
-5
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
+39-5Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import javax.swing.JTabbedPane
4646
import javax.swing.JTable
4747
import javax.swing.RepaintManager
4848
import javax.swing.SwingConstants
49+
import javax.swing.Timer
4950
import javax.swing.UIManager
5051
import javax.swing.border.EmptyBorder
5152
import javax.swing.event.HyperlinkEvent
@@ -85,6 +86,8 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
8586
ToolbarButton clearButton
8687
JComboBox<ComboBoxItem<String, String>> runComboBox
8788
JLabel statusLabel
89+
JLabel elapsedTimeLabel
90+
Timer elapsedTimeTimer
8891
JLabel testCounterValueLabel
8992
JLabel errorCounterValueLabel
9093
JLabel failureCounterValueLabel
@@ -360,6 +363,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
360363
resetDerived
361364
val item = new ComboBoxItem<String, String>(currentRun.reporterId, currentRun.name)
362365
runComboBox.selectedItem = item
366+
elapsedTimeTimer.start
363367
}
364368
}
365369

@@ -765,7 +769,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
765769
toolbar.add(clearButton)
766770
c.gridx = 0
767771
c.gridy = 0
768-
c.gridwidth = 1
772+
c.gridwidth = 2
769773
c.gridheight = 1
770774
c.insets = new Insets(0, 0, 0, 0) // top, left, bottom, right
771775
c.anchor = GridBagConstraints::NORTH
@@ -780,12 +784,42 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
780784
c.gridy = 1
781785
c.gridwidth = 1
782786
c.gridheight = 1
783-
c.insets = new Insets(10, 10, 10, 10) // top, left, bottom, right
787+
c.insets = new Insets(10, 10, 10, 0) // top, left, bottom, right
784788
c.anchor = GridBagConstraints::WEST
785789
c.fill = GridBagConstraints::HORIZONTAL
786790
c.weightx = 1
787791
c.weighty = 0
788792
basePanel.add(statusLabel, c)
793+
elapsedTimeLabel = new JLabel
794+
elapsedTimeLabel.preferredSize = new Dimension(60, 0)
795+
c.gridx = 1
796+
c.gridy = 1
797+
c.gridwidth = 1
798+
c.gridheight = 1
799+
c.insets = new Insets(10, 10, 10, 10) // top, left, bottom, right
800+
c.anchor = GridBagConstraints::WEST
801+
c.fill = GridBagConstraints::NONE
802+
c.weightx = 0
803+
c.weighty = 0
804+
basePanel.add(elapsedTimeLabel, c)
805+
elapsedTimeTimer = new Timer(100, new ActionListener() {
806+
override actionPerformed(ActionEvent e) {
807+
if (currentRun !== null && currentRun.start !== null) {
808+
val time = new SmartTime
809+
time.smart = useSmartTimes
810+
if (currentRun.executionTime !== null) {
811+
time.seconds = currentRun.executionTime
812+
elapsedTimeTimer.stop
813+
} else {
814+
val long now = System.currentTimeMillis
815+
time.seconds = new Double(now - currentRun.start) / 1000
816+
}
817+
elapsedTimeLabel.text = '''«time.toString»«IF !useSmartTimes» s«ENDIF»'''
818+
} else {
819+
elapsedTimeLabel.text = null
820+
}
821+
}
822+
})
789823

790824
// Counters
791825
// - Test counter
@@ -822,7 +856,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
822856
// - add everything to basePanel
823857
c.gridx = 0
824858
c.gridy = 2
825-
c.gridwidth = 1
859+
c.gridwidth = 2
826860
c.gridheight = 1
827861
c.insets = new Insets(5, 0, 5, 0) // top, left, bottom, right
828862
c.anchor = GridBagConstraints::WEST
@@ -854,7 +888,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
854888
progressBar.UI = new BasicProgressBarUI
855889
c.gridx = 0
856890
c.gridy = 3
857-
c.gridwidth = 1
891+
c.gridwidth = 2
858892
c.gridheight = 1
859893
c.insets = new Insets(10, 10, 10, 10) // top, left, bottom, right
860894
c.anchor = GridBagConstraints::WEST
@@ -1206,7 +1240,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
12061240
horizontalSplitPane.resizeWeight = 0.5
12071241
c.gridx = 0
12081242
c.gridy = 4
1209-
c.gridwidth = 1
1243+
c.gridwidth = 2
12101244
c.gridheight = 1
12111245
c.insets = new Insets(10, 10, 10, 10) // top, left, bottom, right
12121246
c.anchor = GridBagConstraints::WEST

0 commit comments

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