diff --git a/src/main/kotlin/com/huangzj/protoplugin/vcs/TimeSkewCommitCheckHandler.kt b/src/main/kotlin/com/huangzj/protoplugin/vcs/TimeSkewCommitCheckHandler.kt index d24de67..8dfc24e 100644 --- a/src/main/kotlin/com/huangzj/protoplugin/vcs/TimeSkewCommitCheckHandler.kt +++ b/src/main/kotlin/com/huangzj/protoplugin/vcs/TimeSkewCommitCheckHandler.kt @@ -51,11 +51,11 @@ class TimeSkewCommitCheckHandler(private val project: Project?) : CheckinHandler val app = ApplicationManager.getApplication() val picked = if (app.isDispatchThread) { - showSkewDialog(project) + showSkewWarning(project) } else { val choice = AtomicInteger(0) app.invokeAndWait( - { choice.set(showSkewDialog(project)) }, + { choice.set(showSkewWarning(project)) }, ModalityState.defaultModalityState(), ) choice.get() @@ -68,20 +68,17 @@ class TimeSkewCommitCheckHandler(private val project: Project?) : CheckinHandler } } - private fun showSkewDialog(project: Project?): Int { - val title = "系统时间可能不准确" - val message = + private fun showSkewWarning(project: Project?): Int { + return Messages.showDialog( + project, """ 本机时间与网络标准时间相差超过 1 分钟,可能导致提交记录时间异常。 建议校准:Windows「设置 → 时间和语言 → 日期和时间」中开启自动设置时间。 - 「确定」:继续本次提交;「取消」:中止本次提交(本地修改保留)。 - """.trimIndent() - return Messages.showDialog( - project, - message, - title, + 点击「确定」继续提交;点击「取消」中止提交(不会回退本地文件)。 + """.trimIndent(), + "系统时间可能不准确", arrayOf("确定", "取消"), 0, Messages.getWarningIcon(),