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 7aaff7be8f..b73805ee66 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 e4d592c771..b1a3b8e34f 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 7419765135..be2695815c 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());