Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitd840aec

Browse files
Merge pull request#78 from PhilippSalvisberg/67_smart_time_unit
#67 - Use smart time (configurable)
2 parents86445e6 +66126b8 commitd840aec

File tree

15 files changed

+289
-22
lines changed

15 files changed

+289
-22
lines changed

‎sqldev/pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1212
<jdk.version>1.8</jdk.version>
1313
<jdk.version.test>1.8</jdk.version.test>
14-
<xtend.version>2.15.0</xtend.version>
14+
<xtend.version>2.18.0</xtend.version>
1515
<!-- requires SQL Developer 4.1.0 or higher (first version based on JDK 1.8)-->
1616
<sqldev.basedir>/Applications/SQLDeveloper19.1.0.app/Contents/Resources/sqldeveloper</sqldev.basedir>
1717
<final.name>utplsql_for_SQLDev_${project.version}</final.name>
@@ -170,17 +170,17 @@
170170
<dependency>
171171
<groupId>org.springframework</groupId>
172172
<artifactId>spring-jdbc</artifactId>
173-
<version>5.1.0.RELEASE</version>
173+
<version>5.1.8.RELEASE</version>
174174
</dependency>
175175
<dependency>
176176
<groupId>org.springframework</groupId>
177177
<artifactId>spring-web</artifactId>
178-
<version>5.1.0.RELEASE</version>
178+
<version>5.1.8.RELEASE</version>
179179
</dependency>
180180
<dependency>
181181
<groupId>org.oddgen</groupId>
182182
<artifactId>org.oddgen.sqldev</artifactId>
183-
<version>0.3.0</version>
183+
<version>0.3.1</version>
184184
<scope>provided</scope>
185185
</dependency>
186186
<dependency>
@@ -264,7 +264,7 @@
264264
<plugin>
265265
<groupId>org.apache.maven.plugins</groupId>
266266
<artifactId>maven-surefire-plugin</artifactId>
267-
<version>2.22.0</version>
267+
<version>2.22.2</version>
268268
<configuration>
269269
<!-- -noverify is required in some environments to avoid java.lang.VerifyError-->
270270
<argLine>-noverify
@@ -296,7 +296,7 @@
296296
<plugin>
297297
<groupId>org.apache.maven.plugins</groupId>
298298
<artifactId>maven-antrun-plugin</artifactId>
299-
<version>1.8</version>
299+
<version>1.8</version><!--$NO-MVN-MAN-VER$-->
300300
<executions>
301301
<execution>
302302
<phase>prepare-package</phase>
@@ -400,7 +400,7 @@
400400
<plugin>
401401
<groupId>org.apache.felix</groupId>
402402
<artifactId>maven-bundle-plugin</artifactId>
403-
<version>4.0.0</version>
403+
<version>4.2.0</version>
404404
<extensions>true</extensions>
405405
<configuration>
406406
<finalName>${project.name}</finalName>
@@ -450,7 +450,7 @@
450450
</plugin>
451451
<plugin>
452452
<artifactId>maven-assembly-plugin</artifactId>
453-
<version>3.1.0</version>
453+
<version>3.1.1</version><!--$NO-MVN-MAN-VER$-->
454454
<configuration>
455455
<finalName>${final.name}</finalName>
456456
<appendAssemblyId>false</appendAssemblyId>

