From 7fee2767996cdaf94d362cc16a901c5ce5ca63d8 Mon Sep 17 00:00:00 2001 From: xterao Date: Thu, 25 Sep 2025 16:00:20 +0900 Subject: [PATCH 1/6] Add internationalization support for Doma Tools settings --- .../intellij/bundle/SettingMessageBundle.kt | 38 +++++++++ .../intellij/setting/DomaToolsConfigurable.kt | 6 +- src/main/resources/META-INF/plugin.xml | 85 ++++++++++--------- .../DomaToolsSettingBundle.properties | 9 ++ .../DomaToolsSettingBundle_ja.properties | 9 ++ 5 files changed, 103 insertions(+), 44 deletions(-) create mode 100644 src/main/kotlin/org/domaframework/doma/intellij/bundle/SettingMessageBundle.kt create mode 100644 src/main/resources/messages/DomaToolsSettingBundle.properties create mode 100644 src/main/resources/messages/DomaToolsSettingBundle_ja.properties diff --git a/src/main/kotlin/org/domaframework/doma/intellij/bundle/SettingMessageBundle.kt b/src/main/kotlin/org/domaframework/doma/intellij/bundle/SettingMessageBundle.kt new file mode 100644 index 00000000..172b8728 --- /dev/null +++ b/src/main/kotlin/org/domaframework/doma/intellij/bundle/SettingMessageBundle.kt @@ -0,0 +1,38 @@ +/* + * Copyright Doma Tools Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.domaframework.doma.intellij.bundle + +import com.intellij.DynamicBundle +import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.PropertyKey + +@NonNls +private const val BUNDLE = "messages.DomaToolsSettingBundle" + +object SettingMessageBundle : DynamicBundle(BUNDLE) { + @JvmStatic + fun message( + @PropertyKey(resourceBundle = BUNDLE) key: String, + vararg params: Any, + ) = getMessage(key, *params) + + @Suppress("unused") + @JvmStatic + fun messagePointer( + @PropertyKey(resourceBundle = BUNDLE) key: String, + vararg params: Any, + ) = getLazyMessage(key, *params) +} diff --git a/src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt b/src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt index c62a5ab8..69db7305 100644 --- a/src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt +++ b/src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt @@ -17,6 +17,7 @@ package org.domaframework.doma.intellij.setting import com.intellij.openapi.options.Configurable import com.intellij.openapi.options.ConfigurationException +import org.domaframework.doma.intellij.bundle.SettingMessageBundle import org.domaframework.doma.intellij.setting.state.DomaToolsFormatEnableSettings import javax.swing.JComponent @@ -25,12 +26,13 @@ class DomaToolsConfigurable : Configurable { private var formatSettings: DomaToolsFormatEnableSettings = DomaToolsFormatEnableSettings.getInstance() - override fun getDisplayName(): String = "Doma Tools" + override fun getDisplayName(): String = + SettingMessageBundle.message("applicationConfigurable.DomaToolsConfigurable.displayName") override fun createComponent(): JComponent? = mySettingsComponent?.panel override fun isModified(): Boolean { - val enableFormatModified = formatSettings.isModified(mySettingsComponent) != false + val enableFormatModified = formatSettings.isModified(mySettingsComponent) return enableFormatModified } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e5ba1b09..e2884043 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -14,6 +14,7 @@ messages.DomaToolsBundle messages.LLMInstallerBundle + messages.DomaToolsSettingBundle - + - JAVA - org.domaframework.doma.intellij.action.dao.ConvertSqlAnnotationToFileAction - Doma tools - true + JAVA + messages.DomaToolsSettingBundle + org.domaframework.doma.intellij.action.dao.ConvertSqlAnnotationToFileAction + doma.tools + true - DomaSql - org.domaframework.doma.intellij.action.sql.ConvertSqlFileToAnnotationFromSqlAction - Doma tools - true + DomaSql + messages.DomaToolsSettingBundle + org.domaframework.doma.intellij.action.sql.ConvertSqlFileToAnnotationFromSqlAction + doma.tools + true + + + JAVA + messages.DomaToolsSettingBundle + org.domaframework.doma.intellij.action.dao.ConvertSqlFileToAnnotationFromDaoAction + doma.tools + true + + + JAVA + messages.DomaToolsSettingBundle + org.domaframework.doma.intellij.action.dao.BulkConvertSqlAnnotationToFileAction + doma.tools + true + + + JAVA + messages.DomaToolsSettingBundle + org.domaframework.doma.intellij.action.dao.BulkConvertSqlFileToAnnotationAction + doma.tools + true - - JAVA - org.domaframework.doma.intellij.action.dao.ConvertSqlFileToAnnotationFromDaoAction - Doma tools - true - - - JAVA - org.domaframework.doma.intellij.action.dao.BulkConvertSqlAnnotationToFileAction - Doma tools - true - - - JAVA - org.domaframework.doma.intellij.action.dao.BulkConvertSqlFileToAnnotationAction - Doma tools - true - @@ -135,33 +144,25 @@ - + + anchor="last"/> + class="org.domaframework.doma.intellij.action.dao.JumpToSQLFromDaoAction"> + class="org.domaframework.doma.intellij.action.sql.JumpToDaoFromSQLAction"> + class="org.domaframework.doma.intellij.action.dao.GenerateSqlAction"> diff --git a/src/main/resources/messages/DomaToolsSettingBundle.properties b/src/main/resources/messages/DomaToolsSettingBundle.properties new file mode 100644 index 00000000..b02ce13b --- /dev/null +++ b/src/main/resources/messages/DomaToolsSettingBundle.properties @@ -0,0 +1,9 @@ +action.org.domaframework.doma.intellij.JumpToDaoFromSQL.text=Jump to DAO +action.org.domaframework.doma.intellij.JumpToDaoFromSQL.description=Jump from SQL file to DAO method definition +action.org.domaframework.doma.intellij.action.JumpToSQLFromDao.text=Jump to SQL +action.org.domaframework.doma.intellij.action.JumpToSQLFromDao.description=Jump from DAO file to SQL file +action.org.domaframework.doma.intellij.GenerateSqlAction.text=Generate SQL +action.org.domaframework.doma.intellij.GenerateSqlAction.description=Generate SQL file from DAO method +group.org.domaframework.doma.intellij.DomaToolGroupActions.text=Doma Tools +doma.tools=Doma tools +applicationConfigurable.DomaToolsConfigurable.displayName=Doma Tools \ No newline at end of file diff --git a/src/main/resources/messages/DomaToolsSettingBundle_ja.properties b/src/main/resources/messages/DomaToolsSettingBundle_ja.properties new file mode 100644 index 00000000..9709b657 --- /dev/null +++ b/src/main/resources/messages/DomaToolsSettingBundle_ja.properties @@ -0,0 +1,9 @@ +action.org.domaframework.doma.intellij.JumpToDaoFromSQL.text=\u0044\u0041\u004F\u30E1\u30BD\u30C3\u30C9\u306B\u30B8\u30E3\u30F3\u30D7 +action.org.domaframework.doma.intellij.JumpToDaoFromSQL.description=\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u0044\u0041\u004F\u30E1\u30BD\u30C3\u30C9\u5B9A\u7FA9\u306B\u30B8\u30E3\u30F3\u30D7\u3057\u307E\u3059\u3002 +action.org.domaframework.doma.intellij.action.JumpToSQLFromDao.text=\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u306B\u30B8\u30E3\u30F3\u30D7 +action.org.domaframework.doma.intellij.action.JumpToSQLFromDao.description=\u0044\u0041\u004F\u30E1\u30BD\u30C3\u30C9\u304B\u3089\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u306B\u30B8\u30E3\u30F3\u30D7\u3057\u307E\u3059\u3002 +action.org.domaframework.doma.intellij.GenerateSqlAction.text=\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210 +action.org.domaframework.doma.intellij.GenerateSqlAction.description=\u0044\u0041\u004F\u30E1\u30BD\u30C3\u30C9\u306B\u7D10\u3065\u304F\u0053\u0051\u004C\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\u3002 +group.org.domaframework.doma.intellij.DomaToolGroupActions.text=Doma Tools +doma.tools=Doma tools +applicationConfigurable.DomaToolsConfigurable.displayName=Doma Tools \ No newline at end of file From 41fbb55b8be77bd03f9d1e73a57f37b08550722c Mon Sep 17 00:00:00 2001 From: xterao Date: Thu, 25 Sep 2025 16:00:46 +0900 Subject: [PATCH 2/6] Fix typo in task group names and update task registration syntax in build.gradle.kts --- build.gradle.kts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index dd947fa9..5397b298 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,13 +26,13 @@ plugins { grammarKit { tasks { generateLexer { - group = "grammer-kit" + group = "grammar-kit" sourceFile = file("src/main/java/org/domaframework/doma/intellij/Sql.flex") targetOutputDir = file("src/main/gen/org/domaframework/doma/intellij") purgeOldFiles = true } generateParser { - group = "grammer-kit" + group = "grammar-kit" sourceFile = file("src/main/java/org/domaframework/doma/intellij/Sql.bnf") targetRootOutputDir = file("src/main/gen") pathToParser = "/org/domaframework/doma/intellij/SqlParser.java" @@ -182,7 +182,7 @@ tasks { } } -tasks.register("encodeBase64") { +tasks.register("encodeBase64") { doLast { val currentDir = File("./certificate") val files = currentDir.listFiles() ?: return@doLast @@ -203,7 +203,7 @@ tasks.register("encodeBase64") { } } -tasks.register("updateChangelog") { +tasks.register("updateChangelog") { group = "changelog" description = "Update CHANGELOG.md based on merged PRs since last release" @@ -218,7 +218,7 @@ tasks.register("updateChangelog") { @JsonIgnoreProperties(ignoreUnknown = true) data class PullRequestItem( val title: String = "", - @JsonProperty("html_url") + @param:JsonProperty("html_url") val url: String = "", val number: Long = 0, var labelItems: List = emptyList(), @@ -601,7 +601,6 @@ fun replaceVersionInLogSetting(ver: String) { } fun replaceVersion(ver: String) { - checkNotNull(ver) replaceVersionInPluginUtil(ver) replaceVersionGradleProperty(ver) replaceVersionInLogSetting(ver) From 138af7d79482ec98421b09b2d5b263e8f0bbf12f Mon Sep 17 00:00:00 2001 From: xterao Date: Thu, 25 Sep 2025 16:05:39 +0900 Subject: [PATCH 3/6] Reorder resource bundle declaration for DomaToolsSettingBundle to ensure it is recognized as the default --- src/main/resources/META-INF/plugin.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e2884043..fee8ea98 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -14,7 +14,8 @@ messages.DomaToolsBundle messages.LLMInstallerBundle - messages.DomaToolsSettingBundle + + messages.DomaToolsSettingBundle Date: Thu, 25 Sep 2025 16:11:41 +0900 Subject: [PATCH 4/6] Refactor getDisplayName method for improved readability --- .../doma/intellij/setting/DomaToolsConfigurable.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt b/src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt index 69db7305..c86400e4 100644 --- a/src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt +++ b/src/main/kotlin/org/domaframework/doma/intellij/setting/DomaToolsConfigurable.kt @@ -26,8 +26,7 @@ class DomaToolsConfigurable : Configurable { private var formatSettings: DomaToolsFormatEnableSettings = DomaToolsFormatEnableSettings.getInstance() - override fun getDisplayName(): String = - SettingMessageBundle.message("applicationConfigurable.DomaToolsConfigurable.displayName") + override fun getDisplayName(): String = SettingMessageBundle.message("applicationConfigurable.DomaToolsConfigurable.displayName") override fun createComponent(): JComponent? = mySettingsComponent?.panel From a7861de8bff8685bbd319a36fa920a18694c7aa9 Mon Sep 17 00:00:00 2001 From: xterao Date: Thu, 25 Sep 2025 16:14:46 +0900 Subject: [PATCH 5/6] Exclude unnecessary differences --- build.gradle.kts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5397b298..111dede8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -182,7 +182,7 @@ tasks { } } -tasks.register("encodeBase64") { +tasks.register("encodeBase64") { doLast { val currentDir = File("./certificate") val files = currentDir.listFiles() ?: return@doLast @@ -203,7 +203,7 @@ tasks.register("encodeBase64") { } } -tasks.register("updateChangelog") { +tasks.register("updateChangelog") { group = "changelog" description = "Update CHANGELOG.md based on merged PRs since last release" @@ -326,9 +326,9 @@ tasks.register("updateChangelog") { val mapper = jacksonObjectMapper() val json: Map = ( - mapper.readValue(response, Map::class.java) as? Map - ?: emptyList>() - ) as Map + mapper.readValue(response, Map::class.java) as? Map + ?: emptyList>() + ) as Map val items = (json["items"] as List<*>) .mapNotNull { item -> @@ -479,9 +479,9 @@ tasks.register("checkExistChangelogPullRequest") { val mapper = jacksonObjectMapper() val json: Map = ( - mapper.readValue(response, Map::class.java) as? Map - ?: emptyList>() - ) as Map + mapper.readValue(response, Map::class.java) as? Map + ?: emptyList>() + ) as Map println("get response Json ${json["total_count"]}") val existChangelogPr = json["total_count"] != 0 @@ -601,6 +601,7 @@ fun replaceVersionInLogSetting(ver: String) { } fun replaceVersion(ver: String) { + checkNotNull(ver) replaceVersionInPluginUtil(ver) replaceVersionGradleProperty(ver) replaceVersionInLogSetting(ver) From 83016d6ead596856ea870bf5b13d81bdc4aab6de Mon Sep 17 00:00:00 2001 From: xterao Date: Thu, 25 Sep 2025 16:32:10 +0900 Subject: [PATCH 6/6] Fix build.gradle error to address Spotless issues --- build.gradle.kts | 59 ++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 111dede8..1e787112 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -182,7 +182,7 @@ tasks { } } -tasks.register("encodeBase64") { +tasks.register("encodeBase64") { doLast { val currentDir = File("./certificate") val files = currentDir.listFiles() ?: return@doLast @@ -203,7 +203,7 @@ tasks.register("encodeBase64") { } } -tasks.register("updateChangelog") { +tasks.register("updateChangelog") { group = "changelog" description = "Update CHANGELOG.md based on merged PRs since last release" @@ -326,9 +326,9 @@ tasks.register("updateChangelog") { val mapper = jacksonObjectMapper() val json: Map = ( - mapper.readValue(response, Map::class.java) as? Map - ?: emptyList>() - ) as Map + mapper.readValue(response, Map::class.java) as? Map + ?: emptyList>() + ) as Map val items = (json["items"] as List<*>) .mapNotNull { item -> @@ -445,7 +445,7 @@ tasks.register("updateChangelog") { } } -tasks.register("checkExistChangelogPullRequest") { +tasks.register("checkExistChangelogPullRequest") { group = "changelog" description = "Check if a PR with the same name has already been created" @@ -479,9 +479,9 @@ tasks.register("checkExistChangelogPullRequest") { val mapper = jacksonObjectMapper() val json: Map = ( - mapper.readValue(response, Map::class.java) as? Map - ?: emptyList>() - ) as Map + mapper.readValue(response, Map::class.java) as? Map + ?: emptyList>() + ) as Map println("get response Json ${json["total_count"]}") val existChangelogPr = json["total_count"] != 0 @@ -492,24 +492,24 @@ tasks.register("checkExistChangelogPullRequest") { intellijPlatformTesting { runIde { - register("runIdeForUiTests") { - task { - jvmArgumentProviders += - CommandLineArgumentProvider { - listOf( - "-Drobot-server.port=8082", - "-Dide.mac.message.dialogs.as.sheets=false", - "-Djb.privacy.policy.text=", - "-Djb.consents.confirmation.enabled=false", - "-Didea.log.registry.conflicts.silent=true", - ) - } - } - - plugins { - robotServerPlugin() - } - } +// register("runIdeForUiTests") { +// task { +// jvmArgumentProviders += +// CommandLineArgumentProvider { +// listOf( +// "-Drobot-server.port=8082", +// "-Dide.mac.message.dialogs.as.sheets=false", +// "-Djb.privacy.policy.text=", +// "-Djb.consents.confirmation.enabled=false", +// "-Didea.log.registry.conflicts.silent=true", +// ) +// } +// } +// +// plugins { +// robotServerPlugin() +// } +// } } } @@ -601,7 +601,6 @@ fun replaceVersionInLogSetting(ver: String) { } fun replaceVersion(ver: String) { - checkNotNull(ver) replaceVersionInPluginUtil(ver) replaceVersionGradleProperty(ver) replaceVersionInLogSetting(ver) @@ -610,7 +609,7 @@ fun replaceVersion(ver: String) { val encoding: String by project -tasks.register("replaceNewVersion") { +tasks.register("replaceNewVersion") { val releaseVersion = if (project.hasProperty("newVersion")) { project.property("newVersion") as String @@ -639,7 +638,7 @@ tasks.register("replaceNewVersion") { } } -tasks.register("replaceDraftVersion") { +tasks.register("replaceDraftVersion") { val draftVersion = if (project.hasProperty("draftVersion")) { project.property("draftVersion") as String