Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 26 additions & 27 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -182,7 +182,7 @@ tasks {
}
}

tasks.register("encodeBase64") {
tasks.register<Task>("encodeBase64") {
doLast {
val currentDir = File("./certificate")
val files = currentDir.listFiles() ?: return@doLast
Expand All @@ -203,7 +203,7 @@ tasks.register("encodeBase64") {
}
}

tasks.register("updateChangelog") {
tasks.register<Task>("updateChangelog") {
group = "changelog"
description = "Update CHANGELOG.md based on merged PRs since last release"

Expand All @@ -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<String> = emptyList(),
Expand Down Expand Up @@ -445,7 +445,7 @@ tasks.register("updateChangelog") {
}
}

tasks.register("checkExistChangelogPullRequest") {
tasks.register<Task>("checkExistChangelogPullRequest") {
group = "changelog"
description = "Check if a PR with the same name has already been created"

Expand Down Expand Up @@ -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=<!--999.999-->",
"-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=<!--999.999-->",
// "-Djb.consents.confirmation.enabled=false",
// "-Didea.log.registry.conflicts.silent=true",
// )
// }
// }
//
// plugins {
// robotServerPlugin()
// }
// }
}
}

Expand Down Expand Up @@ -601,7 +601,6 @@ fun replaceVersionInLogSetting(ver: String) {
}

fun replaceVersion(ver: String) {
checkNotNull(ver)
replaceVersionInPluginUtil(ver)
replaceVersionGradleProperty(ver)
replaceVersionInLogSetting(ver)
Expand All @@ -610,7 +609,7 @@ fun replaceVersion(ver: String) {

val encoding: String by project

tasks.register("replaceNewVersion") {
tasks.register<Task>("replaceNewVersion") {
val releaseVersion =
if (project.hasProperty("newVersion")) {
project.property("newVersion") as String
Expand Down Expand Up @@ -639,7 +638,7 @@ tasks.register("replaceNewVersion") {
}
}

tasks.register("replaceDraftVersion") {
tasks.register<Task>("replaceDraftVersion") {
val draftVersion =
if (project.hasProperty("draftVersion")) {
project.property("draftVersion") as String
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -25,12 +26,12 @@ 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
}

Expand Down
86 changes: 44 additions & 42 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

<resource-bundle>messages.DomaToolsBundle</resource-bundle>
<resource-bundle>messages.LLMInstallerBundle</resource-bundle>
<!-- Write it last to make it recognized as the default resource bundle -->
<resource-bundle>messages.DomaToolsSettingBundle</resource-bundle>

<projectListeners>
<listener
Expand All @@ -27,9 +29,12 @@

<applicationService
serviceImplementation="org.domaframework.doma.intellij.setting.state.DomaToolsFormatEnableSettings"/>
<applicationConfigurable groupId="org.domaframework.doma"
instance="org.domaframework.doma.intellij.setting.DomaToolsConfigurable"
displayName="Doma Tools" />
<applicationConfigurable
bundle="messages.DomaToolsSettingBundle"
id="org.domaframework.doma.intellij.setting.DomaToolsConfigurable"
groupId="org.domaframework.doma"
key="doma.tools"
instance="org.domaframework.doma.intellij.setting.DomaToolsConfigurable" />

<!-- Reference -->
<psi.referenceContributor
Expand Down Expand Up @@ -95,35 +100,40 @@

<!-- Intention Actions -->
<intentionAction>
<language>JAVA</language>
<className>org.domaframework.doma.intellij.action.dao.ConvertSqlAnnotationToFileAction</className>
<category>Doma tools</category>
<skipBeforeAfter>true</skipBeforeAfter>
<language>JAVA</language>
<bundleName>messages.DomaToolsSettingBundle</bundleName>
<className>org.domaframework.doma.intellij.action.dao.ConvertSqlAnnotationToFileAction</className>
<categoryKey>doma.tools</categoryKey>
<skipBeforeAfter>true</skipBeforeAfter>
</intentionAction>
<intentionAction>
<language>DomaSql</language>
<className>org.domaframework.doma.intellij.action.sql.ConvertSqlFileToAnnotationFromSqlAction</className>
<category>Doma tools</category>
<skipBeforeAfter>true</skipBeforeAfter>
<language>DomaSql</language>
<bundleName>messages.DomaToolsSettingBundle</bundleName>
<className>org.domaframework.doma.intellij.action.sql.ConvertSqlFileToAnnotationFromSqlAction</className>
<categoryKey>doma.tools</categoryKey>
<skipBeforeAfter>true</skipBeforeAfter>
</intentionAction>
<intentionAction>
<language>JAVA</language>
<bundleName>messages.DomaToolsSettingBundle</bundleName>
<className>org.domaframework.doma.intellij.action.dao.ConvertSqlFileToAnnotationFromDaoAction</className>
<categoryKey>doma.tools</categoryKey>
<skipBeforeAfter>true</skipBeforeAfter>
</intentionAction>
<intentionAction>
<language>JAVA</language>
<bundleName>messages.DomaToolsSettingBundle</bundleName>
<className>org.domaframework.doma.intellij.action.dao.BulkConvertSqlAnnotationToFileAction</className>
<categoryKey>doma.tools</categoryKey>
<skipBeforeAfter>true</skipBeforeAfter>
</intentionAction>
<intentionAction>
<language>JAVA</language>
<bundleName>messages.DomaToolsSettingBundle</bundleName>
<className>org.domaframework.doma.intellij.action.dao.BulkConvertSqlFileToAnnotationAction</className>
<categoryKey>doma.tools</categoryKey>
<skipBeforeAfter>true</skipBeforeAfter>
</intentionAction>
<intentionAction>
<language>JAVA</language>
<className>org.domaframework.doma.intellij.action.dao.ConvertSqlFileToAnnotationFromDaoAction</className>
<category>Doma tools</category>
<skipBeforeAfter>true</skipBeforeAfter>
</intentionAction>
<intentionAction>
<language>JAVA</language>
<className>org.domaframework.doma.intellij.action.dao.BulkConvertSqlAnnotationToFileAction</className>
<category>Doma tools</category>
<skipBeforeAfter>true</skipBeforeAfter>
</intentionAction>
<intentionAction>
<language>JAVA</language>
<className>org.domaframework.doma.intellij.action.dao.BulkConvertSqlFileToAnnotationAction</className>
<category>Doma tools</category>
<skipBeforeAfter>true</skipBeforeAfter>
</intentionAction>
</extensions>

<extensions defaultExtensionNs="org.intellij.intelliLang">
Expand All @@ -135,33 +145,25 @@
</extensions>

<!-- Action -->
<actions>
<actions resource-bundle="messages.DomaToolsSettingBundle">
<group
id="org.domaframework.doma.intellij.DomaToolGroupActions"
text="Doma Tools"
popup="true"
icon="AllIcons.Nodes.AbstractClass">
<add-to-group
group-id="EditorPopupMenu"
anchor="last"
/>
anchor="last"/>
<action
id="org.domaframework.doma.intellij.action.JumpToSQLFromDao"
class="org.domaframework.doma.intellij.action.dao.JumpToSQLFromDaoAction"
text="Jump to SQL"
description="Jump from DAO file to SQL file">
class="org.domaframework.doma.intellij.action.dao.JumpToSQLFromDaoAction">
<keyboard-shortcut keymap="$default" first-keystroke="alt D"/>
</action>
<action id="org.domaframework.doma.intellij.JumpToDaoFromSQL"
class="org.domaframework.doma.intellij.action.sql.JumpToDaoFromSQLAction"
text="Jump to DAO"
description="Jump from SQL file to DAO method definition">
class="org.domaframework.doma.intellij.action.sql.JumpToDaoFromSQLAction">
<keyboard-shortcut keymap="$default" first-keystroke="alt D"/>
</action>
<action id="org.domaframework.doma.intellij.GenerateSqlAction"
class="org.domaframework.doma.intellij.action.dao.GenerateSqlAction"
text="Generate SQL"
description="Generate SQL file from DAO method">
class="org.domaframework.doma.intellij.action.dao.GenerateSqlAction">
<keyboard-shortcut keymap="$default" first-keystroke="control alt G"/>
</action>
</group>
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/messages/DomaToolsSettingBundle.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Loading