‎sqldev/src/main/java/org/utplsql/sqldev/model/preference/PreferenceModel.xtend

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class PreferenceModel extends HashStructureAdapter {
3939
staticfinalStringKEY_CLEAR_SCREEN="clearScreen"
4040
staticfinalStringKEY_AUTO_EXECUTE="autoExecute"
4141
staticfinalStringKEY_CHECK_RUN_UTPLSQL_TEST="checkRunUtplsqlTest"
42+
staticfinalStringKEY_USE_SMART_TIMES="useSmartTimes"
4243
staticfinalStringKEY_NUMBER_OF_RUNS_IN_HISTORY="numberOfRunsInHistory"
4344
staticfinalStringKEY_SHOW_DISABLED_COUNTER="showDisabledCounter"
4445
staticfinalStringKEY_SHOW_WARNINGS_COUNTER="showWarningsCounter"
@@ -110,6 +111,14 @@ class PreferenceModel extends HashStructureAdapter {
110111
getHashStructure.putBoolean(PreferenceModel.KEY_CHECK_RUN_UTPLSQL_TEST, checkRunUtplsqlTest)
111112
}
112113

114+
defisUseSmartTimes() {
115+
return getHashStructure.getBoolean(PreferenceModel.KEY_USE_SMART_TIMES,false)
116+
}
117+
118+
defsetUseSmartTimes(booleanuseSmartTimes) {
119+
getHashStructure.putBoolean(PreferenceModel.KEY_USE_SMART_TIMES, useSmartTimes)
120+
}
121+
113122
defgetNumberOfRunsInHistory() {
114123
return getHashStructure.getInt(PreferenceModel.KEY_NUMBER_OF_RUNS_IN_HISTORY,10)
115124
}

‎sqldev/src/main/java/org/utplsql/sqldev/runner/UtplsqlRunner.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class UtplsqlRunner implements RealtimeReporterEventConsumer {
255255

256256
privatedefinitGUI() {
257257
varRunnerView dockable=null
258-
if (runningInSqlDeveloper&& (dockable=RunnerFactory.dockable asRunnerView)===null) {
258+
if (runningInSqlDeveloper&& (dockable=RunnerFactory.dockable)===null) {
259259
logger.severe('''Error getting utPLSQL dockable. Cannot run utPLSQL test.''')
260260
returnfalse
261261
}else {

‎sqldev/src/main/java/org/utplsql/sqldev/ui/preference/PreferencePanel.xtend

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ import javax.swing.JButton
2222
importjavax.swing.JCheckBox
2323
importjavax.swing.JOptionPane
2424
importjavax.swing.JPanel
25+
importjavax.swing.JSeparator
2526
importjavax.swing.JSpinner
2627
importjavax.swing.JTabbedPane
2728
importjavax.swing.JTextField
2829
importjavax.swing.SpinnerNumberModel
30+
importjavax.swing.SwingConstants
2931
importjavax.swing.table.DefaultTableModel
3032
importoracle.dbtools.raptor.templates.CodeTemplateUtil
3133
importoracle.ide.panels.DefaultTraversablePanel
@@ -45,6 +47,7 @@ class PreferencePanel extends DefaultTraversablePanel {
4547
valJCheckBox clearScreenCheckBox=newJCheckBox
4648
valJCheckBox autoExecuteCheckBox=newJCheckBox
4749
valJCheckBox checkRunUtplsqlTestCheckBox=newJCheckBox
50+
valJCheckBox useSmartTimesCheckBox=newJCheckBox
4851
valJButton importSnippetsButton=newJButton(UtplsqlResources.getString("PREF_IMPORT_SNIPPETS_BUTTON_LABEL"))
4952
valJPanel realtimeReporterPanel=newJPanel
5053
valSpinnerNumberModel numberOfRunsInHistoryModel=newSpinnerNumberModel(1,1,100,1);
@@ -104,6 +107,10 @@ class PreferencePanel extends DefaultTraversablePanel {
104107
runTab.add(
105108
runTab.field.label.withText(UtplsqlResources.getString("PREF_CHECK_RUN_UTPLSQL_TEST_LABEL")).component(
106109
checkRunUtplsqlTestCheckBox))
110+
runTab.add(
111+
runTab.field.label.withText(UtplsqlResources.getString("PREF_USE_SMART_TIMES_LABEL")).component(
112+
useSmartTimesCheckBox))
113+
runTab.addRow(newJSeparator(SwingConstants.HORIZONTAL))
107114
runTab.addRow(importSnippetsButton)
108115
runTab.addVerticalSpring
109116

@@ -336,6 +343,7 @@ class PreferencePanel extends DefaultTraversablePanel {
336343
clearScreenCheckBox.selected = info.clearScreen
337344
autoExecuteCheckBox.selected = info.autoExecute
338345
checkRunUtplsqlTestCheckBox.selected = info.checkRunUtplsqlTest
346+
useSmartTimesCheckBox.selected = info.useSmartTimes
339347
numberOfRunsInHistorySpinner.value = info.numberOfRunsInHistory
340348
showDisabledCounterCheckBox.selected = info.showDisabledCounter
341349
showWarningsCounterCheckBox.selected = info.showWarningsCounter
@@ -371,6 +379,7 @@ class PreferencePanel extends DefaultTraversablePanel {
371379
info.autoExecute = autoExecuteCheckBox.selected
372380
info.numberOfRunsInHistory = numberOfRunsInHistorySpinner.value as Integer
373381
info.checkRunUtplsqlTest = checkRunUtplsqlTestCheckBox.selected
382+
info.useSmartTimes = useSmartTimesCheckBox.selected
374383
info.showDisabledCounter = showDisabledCounterCheckBox.selected
375384
info.showWarningsCounter = showWarningsCounterCheckBox.selected
376385
info.showInfoCounter = showInfoCounterCheckBox.selected

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class GradientToolbar extends JToolBar {
5858
val g2d= g asGraphics2D
5959
val w= width
6060
val h= height-1
61-
val h2= height/2 asint
61+
valinth2= height/2
6262
val colorTop=newColor(237,237,237)
6363
val colorMiddle=newColor(244,244,244)
6464
val colorBottom=newColor(254,254,254)

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import java.awt.event.ActionEvent
2626
importjava.awt.event.ActionListener
2727
importjava.awt.event.MouseEvent
2828
importjava.awt.event.MouseListener
29-
importjava.text.DecimalFormat
3029
importjava.util.ArrayList
3130
importjava.util.regex.Pattern
3231
importjavax.swing.BorderFactory
@@ -75,6 +74,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
7574
staticvalINDICATOR_WIDTH=20
7675
staticvalOVERVIEW_TABLE_ROW_HEIGHT=20
7776
staticvalTEXTPANE_DIM=newDimension(100,100)
77+
staticvarboolean useSmartTimes
7878
LimitedLinkedHashMap<String,Run> runs=newLimitedLinkedHashMap<String,Run>(10)
7979
Run currentRun
8080
JPanel basePanel
@@ -338,6 +338,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
338338
fixCheckBoxMenuItem(showInfoIndicatorCheckBoxMenuItem)
339339
syncDetailTabCheckBoxMenuItem.selected= preferences.syncDetailTab
340340
fixCheckBoxMenuItem(syncDetailTabCheckBoxMenuItem)
341+
useSmartTimes= preferences.useSmartTimes
341342
}
342343

343344
defsetModel(Runrun) {
@@ -349,7 +350,13 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
349350
privatedefsetCurrentRun(Runrun) {
350351
if (run!== currentRun) {
351352
currentRun= run
352-
testOverviewTableModel.setModel(run.tests, showTestDescriptionCheckBoxMenuItem.selected)
353+
testOverviewTableModel.setModel(run.tests, showTestDescriptionCheckBoxMenuItem.selected, useSmartTimes)
354+
val header= testOverviewTableModel.timeColumnName
355+
val timeColumn= testOverviewTable.columnModel.getColumn(4)
356+
if (timeColumn.headerValue!= header) {
357+
timeColumn.headerValue= header
358+
testOverviewTable.tableHeader.repaint
359+
}
353360
resetDerived
354361
val item=newComboBoxItem<String,String>(currentRun.reporterId, currentRun.name)
355362
runComboBox.selectedItem= item
@@ -640,12 +647,10 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
640647
}
641648

642649
staticclassTimeFormatRendererextendsDefaultTableCellRenderer {
643-
staticvalDecimalFormat formatter=newDecimalFormat("#,##0.000")
644-
645650
overridegetTableCellRendererComponent(JTabletable,Objectvalue,booleanisSelected,booleanhasFocus,
646651
introw,intcol) {
647-
valrenderedValue=if(value===null) {null}else {formatter.format(valueasNumber)}
648-
returnsuper.getTableCellRendererComponent(table,renderedValue, isSelected, hasFocus, row, col)
652+
valsmartTime=newSmartTime(value asDouble, useSmartTimes)
653+
returnsuper.getTableCellRendererComponent(table,smartTime.toString, isSelected, hasFocus, row, col)
649654
}
650655
}
651656

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright 2019 Philipp Salvisberg <philipp.salvisberg@trivadis.com>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
packageorg.utplsql.sqldev.ui.runner
17+
18+
importjava.text.DecimalFormat
19+
20+
classSmartTime {
21+
varDouble seconds
22+
varboolean smart=false
23+
24+
new() {
25+
super()
26+
}
27+
28+
new(Double seconds,boolean smart) {
29+
super()
30+
this.seconds= seconds
31+
this.smart= smart
32+
}
33+
34+
defsetMillis(Doubleseconds) {
35+
this.seconds= seconds
36+
}
37+
38+
defsetSmart(booleansmart) {
39+
this.smart= smart
40+
}
41+
42+
defgetSeconds() {
43+
return seconds
44+
}
45+
46+
overridetoString() {
47+
varString ret;
48+
if (seconds===null) {
49+
ret=null
50+
}elseif (smart) {
51+
if (seconds>=60*60) {
52+
valDecimalFormat formatter=newDecimalFormat("#0.00")
53+
ret= formatter.format(seconds/60/60)+" h"
54+
}elseif (seconds>=60) {
55+
valDecimalFormat formatter=newDecimalFormat("#0.00")
56+
ret= formatter.format(seconds/60)+" min"
57+
}elseif (seconds>=1) {
58+
valDecimalFormat formatter=newDecimalFormat("#0.000")
59+
ret= formatter.format(seconds)+" s"
60+
}else {
61+
valDecimalFormat formatter=newDecimalFormat("##0")
62+
ret= formatter.format(seconds*1000)+" ms"
63+
}
64+
65+
}else {
66+
valDecimalFormat formatter=newDecimalFormat("##,##0.000")
67+
ret= formatter.format(seconds)
68+
}
69+
return ret
70+
}
71+
72+
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class TestOverviewTableModel extends DefaultTableModel {
2727
String commonPrefix
2828
boolean commonPrefixCalculated
2929
boolean showDescription
30+
boolean useSmartTimes
3031

3132
new() {
3233
super()
@@ -40,10 +41,11 @@ class TestOverviewTableModel extends DefaultTableModel {
4041
}
4142
}
4243

43-
defsetModel(LinkedHashMap<String,Test>tests,booleanshowDescription) {
44+
defsetModel(LinkedHashMap<String,Test>tests,booleanshowDescription,booleanuseSmartTimes) {
4445
commonPrefixCalculated=false
4546
this.tests= tests
4647
this.showDescription= showDescription
48+
this.useSmartTimes= useSmartTimes
4749
calcCommonPrefix
4850
fireTableDataChanged()
4951
}
@@ -70,6 +72,11 @@ class TestOverviewTableModel extends DefaultTableModel {
7072
}
7173
}
7274

75+
defgetTimeColumnName() {
76+
val timeColumnName='''«UtplsqlResources.getString("RUNNER_TEST_EXECUTION_TIME_COLUMN")»«IF !useSmartTimes» [s]«ENDIF»'''
77+
return timeColumnName
78+
}
79+
7380
defgetTest(introw) {
7481
val entry= tests.entrySet.get(row)
7582
val test= tests.get(entry.key)
@@ -120,7 +127,7 @@ class TestOverviewTableModel extends DefaultTableModel {
120127

121128
overridegetColumnName(intcol) {
122129
return #["","","",UtplsqlResources.getString(if (showDescription) {"RUNNER_DESCRIPTION_LABEL"}else {"RUNNER_TEST_ID_COLUMN"}),
123-
UtplsqlResources.getString("RUNNER_TEST_EXECUTION_TIME_COLUMN")].get(col)
130+
timeColumnName].get(col)
124131
}
125132

126133
overrideisCellEditable(introw,intcolumn) {

‎sqldev/src/main/resources/org/utplsql/sqldev/resources/UtplsqlResources.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ PREF_RESET_PACKAGE_LABEL=Reset package before running utPLSQL?
3232
PREF_CLEAR_SCREEN_LABEL=Clear script output panel before running utPLSQL?
3333
PREF_AUTO_EXECUTE_LABEL=Execute unit test automatically?
3434
PREF_CHECK_RUN_UTPLSQL_TEST_LABEL=Check availability of menu option?
35+
PREF_USE_SMART_TIMES_LABEL=Use smart times?
3536
PREF_IMPORT_SNIPPETS_BUTTON_LABEL=Import Snippets
3637
MENU_REALTIME_REPORTER_LABEL=Realtime Reporter
3738
PREF_NUMBER_OF_RUNS_IN_HISTORY_LABEL=Number of runs in history
@@ -89,7 +90,7 @@ RUNNER_NO_TESTS_FOUND_TEXT=No tests found.
8990
RUNNER_RUN_MENUITEM=Run test
9091
RUNNER_RUN_WORKSHEET_MENUITEM=Run test in new worksheet
9192
RUNNER_TEST_ID_COLUMN=Suitepath
92-
RUNNER_TEST_EXECUTION_TIME_COLUMN=Time [s]
93+
RUNNER_TEST_EXECUTION_TIME_COLUMN=Time
9394
RUNNER_OWNER_LABEL=Owner
9495
RUNNER_PACKAGE_LABEL=Package
9596
RUNNER_PROCEDURE_LABEL=Procedure

‎sqldev/src/main/resources/org/utplsql/sqldev/resources/UtplsqlResources_de.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PREF_RESET_PACKAGE_LABEL=Package vor der Ausf
99
PREF_CLEAR_SCREEN_LABEL=Skriptausgabe-Fenster vor der Ausführung von utPLSQL leeren?
1010
PREF_AUTO_EXECUTE_LABEL=Unit Test automatisch ausführen?
1111
PREF_CHECK_RUN_UTPLSQL_TEST_LABEL=Verfügbarkeit der Menüoption prüfen?
12+
PREF_USE_SMART_TIMES_LABEL=Smarte Zeitangaben verwenden?
1213
PREF_IMPORT_SNIPPETS_BUTTON_LABEL=Code-Schnipsel importieren
1314
MENU_REALTIME_REPORTER_LABEL=Realtime Reporter
1415
PREF_NUMBER_OF_RUNS_IN_HISTORY_LABEL=Anzahl Ausführungen in der Historie
@@ -66,7 +67,7 @@ RUNNER_NO_TESTS_FOUND_TEXT=Keine Tests gefunden.
6667
RUNNER_RUN_MENUITEM=Run testTest ausführen
6768
RUNNER_RUN_WORKSHEET_MENUITEM=Test in neuem Arbeitsblatt ausführuen
6869
RUNNER_TEST_ID_COLUMN_NAME=Suitepath
69-
RUNNER_TEST_EXECUTION_TIME_COLUMN_NAME=Zeit [s]
70+
RUNNER_TEST_EXECUTION_TIME_COLUMN_NAME=Zeit
7071
RUNNER_OWNER_LABEL=Besitzer
7172
RUNNER_PACKAGE_LABEL=Paket
7273
RUNNER_PROCEDURE_LABEL=Prozedur

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp