From 9bdf3565465fa85fb1e51a607d45799d1b484926 Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Mon, 27 Sep 2021 14:59:44 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-59737:=E4=BF=AE=E5=A4=8D=E5=8F=A6?= =?UTF-8?q?=E5=AD=98=E4=B8=BA=E6=B5=81=E7=A8=8B=E4=B8=AD=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=BB=98=E8=AE=A4=E5=90=8D=E6=9C=AAxxx.cptx.?= =?UTF-8?q?cpt=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/file/FILEChooserPane.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 5ea393ba6..299c29dc6 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -3,6 +3,7 @@ package com.fr.file; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; +import com.fr.decision.web.constant.DecCst; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; @@ -644,7 +645,7 @@ public class FILEChooserPane extends BasicPane { this.suffix = suffix; if (!text.endsWith(suffix)) { - text = text + suffix; + text = removeSuffix(text) + suffix; } fileNameTextField.removeDocumentListener(); fileNameTextField.setText(text); @@ -660,6 +661,14 @@ public class FILEChooserPane extends BasicPane { fileNameTextField.setFilter(new DefaultCompletionFilter(names)); } + /** + * 移除文件后缀的方法 + * 解决cptx文件的另存为操作默认会出现双后缀的bug(xxx.cptx.cpt) + **/ + private String removeSuffix(String text){ + return FileExtension.CPTX.matchExtension(text) ? text.substring(0, text.length() - FileExtension.CPTX.getSuffix().length()) : text; + } + /** * 打开对话框