From ec6003127dc80c220d4124cf27de87c837d896e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=97=E5=86=9B?= <851516902@qq.com> Date: Mon, 18 May 2026 10:51:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96git=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vcs/TimeSkewCommitCheckHandler.kt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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(),