Skip to content

Commit 5dbe84b

Browse files
committed
[🦁release] 1.0.0 xmas
1 parent 4033288 commit 5dbe84b

File tree

11 files changed

+91
-39
lines changed

11 files changed

+91
-39
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
2+
3+
# intellij-sql2dto Changelog
4+
5+
## [Unreleased]
6+
### Added
7+
8+
### Changed
9+
10+
### Deprecated
11+
12+
### Removed
13+
14+
### Fixed
15+
16+
### Security
17+
18+
## [1.0.0] - 2020-12-24
19+
20+
### Added
21+
22+
- support Jooq's Fields in Java
23+
- select query result in DataGrid
24+
- Text & Auto at AnyWhere
25+
- Config template syntax highlight
26+
27+
28+

README.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,45 @@ take the end of the two words generate the DTO.
8282
![DTO java args](asset/usage-java-args.png)
8383

8484

85+
## Config/配置
86+
87+
the configuration is project level not global,
88+
click `load Default` to reset the plugin default.
89+
90+
<kbd>Preferences</kbd> > <kbd>Tools</kbd> > <kbd>Any2dto</kbd>
91+
92+
### Config
93+
94+
* `Where to Save` save DTO code to clipboard or java file
95+
* `Which Template` inner class or standard POJO file
96+
* `Class Name` default is `Dto`, or `prompt` every time.
97+
* `Source Path` when saving to java file,`.` means current project
98+
* `Package Name` the package name of DTO using in `Outer File`
99+
* `Line Separator` the RegExp to split lines in selection
100+
* `Word Separator` the RegExp to split words in each line
101+
102+
### Type Mapping
103+
104+
comment begins with `#`, and ignore leading white spaces
105+
TYPE_NAME(PRECISION,SCALE) = JAVA_CLASS, one rule per line,
106+
- TYPE_NAME are case insensitive
107+
- PRECISION & SCALE are digit, `1-3` = `[1,2,3]`, `*`= `ANY`
108+
- (PRECISION,SCALE) should be omitted if match ANY
109+
- for simple `CHAR(1,*)` = `CHAR(1)`; `CHAR(*)` = `CHAR`;
110+
the order is FIFO, the top matches first, stop when matched.
111+
112+
### Template Inner/Outer
113+
114+
the template engine is [Meepo](https://github.com/trydofor/pro.fessional.meepo)
115+
that having the same syntax as the target file. there are some builtin variable,
116+
117+
* `javaPackageName` package from `Package Name` config
118+
* `javaTypeImports` imports Class for `javaFields`
119+
* `className` the DTO name in config or prompt
120+
* `javaFields` DTO's fields
121+
- `type` java type. eg. String
122+
- `name` java name. eg. author
123+
85124
## Description
86125
<!-- Plugin description -->
87126
Commonly using generated Pojo to `SELECT *` is a bad practice. the better way
@@ -113,12 +152,6 @@ for more detail usage, go to [github any2dto](https://github.com/trydofor/intell
113152
Download the [latest release](https://github.com/trydofor/intellij-any2dto/releases/latest) and install it manually using
114153
<kbd>Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>⚙️</kbd> > <kbd>Install plugin from disk...</kbd>
115154

116-
117-
## Change Notes
118-
<!-- Plugin changeNotes -->
119-
* 1.0.0 support Jooq's Fields in Java; SQLs in DataGrid; Text & Auto at AnyWhere
120-
<!-- Plugin changeNotes end -->
121-
122155
## Moilion Product
123156

124157
* [redis-replicator](https://github.com/leonchen83/redis-replicator)

build.gradle.kts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,8 @@ tasks {
118118
// Get the latest available change notes from the changelog file
119119
changeNotes(
120120
closure {
121-
File("./README.md").readText().lines().run {
122-
val start = "<!-- Plugin changeNotes -->"
123-
val end = "<!-- Plugin changeNotes end -->"
124-
125-
if (!containsAll(listOf(start, end))) {
126-
throw GradleException("Plugin changeNotes section not found in README.md:\n$start ... $end")
127-
}
128-
subList(indexOf(start) + 1, indexOf(end))
129-
}.joinToString("\n").run { markdownToHTML(this) }
121+
changelog.getLatest().toHTML()
130122
}
131-
132123
)
133124
}
134125

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
pluginGroup = com.moilioncircle.intellij
55
pluginName_ = any2dto
6-
pluginVersion = 0.0.1-alpha
6+
pluginVersion = 1.0.0
77
pluginSinceBuild = 201
88
pluginUntilBuild = 203.*
99
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl

src/main/java/com/moilioncircle/intellij/any2dto/ui/SettingComponent.form

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@
194194
<toolTipText resource-bundle="messages/Any2dtoBundle" key="setting.Config.txtTextWordSep.tip"/>
195195
</properties>
196196
</component>
197-
<component id="e103e" class="javax.swing.JCheckBox" binding="ckbDtoPromote">
197+
<component id="e103e" class="javax.swing.JCheckBox" binding="ckbDtoPrompt">
198198
<constraints>
199199
<grid row="3" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
200200
</constraints>
201201
<properties>
202-
<text resource-bundle="messages/Any2dtoBundle" key="setting.Config.ckbDtoPromote.text"/>
202+
<text resource-bundle="messages/Any2dtoBundle" key="setting.Config.ckbDtoPrompt.text"/>
203203
</properties>
204204
</component>
205205
<component id="277cc" class="javax.swing.JSeparator">
@@ -220,12 +220,12 @@
220220
</constraints>
221221
<properties/>
222222
</component>
223-
<component id="42d97" class="javax.swing.JCheckBox" binding="ckbLinePromote">
223+
<component id="42d97" class="javax.swing.JCheckBox" binding="ckbLinePrompt">
224224
<constraints>
225225
<grid row="7" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
226226
</constraints>
227227
<properties>
228-
<text resource-bundle="messages/Any2dtoBundle" key="setting.Config.ckbLinePromote.text"/>
228+
<text resource-bundle="messages/Any2dtoBundle" key="setting.Config.ckbLinePrompt.text"/>
229229
</properties>
230230
</component>
231231
</children>

src/main/java/com/moilioncircle/intellij/any2dto/ui/SettingComponent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class SettingComponent {
3636
public JTextField txtDtoName;
3737
public JTextField txtTextLineSep;
3838
public JTextField txtTextWordSep;
39-
public JCheckBox ckbDtoPromote;
40-
public JCheckBox ckbLinePromote;
39+
public JCheckBox ckbDtoPrompt;
40+
public JCheckBox ckbLinePrompt;
4141
public EditorTextField edtTypeMapping;
4242
public EditorTextField edtTmplInner;
4343
public EditorTextField edtTmplOuter;

src/main/kotlin/com/moilioncircle/intellij/any2dto/actions/Any2DtoActionText.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Any2DtoActionText : AnAction() {
2222
val state = SettingsState.loadSettingState()
2323
val wsp = state.textWordSeparator.toRegex()
2424
var lines = select.split(state.textLineSeparator.toRegex()).filter { it.isNotBlank() }
25-
while (state.textLinePromote && lines.size == 1) {
25+
while (state.textLinePrompt && lines.size == 1) {
2626
val reg =
2727
Messages.showInputDialog("only one line, may need new Separator",
2828
"Input line Separator Regexp",

src/main/kotlin/com/moilioncircle/intellij/any2dto/helper/MergerHelper.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ object MergerHelper {
107107
fun generateJava(state: SettingsState, fields: List<FieldInfo>, project: Project?, from: String) {
108108
val defaultName = state.javaDtoName
109109
if (state.usingClipboard) {
110-
val dtoName = if (state.javaDtoPromote) {
110+
val dtoName = if (state.javaDtoPrompt) {
111111
Messages.showInputDialog(null,
112112
"""have ${fields.size} fields
113113
--
@@ -121,7 +121,7 @@ object MergerHelper {
121121
val javaCode = mergeFields(state, fields, dtoName)
122122
copyClipboard(javaCode, "")
123123
} else {
124-
val dtoName = if (state.javaDtoPromote) {
124+
val dtoName = if (state.javaDtoPrompt) {
125125
Messages.showInputDialog(null,
126126
"""use inner template = ${state.usingInnerClass}
127127
java source path = ${state.javaSourcePath}

src/main/kotlin/com/moilioncircle/intellij/any2dto/settings/SettingConfigurable.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class SettingConfigurable(val project: Project) : SearchableConfigurable {
3232
|| state.javaPackageName != txtPackageName.text
3333
|| state.javaSourcePath != txtSourcePath.text
3434
|| state.javaDtoName != txtDtoName.text
35-
|| state.javaDtoPromote != ckbDtoPromote.isSelected
35+
|| state.javaDtoPrompt != ckbDtoPrompt.isSelected
3636
|| state.javaTempletInner != edtTmplInner.text
3737
|| state.javaTempletOuter != edtTmplOuter.text
3838
|| state.javaTypeMapping != edtTypeMapping.text
3939
|| state.textLineSeparator != txtTextLineSep.text
40-
|| state.textLinePromote != ckbLinePromote.isSelected
40+
|| state.textLinePrompt != ckbLinePrompt.isSelected
4141
|| state.textWordSeparator != txtTextWordSep.text
4242
}
4343

@@ -47,13 +47,13 @@ class SettingConfigurable(val project: Project) : SearchableConfigurable {
4747
state.usingInnerClass = rbtInnerClass.isSelected
4848
state.javaPackageName = txtPackageName.text
4949
state.javaSourcePath = txtSourcePath.text
50-
state.javaDtoPromote = ckbDtoPromote.isSelected
50+
state.javaDtoPrompt = ckbDtoPrompt.isSelected
5151
state.javaDtoName = txtDtoName.text
5252
state.javaTempletInner = edtTmplInner.text
5353
state.javaTempletOuter = edtTmplOuter.text
5454
state.javaTypeMapping = edtTypeMapping.text
5555
state.textLineSeparator = txtTextLineSep.text
56-
state.textLinePromote = ckbLinePromote.isSelected
56+
state.textLinePrompt = ckbLinePrompt.isSelected
5757
state.textWordSeparator = txtTextWordSep.text
5858
}
5959

@@ -121,12 +121,12 @@ class SettingConfigurable(val project: Project) : SearchableConfigurable {
121121
txtSourcePath.text = state.javaSourcePath
122122
txtPackageName.text = state.javaPackageName
123123
txtDtoName.text = state.javaDtoName
124-
ckbDtoPromote.isSelected = state.javaDtoPromote
124+
ckbDtoPrompt.isSelected = state.javaDtoPrompt
125125
edtTypeMapping.text = state.javaTypeMapping
126126
// edtTmplInner.text = state.javaTempletInner
127127
edtTmplOuter.text = state.javaTempletOuter
128128
txtTextLineSep.text = state.textLineSeparator
129-
ckbLinePromote.isSelected = state.textLinePromote
129+
ckbLinePrompt.isSelected = state.textLinePrompt
130130
txtTextWordSep.text = state.textWordSeparator
131131
whereSaveState(null)
132132
}

src/main/kotlin/com/moilioncircle/intellij/any2dto/settings/SettingsState.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ data class SettingsState(
1616
var javaSourcePath: String = defaultSrcPath,
1717
var javaPackageName: String = defaultPkgName,
1818
var javaDtoName: String = defaultDtoName,
19-
var javaDtoPromote: Boolean = true,
19+
var javaDtoPrompt: Boolean = true,
2020
var usingClipboard: Boolean = true,
2121
var usingInnerClass: Boolean = true,
2222
var javaTempletInner: String = ConfigHelper.defaultTemplateInner,
2323
var javaTempletOuter: String = ConfigHelper.defaultTemplateOuter,
2424
var javaTypeMapping: String = ConfigHelper.defaultMapping,
2525
var textLineSeparator: String = defaultLineSep,
26-
var textLinePromote: Boolean = true,
26+
var textLinePrompt: Boolean = true,
2727
var textWordSeparator: String = defaultWordSep,
2828
) : PersistentStateComponent<SettingsState> {
2929

@@ -39,14 +39,14 @@ data class SettingsState(
3939
javaSourcePath = defaultSrcPath
4040
javaPackageName = defaultPkgName
4141
javaDtoName = defaultDtoName
42-
javaDtoPromote = true
42+
javaDtoPrompt = true
4343
usingClipboard = true
4444
usingInnerClass = true
4545
javaTempletInner = ConfigHelper.defaultTemplateInner
4646
javaTempletOuter = ConfigHelper.defaultTemplateOuter
4747
javaTypeMapping = ConfigHelper.defaultMapping
4848
textLineSeparator = defaultLineSep
49-
textLinePromote = true
49+
textLinePrompt = true
5050
textWordSeparator = defaultWordSep
5151
}
5252

0 commit comments

Comments
 (0)