From f0854ca7d60e1094d53ad0c8758dfffdfdb1fd53 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 14 Sep 2018 12:02:29 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-11121=20=E7=BB=9F=E4=B8=80=E7=94=A8unix?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E5=88=86=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/HistoryTemplateListCache.java | 12 ++++++------ .../com/fr/design/file/MutilTempalteTabPane.java | 11 +++-------- .../java/com/fr/design/mainframe/DesignerFrame.java | 2 +- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 7aaff7be8..b73805ee6 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -184,9 +184,9 @@ public class HistoryTemplateListCache implements CallbackEvent { */ public int contains(String filename) { for (int i = 0; i < historyList.size(); i++) { - String historyPath = historyList.get(i).getPath().replaceAll("/", "\\\\"); - //文件路径是全路径,历史路径是reportlets/模板名 - if (filename.endsWith(historyPath)) { + String historyPath = historyList.get(i).getPath(); + //文件路径和历史路径都是 reportlets/xxx/xxx/xxx/xx.suffix + if (filename.equals(historyPath)) { return i; } } @@ -233,16 +233,16 @@ public class HistoryTemplateListCache implements CallbackEvent { public void deleteFile(FileNodeFILE file) { boolean isDir = file.isDirectory(); - String suffix = isDir ? "\\" : StringUtils.EMPTY; + String suffix = isDir ? CoreConstants.SEPARATOR : StringUtils.EMPTY; // path like reportlets/xx/xxx/xxx - String path = file.getPath().replaceAll("/", "\\\\") + suffix; + String path = file.getPath() + suffix; ListIterator> iterator = historyList.listIterator(); while (iterator.hasNext()) { JTemplate template = iterator.next(); - String tPath = template.getPath().replaceAll("/", "\\\\"); + String tPath = template.getPath(); if (isDir ? tPath.startsWith(path) : tPath.equals(path)) { iterator.remove(); int index = iterator.nextIndex(); diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index e4d592c77..b1a3b8e34 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -13,12 +13,10 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.file.FILE; -import com.fr.file.FileNodeFILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.ProductConstants; -import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; @@ -54,7 +52,6 @@ import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; -import java.io.File; import java.util.List; /** @@ -679,12 +676,10 @@ public class MutilTempalteTabPane extends JComponent { } //当前激活的模板 - String filename = openedTemplate.get(selectedIndex).getEditingFILE().getPath(); - if (filename.startsWith(ProjectConstants.REPORTLETS_NAME)) { - filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename; - } + String filename = openedTemplate.get(selectedIndex).getPath(); + - filename = FilenameUtils.normalize(filename); + filename = FilenameUtils.standard(filename); if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index a8802553c..af5723d05 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -757,7 +757,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { path = workspace.getPath() + File.separator + path; } - defaultTitleSB.append(" " + path); + defaultTitleSB.append(" ").append(path); } setTitle(defaultTitleSB.toString());